cpython: 67053b135ed9 (original) (raw)

Mercurial > cpython

changeset 73076:67053b135ed9

Cleanup code: remove int/long idioms and simplify a while statement.

Florent Xicluna florent.xicluna@gmail.com
date Sun, 23 Oct 2011 22:11:00 +0200
parents d4839fea4a5a
children 94e275e6450c
files Lib/ftplib.py Lib/optparse.py Lib/pickletools.py Lib/xdrlib.py Lib/xmlrpc/client.py
diffstat 5 files changed, 10 insertions(+), 35 deletions(-)[+] [-] Lib/ftplib.py 17 Lib/optparse.py 5 Lib/pickletools.py 5 Lib/xdrlib.py 6 Lib/xmlrpc/client.py 12

line wrap: on

line diff

--- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -175,10 +175,8 @@ class FTP: # Internal: "sanitize" a string for printing def sanitize(self, s):

@@ -596,10 +594,7 @@ class FTP: resp = self.sendcmd('SIZE ' + filename) if resp[:3] == '213': s = resp[3:].strip()

def mkd(self, dirname): '''Make a directory, return its full pathname.''' @@ -861,11 +856,7 @@ def parse150(resp): m = _150_re.match(resp) if not m: return None

_227_re = None

--- a/Lib/optparse.py +++ b/Lib/optparse.py @@ -417,11 +417,8 @@ def _parse_num(val, type): def _parse_int(val): return _parse_num(val, int) -def _parse_long(val):

- _builtin_cvt = { "int" : (_parse_int, _("integer")),

--- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -510,10 +510,7 @@ def read_decimalnl_short(f): elif s == b"01": return True

def read_decimalnl_long(f): r"""

--- a/Lib/xdrlib.py +++ b/Lib/xdrlib.py @@ -141,11 +141,7 @@ class Unpacker: data = self.__buf[i:j] if len(data) < 4: raise EOFError

def unpack_int(self): i = self.__pos

--- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -535,15 +535,6 @@ class Marshaller: write("") dispatch[type(None)] = dump_nil

- def dump_bool(self, value, write): write("") write(value and "1" or "0") @@ -558,6 +549,9 @@ class Marshaller: write("\n") dispatch[int] = dump_long

+ def dump_double(self, value, write): write("") write(repr(value))