mirror of https://github.com/python/cpython
Whitespace normalization.
This commit is contained in:
parent
301ab7f2d0
commit
a19a168ccc
|
@ -63,7 +63,7 @@ if (sys.platform.lower().startswith("win")
|
|||
def ssl(sock, keyfile=None, certfile=None):
|
||||
if hasattr(sock, "_sock"):
|
||||
sock = sock._sock
|
||||
return _realsslcall(sock, keyfile, certfile)
|
||||
return _realsslcall(sock, keyfile, certfile)
|
||||
|
||||
|
||||
# WSA error codes
|
||||
|
|
|
@ -34,7 +34,7 @@ class SymbolTableFactory:
|
|||
return obj
|
||||
|
||||
newSymbolTable = SymbolTableFactory()
|
||||
|
||||
|
||||
def bool(x):
|
||||
"""Helper to force boolean result to 1 or 0"""
|
||||
if x:
|
||||
|
@ -60,7 +60,7 @@ class SymbolTable:
|
|||
kind = ""
|
||||
else:
|
||||
kind = "%s " % self.__class__.__name__
|
||||
|
||||
|
||||
if self._table.name == "global":
|
||||
return "<%sSymbolTable for module %s>" % (kind, self._filename)
|
||||
else:
|
||||
|
@ -143,7 +143,7 @@ class Function(SymbolTable):
|
|||
if self.__locals is None:
|
||||
self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND)
|
||||
return self.__locals
|
||||
|
||||
|
||||
def get_globals(self):
|
||||
if self.__globals is None:
|
||||
glob = DEF_GLOBAL | DEF_FREE_GLOBAL
|
||||
|
@ -186,7 +186,7 @@ class Symbol:
|
|||
return bool(self.__flags & DEF_PARAM)
|
||||
|
||||
def is_global(self):
|
||||
return bool((self.__flags & DEF_GLOBAL)
|
||||
return bool((self.__flags & DEF_GLOBAL)
|
||||
or (self.__flags & DEF_FREE_GLOBAL))
|
||||
|
||||
def is_vararg(self):
|
||||
|
|
|
@ -60,7 +60,7 @@ if pid == pty.CHILD:
|
|||
os._exit(3)
|
||||
|
||||
# After pty.fork(), the child should already be a session leader.
|
||||
# (on those systems that have that concept.)
|
||||
# (on those systems that have that concept.)
|
||||
debug("In child, calling os.setsid()")
|
||||
try:
|
||||
os.setsid()
|
||||
|
|
|
@ -10,12 +10,12 @@ def zipTest(f, compression, srccontents):
|
|||
zip.write(srcname, "another.name")
|
||||
zip.write(srcname, srcname)
|
||||
zip.close()
|
||||
|
||||
|
||||
zip = zipfile.ZipFile(f, "r", compression) # Read the ZIP archive
|
||||
readData2 = zip.read(srcname)
|
||||
readData1 = zip.read("another.name")
|
||||
zip.close()
|
||||
|
||||
|
||||
if readData1 != srccontents or readData2 != srccontents:
|
||||
raise TestFailed, "Written data doesn't equal read data."
|
||||
|
||||
|
@ -25,11 +25,11 @@ try:
|
|||
for i in range(0, 1000):
|
||||
fp.write("Test of zipfile line %d.\n" % i)
|
||||
fp.close()
|
||||
|
||||
|
||||
fp = open(srcname, "rb")
|
||||
writtenData = fp.read()
|
||||
fp.close()
|
||||
|
||||
|
||||
for file in (zipname, tempfile.TemporaryFile(), StringIO.StringIO()):
|
||||
zipTest(file, zipfile.ZIP_STORED, writtenData)
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ def print_last(limit=None, file=None):
|
|||
|
||||
def print_stack(f=None, limit=None, file=None):
|
||||
"""Print a stack trace from its invocation point.
|
||||
|
||||
|
||||
The optional 'f' argument can be used to specify an alternate
|
||||
stack frame at which to start. The optional 'limit' and 'file'
|
||||
arguments have the same meaning as for print_exception().
|
||||
|
|
|
@ -103,7 +103,7 @@ class TestResult:
|
|||
def stop(self):
|
||||
"Indicates that the tests should be aborted"
|
||||
self.shouldStop = 1
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s run=%i errors=%i failures=%i>" % \
|
||||
(self.__class__, self.testsRun, len(self.errors),
|
||||
|
@ -116,12 +116,12 @@ class TestCase:
|
|||
By default, the test code itself should be placed in a method named
|
||||
'runTest'.
|
||||
|
||||
If the fixture may be used for many test cases, create as
|
||||
If the fixture may be used for many test cases, create as
|
||||
many test methods as are needed. When instantiating such a TestCase
|
||||
subclass, specify in the constructor arguments the name of the test method
|
||||
that the instance is to execute.
|
||||
|
||||
Test authors should subclass TestCase for their own tests. Construction
|
||||
Test authors should subclass TestCase for their own tests. Construction
|
||||
and deconstruction of the test's environment ('fixture') can be
|
||||
implemented by overriding the 'setUp' and 'tearDown' methods respectively.
|
||||
|
||||
|
@ -480,7 +480,7 @@ class _WritelnDecorator:
|
|||
def writeln(self, *args):
|
||||
if args: apply(self.write, args)
|
||||
self.write('\n') # text-mode streams translate to \r\n if needed
|
||||
|
||||
|
||||
|
||||
class _TextTestResult(TestResult):
|
||||
"""A test result class that can print formatted text results to a stream.
|
||||
|
@ -550,7 +550,7 @@ class _TextTestResult(TestResult):
|
|||
|
||||
class TextTestRunner:
|
||||
"""A test runner class that displays results in textual form.
|
||||
|
||||
|
||||
It prints out the names of tests as they are run, errors as they
|
||||
occur, and a summary of the results at the end of the test run.
|
||||
"""
|
||||
|
@ -587,7 +587,7 @@ class TextTestRunner:
|
|||
else:
|
||||
self.stream.writeln("OK")
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
@ -668,7 +668,7 @@ Examples:
|
|||
if self.testRunner is None:
|
||||
self.testRunner = TextTestRunner(verbosity=self.verbosity)
|
||||
result = self.testRunner.run(self.test)
|
||||
sys.exit(not result.wasSuccessful())
|
||||
sys.exit(not result.wasSuccessful())
|
||||
|
||||
main = TestProgram
|
||||
|
||||
|
|
|
@ -131,10 +131,10 @@ class ZipInfo:
|
|||
|
||||
|
||||
class ZipFile:
|
||||
""" Class with methods to open, read, write, close, list zip files.
|
||||
|
||||
""" Class with methods to open, read, write, close, list zip files.
|
||||
|
||||
z = ZipFile(file, mode="r", compression=ZIP_STORED)
|
||||
|
||||
|
||||
file: Either the path to the file, or a file-like object.
|
||||
If it is a path, the file will be opened and closed by ZipFile.
|
||||
mode: The mode can be either read "r", write "w" or append "a".
|
||||
|
@ -158,7 +158,7 @@ class ZipFile:
|
|||
self.filelist = [] # List of ZipInfo instances for archive
|
||||
self.compression = compression # Method of compression
|
||||
self.mode = key = mode[0]
|
||||
|
||||
|
||||
# Check if we were passed a file-like object
|
||||
if type(file) in _STRING_TYPES:
|
||||
self._filePassed = 0
|
||||
|
@ -169,7 +169,7 @@ class ZipFile:
|
|||
self._filePassed = 1
|
||||
self.fp = file
|
||||
self.filename = getattr(file, 'name', None)
|
||||
|
||||
|
||||
if key == 'r':
|
||||
self._GetContents()
|
||||
elif key == 'w':
|
||||
|
|
Loading…
Reference in New Issue