diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-01-29 03:49:43 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-01-29 03:49:43 (GMT) |
commit | 2c60f7a13697bbc19c4d5ef0b052c34cf1848244 (patch) | |
tree | 7e33cdc40b1e60ad8729008f344bb8849e1373e1 /Lib | |
parent | c0c12b57070a5b494662bebc418e3958bf5bdbee (diff) | |
download | cpython-2c60f7a13697bbc19c4d5ef0b052c34cf1848244.zip cpython-2c60f7a13697bbc19c4d5ef0b052c34cf1848244.tar.gz cpython-2c60f7a13697bbc19c4d5ef0b052c34cf1848244.tar.bz2 |
Whitespace normalization.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/SimpleXMLRPCServer.py | 68 | ||||
-rw-r--r-- | Lib/_strptime.py | 6 | ||||
-rw-r--r-- | Lib/dummy_thread.py | 10 | ||||
-rw-r--r-- | Lib/macpath.py | 8 | ||||
-rw-r--r-- | Lib/modulefinder.py | 6 | ||||
-rw-r--r-- | Lib/os.py | 6 | ||||
-rw-r--r-- | Lib/pickletools.py | 8 | ||||
-rw-r--r-- | Lib/pty.py | 4 | ||||
-rw-r--r-- | Lib/py_compile.py | 18 | ||||
-rw-r--r-- | Lib/tarfile.py | 2 |
10 files changed, 68 insertions, 68 deletions
diff --git a/Lib/SimpleXMLRPCServer.py b/Lib/SimpleXMLRPCServer.py index 6320184..54533bf 100644 --- a/Lib/SimpleXMLRPCServer.py +++ b/Lib/SimpleXMLRPCServer.py @@ -32,7 +32,7 @@ class MyFuncs: ['string.' + method for method in list_public_methods(self.string)] def pow(self, x, y): return pow(x, y) def add(self, x, y) : return x + y - + server = SimpleXMLRPCServer(("localhost", 8000)) server.register_introspection_functions() server.register_instance(MyFuncs()) @@ -137,7 +137,7 @@ def remove_duplicates(lst): Returns a copy of a list without duplicates. Every list item must be hashable and the order of the items in the resulting list is not defined. - """ + """ u = {} for x in lst: u[x] = 1 @@ -151,7 +151,7 @@ class SimpleXMLRPCDispatcher: and then to dispatch them. There should never be any reason to instantiate this class directly. """ - + def __init__(self): self.funcs = {} self.instance = None @@ -195,7 +195,7 @@ class SimpleXMLRPCDispatcher: see http://xmlrpc.usefulinc.com/doc/reserved.html """ - + self.funcs.update({'system.listMethods' : self.system_listMethods, 'system.methodSignature' : self.system_methodSignature, 'system.methodHelp' : self.system_methodHelp}) @@ -205,28 +205,28 @@ class SimpleXMLRPCDispatcher: namespace. see http://www.xmlrpc.com/discuss/msgReader$1208""" - + self.funcs.update({'system.multicall' : self.system_multicall}) - + def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. - + XML-RPC methods are dispatched from the marshalled (XML) data using the _dispatch method and the result is returned as marshalled data. For backwards compatibility, a dispatch - function can be provided as an argument (see comment in + function can be provided as an argument (see comment in SimpleXMLRPCRequestHandler.do_POST) but overriding the existing method through subclassing is the prefered means of changing method dispatch behavior. """ - + params, method = xmlrpclib.loads(data) # generate response try: if dispatch_method is not None: response = dispatch_method(method, params) - else: + else: response = self._dispatch(method, params) # wrap response in a singleton tuple response = (response,) @@ -245,7 +245,7 @@ class SimpleXMLRPCDispatcher: """system.listMethods() => ['add', 'subtract', 'multiple'] Returns a list of the methods supported by the server.""" - + methods = self.funcs.keys() if self.instance is not None: # Instance can implement _listMethod to return a list of @@ -263,7 +263,7 @@ class SimpleXMLRPCDispatcher: ) methods.sort() return methods - + def system_methodSignature(self, method_name): """system.methodSignature('add') => [double, int, int] @@ -274,14 +274,14 @@ class SimpleXMLRPCDispatcher: This server does NOT support system.methodSignature.""" # See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html - + return 'signatures not supported' def system_methodHelp(self, method_name): """system.methodHelp('add') => "Adds two integers together" Returns a string containing documentation for the specified method.""" - + method = None if self.funcs.has_key(method_name): method = self.funcs[method_name] @@ -314,9 +314,9 @@ class SimpleXMLRPCDispatcher: Allows the caller to package multiple XML-RPC calls into a single request. - See http://www.xmlrpc.com/discuss/msgReader$1208 + See http://www.xmlrpc.com/discuss/msgReader$1208 """ - + results = [] for call in call_list: method_name = call['methodName'] @@ -337,7 +337,7 @@ class SimpleXMLRPCDispatcher: 'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)} ) return results - + def _dispatch(self, method, params): """Dispatches the XML-RPC method. @@ -382,7 +382,7 @@ class SimpleXMLRPCDispatcher: return func(*params) else: raise Exception('method "%s" is not supported' % method) - + class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Simple XML-RPC request handler class. @@ -396,7 +396,7 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. """ - + try: # get arguments data = self.rfile.read(int(self.headers["content-length"])) @@ -423,14 +423,14 @@ class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): # shut down the connection self.wfile.flush() self.connection.shutdown(1) - + def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" if self.server.logRequests: BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size) -class SimpleXMLRPCServer(SocketServer.TCPServer, +class SimpleXMLRPCServer(SocketServer.TCPServer, SimpleXMLRPCDispatcher): """Simple XML-RPC server. @@ -444,21 +444,21 @@ class SimpleXMLRPCServer(SocketServer.TCPServer, def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests - + SimpleXMLRPCDispatcher.__init__(self) SocketServer.TCPServer.__init__(self, addr, requestHandler) - + class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): """Simple handler for XML-RPC data passed through CGI.""" - + def __init__(self): SimpleXMLRPCDispatcher.__init__(self) def handle_xmlrpc(self, request_text): """Handle a single XML-RPC request""" - + response = self._marshaled_dispatch(request_text) - + print 'Content-Type: text/xml' print 'Content-Length: %d' % len(response) print @@ -474,11 +474,11 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): code = 400 message, explain = \ BaseHTTPServer.BaseHTTPRequestHandler.responses[code] - + response = BaseHTTPServer.DEFAULT_ERROR_MESSAGE % \ { - 'code' : code, - 'message' : message, + 'code' : code, + 'message' : message, 'explain' : explain } print 'Status: %d %s' % (code, message) @@ -486,25 +486,25 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): print 'Content-Length: %d' % len(response) print print response - + def handle_request(self, request_text = None): """Handle a single XML-RPC request passed through a CGI post method. - + If no XML data is given then it is read from stdin. The resulting XML-RPC response is printed to stdout along with the correct HTTP headers. """ - + if request_text is None and \ os.environ.get('REQUEST_METHOD', None) == 'GET': self.handle_get() else: # POST data is normally available through stdin if request_text is None: - request_text = sys.stdin.read() + request_text = sys.stdin.read() self.handle_xmlrpc(request_text) - + if __name__ == '__main__': server = SimpleXMLRPCServer(("localhost", 8000)) server.register_function(pow) diff --git a/Lib/_strptime.py b/Lib/_strptime.py index 0863426..4afc8fc 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -499,12 +499,12 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): #populous then just inline calculations. Also might be able to use #``datetime`` and the methods it provides. if julian == -1: - julian = julianday(year, month, day) + julian = julianday(year, month, day) else: # Assuming that if they bothered to include Julian day it will #be accurate - year, month, day = gregorian(julian, year) + year, month, day = gregorian(julian, year) if weekday == -1: - weekday = dayofweek(year, month, day) + weekday = dayofweek(year, month, day) return time.struct_time((year, month, day, hour, minute, second, weekday, julian, tz)) diff --git a/Lib/dummy_thread.py b/Lib/dummy_thread.py index b0ba0ce..e4bf05a 100644 --- a/Lib/dummy_thread.py +++ b/Lib/dummy_thread.py @@ -4,7 +4,7 @@ Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: - + try: import thread except ImportError: @@ -67,7 +67,7 @@ def allocate_lock(): class LockType(object): """Class implementing dummy implementation of thread.LockType. - + Compatibility is maintained by maintaining self.locked_status which is a boolean that stores the state of the lock. Pickling of the lock, though, should not be done since if the thread module is @@ -78,7 +78,7 @@ class LockType(object): def __init__(self): self.locked_status = False - + def acquire(self, waitflag=None): """Dummy implementation of acquire(). @@ -92,7 +92,7 @@ class LockType(object): """ if waitflag is None: self.locked_status = True - return None + return None elif not waitflag: if not self.locked_status: self.locked_status = True @@ -101,7 +101,7 @@ class LockType(object): return False else: self.locked_status = True - return True + return True def release(self): """Release the dummy lock.""" diff --git a/Lib/macpath.py b/Lib/macpath.py index 8cebc08..e8ac467 100644 --- a/Lib/macpath.py +++ b/Lib/macpath.py @@ -85,10 +85,10 @@ def dirname(s): return split(s)[0] def basename(s): return split(s)[1] def ismount(s): - if not isabs(s): - return False - components = split(s) - return len(components) == 2 and components[1] == '' + if not isabs(s): + return False + components = split(s) + return len(components) == 2 and components[1] == '' def isdir(s): """Return true if the pathname refers to an existing directory.""" diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py index 9d524c2..68ea9b9 100644 --- a/Lib/modulefinder.py +++ b/Lib/modulefinder.py @@ -514,9 +514,9 @@ class ModuleFinder: if isinstance(consts[i], type(co)): consts[i] = self.replace_paths_in_code(consts[i]) - return new.code(co.co_argcount, co.co_nlocals, co.co_stacksize, - co.co_flags, co.co_code, tuple(consts), co.co_names, - co.co_varnames, new_filename, co.co_name, + return new.code(co.co_argcount, co.co_nlocals, co.co_stacksize, + co.co_flags, co.co_code, tuple(consts), co.co_names, + co.co_varnames, new_filename, co.co_name, co.co_firstlineno, co.co_lnotab, co.co_freevars, co.co_cellvars) @@ -415,9 +415,9 @@ else: environ = _Environ(environ) def getenv(key, default=None): - """Get an environment variable, return None if it doesn't exist. - The optional second argument can specify an alternate default.""" - return environ.get(key, default) + """Get an environment variable, return None if it doesn't exist. + The optional second argument can specify an alternate default.""" + return environ.get(key, default) __all__.append("getenv") def _exists(name): diff --git a/Lib/pickletools.py b/Lib/pickletools.py index 183db10..4f72923 100644 --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -1859,10 +1859,10 @@ def dis(pickle, out=None, indentlevel=4): markmsg = None if markstack and markobject in opcode.stack_before: - assert markobject not in opcode.stack_after - markpos = markstack.pop() - if markpos is not None: - markmsg = "(MARK at %d)" % markpos + assert markobject not in opcode.stack_after + markpos = markstack.pop() + if markpos is not None: + markmsg = "(MARK at %d)" % markpos if arg is not None or markmsg: # make a mild effort to align arguments @@ -92,8 +92,8 @@ def slave_open(tty_name): except ImportError: return result try: - ioctl(result, I_PUSH, "ptem") - ioctl(result, I_PUSH, "ldterm") + ioctl(result, I_PUSH, "ptem") + ioctl(result, I_PUSH, "ldterm") except IOError: pass return result diff --git a/Lib/py_compile.py b/Lib/py_compile.py index 95d6a08..2f4206d 100644 --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -24,24 +24,24 @@ class PyCompileError(Exception): raise PyCompileError(exc_type,exc_value,file[,msg]) where - + exc_type: exception type to be used in error message type name can be accesses as class variable 'exc_type_name' - + exc_value: exception value to be used in error message can be accesses as class variable 'exc_value' - + file: name of file being compiled to be used in error message can be accesses as class variable 'file' - + msg: string message to be written as error message If no value is given, a default exception message will be given, consistent with 'standard' py_compile output. message (or default) can be accesses as class variable 'msg' - + """ - + def __init__(self, exc_type, exc_value, file, msg=''): exc_type_name = exc_type.__name__ if exc_type is SyntaxError: @@ -49,7 +49,7 @@ class PyCompileError(Exception): errmsg = tbtext.replace('File "<string>"', 'File "%s"' % file) else: errmsg = "Sorry: %s: %s" % (exc_type_name,exc_value) - + Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file) self.exc_type_name = exc_type_name @@ -94,7 +94,7 @@ def compile(file, cfile=None, dfile=None, doraise=False): and the function will return to the caller. If an exception occurs and this flag is set to True, a PyCompileError exception will be raised. - + Note that it isn't necessary to byte-compile Python modules for execution efficiency -- Python itself byte-compiles a module when it is loaded, and if it can, writes out the bytecode to the @@ -159,6 +159,6 @@ def main(args=None): compile(filename, doraise=True) except PyCompileError,err: sys.stderr.write(err.msg) - + if __name__ == "__main__": main() diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 3e334be..6a92a10 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1249,7 +1249,7 @@ class TarFile(object): if self.posix: prefix = tarinfo.name[:LENGTH_PREFIX + 1] while prefix and prefix[-1] != "/": - prefix = prefix[:-1] + prefix = prefix[:-1] name = tarinfo.name[len(prefix):] prefix = prefix[:-1] |