From: <fwi...@us...> - 2009-08-10 16:48:29
|
Revision: 6636 http://jython.svn.sourceforge.net/jython/?rev=6636&view=rev Author: fwierzbicki Date: 2009-08-10 16:48:17 +0000 (Mon, 10 Aug 2009) Log Message: ----------- Ran these through reindent.py. These are the files that resulted in fairly trivial changes. The files os.py, dbexts.py, and isql.py resulted in large changes, so I'll look at them one at a time. Modified Paths: -------------- trunk/jython/Lib/_rawffi.py trunk/jython/Lib/codeop.py trunk/jython/Lib/datetime.py trunk/jython/Lib/fileinput.py trunk/jython/Lib/javapath.py trunk/jython/Lib/javashell.py trunk/jython/Lib/pkgutil.py trunk/jython/Lib/posixpath.py trunk/jython/Lib/readline.py trunk/jython/Lib/signal.py trunk/jython/Lib/socket.py trunk/jython/Lib/subprocess.py trunk/jython/Lib/telnetlib.py trunk/jython/Lib/threading.py trunk/jython/Lib/unicodedata.py trunk/jython/Lib/zlib.py Modified: trunk/jython/Lib/_rawffi.py =================================================================== --- trunk/jython/Lib/_rawffi.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/_rawffi.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -52,6 +52,3 @@ fnp = FuncPtr(fn, name, argtypes, restype) self.cache[key] = fnp return fnp - - - Modified: trunk/jython/Lib/codeop.py =================================================================== --- trunk/jython/Lib/codeop.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/codeop.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -132,4 +132,3 @@ raise ValueError,"symbol arg must be either single or eval" symbol = CompileMode.getMode(symbol) return Py.compile_command_flags(source,filename,symbol,self._cflags,0) - Modified: trunk/jython/Lib/datetime.py =================================================================== --- trunk/jython/Lib/datetime.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/datetime.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -13,7 +13,7 @@ Sources for time zone and DST data: http://www.twinsun.com/tz/tz-link.htm This was originally copied from the sandbox of the CPython CVS repository. -Thanks to Tim Peters for suggesting using it. +Thanks to Tim Peters for suggesting using it. """ import time as _time @@ -599,9 +599,9 @@ def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(-self.__days, - -self.__seconds, - -self.__microseconds) + return timedelta(-self.__days, + -self.__seconds, + -self.__microseconds) def __pos__(self): return self @@ -1622,7 +1622,7 @@ if L[-1] == 0: del L[-1] if L[-1] == 0: - del L[-1] + del L[-1] s = ", ".join(map(str, L)) s = "%s(%s)" % ('datetime.' + self.__class__.__name__, s) if self._tzinfo is not None: @@ -2076,4 +2076,3 @@ perverse time zone returns a negative dst()). So a breaking case must be pretty bizarre, and a tzinfo subclass can override fromutc() if it is. """ - Modified: trunk/jython/Lib/fileinput.py =================================================================== --- trunk/jython/Lib/fileinput.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/fileinput.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -324,8 +324,8 @@ try: perm = os.fstat(self._file.fileno()).st_mode except (AttributeError, OSError): - # AttributeError occurs in Jython, where there's no - # os.fstat. + # AttributeError occurs in Jython, where there's no + # os.fstat. self._output = open(self._filename, "w") else: fd = os.open(self._filename, Modified: trunk/jython/Lib/javapath.py =================================================================== --- trunk/jython/Lib/javapath.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/javapath.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -38,7 +38,7 @@ type_name = '%s.' % obj_type.__module__ type_name += obj_type.__name__ return type_name - + def dirname(path): """Return the directory component of a pathname""" path = _tostr(path, "dirname") @@ -83,7 +83,7 @@ return (path[:n], path[n:]) def splitdrive(path): - """Split a pathname into drive and path specifiers. + """Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty. """ @@ -260,7 +260,7 @@ """Return an absolute path normalized and symbolic links eliminated""" path = _tostr(path, "realpath") return _realpath(path) - + def _realpath(path): try: return asPyString(File(sys.getPath(path)).getCanonicalPath()) @@ -358,6 +358,3 @@ res = res + c index = index + 1 return res - - - Modified: trunk/jython/Lib/javashell.py =================================================================== --- trunk/jython/Lib/javashell.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/javashell.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -28,7 +28,7 @@ def __warn( *args ): print " ".join( [str( arg ) for arg in args ]) - + class _ShellEnv: """Provide environment derived by spawning a subshell and parsing its environment. Also supports subshell execution functions and provides @@ -69,14 +69,14 @@ if self.cmd is None: msgFmt = "Unable to execute commands in subshell because shell" \ " functionality not implemented for OS %s" \ - " Failed command=%s" + " Failed command=%s" raise OSError( 0, msgFmt % ( os._name, cmd )) - + if isinstance(cmd, basestring): shellCmd = self.cmd + [cmd] else: shellCmd = cmd - + return shellCmd def _formatEnvironment( self, env ): Modified: trunk/jython/Lib/pkgutil.py =================================================================== --- trunk/jython/Lib/pkgutil.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/pkgutil.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -246,7 +246,7 @@ return f.read() finally: f.close() - + def _reopen(self): if self.file and self.file.closed: mod_type = self.etc[2] @@ -454,7 +454,7 @@ if loader is not None: return loader fullname = module.__name__ - elif module_or_name == sys: + elif module_or_name == sys: # Jython sys is not a real module; fake it here for now since # making it a module requires a fair amount of decoupling from # PySystemState Modified: trunk/jython/Lib/posixpath.py =================================================================== --- trunk/jython/Lib/posixpath.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/posixpath.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -227,7 +227,7 @@ """Test whether two pathnames reference the same actual file""" s1 = os.stat(f1) s2 = os.stat(f2) - return samestat(s1, s2) + return samestat(s1, s2) # XXX: Jython currently lacks fstat @@ -244,7 +244,7 @@ __all__.append("sameopenfile") -# XXX: Pure Java stat lacks st_ino/st_dev +# XXX: Pure Java stat lacks st_ino/st_dev if os._native_posix: # Are two stat buffers (obtained from stat, fstat or lstat) # describing the same file? Modified: trunk/jython/Lib/readline.py =================================================================== --- trunk/jython/Lib/readline.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/readline.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -6,9 +6,9 @@ """ try: - from org.gnu.readline import Readline, ReadlineCompleter + from org.gnu.readline import Readline, ReadlineCompleter except ImportError, msg: - raise ImportError, '%s. The readline module requires that java-readline from http://java-readline.sourceforge.net/ be on the classpath' % msg + raise ImportError, '%s. The readline module requires that java-readline from http://java-readline.sourceforge.net/ be on the classpath' % msg __all__ = ["readline"] @@ -55,10 +55,10 @@ """ class DerivedCompleter (ReadlineCompleter): def __init__ (self, method): - self.method = method + self.method = method def completer (self, text, state): - return self.method(text, state) + return self.method(text, state) Readline.setCompleter(DerivedCompleter(completionfunction)) Modified: trunk/jython/Lib/signal.py =================================================================== --- trunk/jython/Lib/signal.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/signal.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -1,22 +1,22 @@ """ This module provides mechanisms to use signal handlers in Python. - + Functions: - + signal(sig,action) -- set the action for a given signal (done) pause(sig) -- wait until a signal arrives [Unix only] alarm(seconds) -- cause SIGALRM after a specified time [Unix only] getsignal(sig) -- get the signal action for a given signal default_int_handler(action) -- default SIGINT handler (done, but acts string) - + Constants: - + SIG_DFL -- used to refer to the system default handler SIG_IGN -- used to ignore the signal NSIG -- number of defined signals - + SIGINT, SIGTERM, etc. -- signal numbers - + *** IMPORTANT NOTICES *** A signal handler function is called with two arguments: the first is the signal number, the second is the interrupted stack frame. @@ -173,7 +173,7 @@ def default_int_handler(sig, frame): """ default_int_handler(...) - + The default handler for SIGINT installed by Python. It raises KeyboardInterrupt. """ @@ -214,7 +214,7 @@ return self.scheduled - now else: return 0 - + def alarm(time): try: SIGALRM Modified: trunk/jython/Lib/socket.py =================================================================== --- trunk/jython/Lib/socket.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/socket.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -24,7 +24,7 @@ import time import types -# Java.io classes +# Java.io classes import java.io.BufferedInputStream import java.io.BufferedOutputStream # Java.io exceptions @@ -221,7 +221,7 @@ 'SOCK_RAW', 'SOCK_RDM', 'SOCK_SEQPACKET', 'SOCK_STREAM', 'SOL_SOCKET', 'SO_BROADCAST', 'SO_ERROR', 'SO_KEEPALIVE', 'SO_LINGER', 'SO_OOBINLINE', 'SO_RCVBUF', 'SO_REUSEADDR', 'SO_SNDBUF', 'SO_TIMEOUT', 'TCP_NODELAY', - 'INADDR_ANY', 'INADDR_BROADCAST', 'IPPROTO_TCP', 'IPPROTO_UDP', + 'INADDR_ANY', 'INADDR_BROADCAST', 'IPPROTO_TCP', 'IPPROTO_UDP', 'SocketType', 'error', 'herror', 'gaierror', 'timeout', 'getfqdn', 'gethostbyaddr', 'gethostbyname', 'gethostname', 'socket', 'getaddrinfo', 'getdefaulttimeout', 'setdefaulttimeout', @@ -529,8 +529,8 @@ names = [] addrs = [] for addr in addresses: - names.append(asPyString(addr.getHostName())) - addrs.append(asPyString(addr.getHostAddress())) + names.append(asPyString(addr.getHostName())) + addrs.append(asPyString(addr.getHostAddress())) return (names, addrs) def getfqdn(name=None): @@ -741,7 +741,7 @@ def shutdown(self, how): assert how in (SHUT_RD, SHUT_WR, SHUT_RDWR) if not self.sock_impl: - raise error(errno.ENOTCONN, "Transport endpoint is not connected") + raise error(errno.ENOTCONN, "Transport endpoint is not connected") try: self.sock_impl.shutdown(how) except java.lang.Exception, jlx: @@ -953,8 +953,8 @@ self.sock_impl.close() except java.lang.Exception, jlx: raise _map_exception(jlx) - + class _udpsocket(_nonblocking_api_mixin): sock_impl = None @@ -1027,7 +1027,7 @@ http://bugs.sun.com/view_bug.do?bug_id=6621689 """ try: - # This is the old 2.1 behaviour + # This is the old 2.1 behaviour #assert self.sock_impl # This is amak's preferred interpretation #raise error(errno.ENOTCONN, "Recvfrom on unbound udp socket meaningless operation") @@ -1124,7 +1124,7 @@ if isinstance(_sock, _nonblocking_api_mixin): _sock.close_lock.acquire() try: - _sock.reference_count -=1 + _sock.reference_count -=1 if not _sock.reference_count: _sock.close() self._sock = _closedsocket() Modified: trunk/jython/Lib/subprocess.py =================================================================== --- trunk/jython/Lib/subprocess.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/subprocess.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -562,7 +562,7 @@ (which takes a String cmdline). This process ruins String cmdlines from the user with escapes or quotes. To avoid this we first parse these cmdlines into an argv. - + Runtime.exec(String) is too naive and useless for this case. """ whitespace = ' \t' @@ -623,7 +623,7 @@ os_info = os._os_map.get(os._name) if os_info is None: os_info = os._os_map.get('posix') - + for shell_command in os_info[1]: executable = shell_command[0] if not os.path.isabs(executable): @@ -1174,7 +1174,7 @@ else: # Assuming file-like object errwrite = stderr.fileno() - + return (p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) @@ -1184,7 +1184,7 @@ """Determine if the subprocess' stderr should be redirected to stdout """ - return (errwrite == STDOUT or c2pwrite not in (None, PIPE) and + return (errwrite == STDOUT or c2pwrite not in (None, PIPE) and c2pwrite is errwrite) @@ -1196,7 +1196,7 @@ def _setup_env(self, env, builder_env): """Carefully merge env with ProcessBuilder's only overwriting key/values that differ - + System.getenv (Map<String, String>) may be backed by <byte[], byte[]> on UNIX platforms where these are really bytes. ProcessBuilder's env inherits its contents and will Modified: trunk/jython/Lib/telnetlib.py =================================================================== --- trunk/jython/Lib/telnetlib.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/telnetlib.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -38,9 +38,9 @@ import socket import os if os.name == 'java': - from select import cpython_compatible_select as select + from select import cpython_compatible_select as select else: - from select import select + from select import select del os Modified: trunk/jython/Lib/threading.py =================================================================== --- trunk/jython/Lib/threading.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/threading.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -125,10 +125,10 @@ self._thread.join(millis_int, nanos) else: self._thread.join() - + def getName(self): return self._thread.getName() - + def setName(self, name): self._thread.setName(str(name)) Modified: trunk/jython/Lib/unicodedata.py =================================================================== --- trunk/jython/Lib/unicodedata.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/unicodedata.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -91,7 +91,7 @@ if v is None: v = check_segments(codepoint, _segments) if v is not None: - return "%s-%X" % (v[8], codepoint) + return "%s-%X" % (v[8], codepoint) if v is None: if default is not Nonesuch: @@ -126,13 +126,13 @@ v = _eaw.get(codepoint, None) if v is None: v = check_segments(codepoint, _eaw_segments) - + if v is None: if default is not Nonesuch: return default raise ValueError() return v - + def get(unichr, default, fn, getter): codepoint = get_codepoint(unichr, fn) data = _codepoints.get(codepoint, None) @@ -192,24 +192,24 @@ try: from java.text import Normalizer - _forms = { - 'NFC': Normalizer.Form.NFC, - 'NFKC': Normalizer.Form.NFKC, - 'NFD': Normalizer.Form.NFD, - 'NFKD': Normalizer.Form.NFKD - } + _forms = { + 'NFC': Normalizer.Form.NFC, + 'NFKC': Normalizer.Form.NFKC, + 'NFD': Normalizer.Form.NFD, + 'NFKD': Normalizer.Form.NFKD + } - def normalize(form, unistr): - """ - Return the normal form 'form' for the Unicode string unistr. Valid - values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'. - """ - + def normalize(form, unistr): + """ + Return the normal form 'form' for the Unicode string unistr. Valid + values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'. + """ + try: normalizer_form = _forms[form] except KeyError: raise ValueError('invalid normalization form') - return Normalizer.normalize(unistr, normalizer_form) + return Normalizer.normalize(unistr, normalizer_form) except ImportError: pass Modified: trunk/jython/Lib/zlib.py =================================================================== --- trunk/jython/Lib/zlib.py 2009-08-09 00:05:01 UTC (rev 6635) +++ trunk/jython/Lib/zlib.py 2009-08-10 16:48:17 UTC (rev 6636) @@ -45,7 +45,7 @@ _valid_flush_modes = (Z_FINISH,) def adler32(s, value=1): - if value != 1: + if value != 1: raise ValueError, "adler32 only support start value of 1" checksum = Adler32() checksum.update(String.getBytes(s, 'iso-8859-1')) @@ -86,7 +86,7 @@ raise error("compressobj may not be used after flush(Z_FINISH)") self.deflater.setInput(string, 0, len(string)) return _get_deflate_data(self.deflater) - + def flush(self, mode=Z_FINISH): if self._ended: raise error("compressobj may not be used after flush(Z_FINISH)") @@ -111,7 +111,7 @@ def decompress(self, string, max_length=0): if self._ended: raise error("decompressobj may not be used after flush()") - + # unused_data is always "" until inflation is finished; then it is # the unused bytes of the input; # unconsumed_tail is whatever input was not used because max_length @@ -132,7 +132,7 @@ self.unconsumed_tail = string[-r:] else: self.unused_data = string[-r:] - + return inflated def flush(self, length=None): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |