Kaydet (Commit) a19a168c authored tarafından Tim Peters's avatar Tim Peters

Whitespace normalization.

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