]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
pyfec: argparse: simplify
authorZooko O'Whielacronx <zooko@zooko.com>
Sat, 14 Apr 2007 22:43:41 +0000 (15:43 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sat, 14 Apr 2007 22:43:41 +0000 (15:43 -0700)
pyfec/fec/util/argparse.py

index e6159102aac943a9482c1fc0e0f6d8e852ff90c4..cb67cdb7dd7e0b957a411a98c85ce1f872f4e576 100644 (file)
@@ -842,7 +842,8 @@ class FileType(object):
     """    
     def __init__(self, mode='r', bufsize=None):
         self._mode = mode
-        self._bufsize = bufsize
+        if self._bufsize is None:
+            self._bufsize = -1
     
     def __call__(self, string):
         # the special argument "-" means sys.std{in,out}
@@ -856,10 +857,7 @@ class FileType(object):
                 raise ValueError(msg)
 
         # all other arguments are used as file names
-        if self._bufsize:
-            return open(string, self._mode, self._bufsize)
-        else:
-            return open(string, self._mode)
+        return open(string, self._mode, self._bufsize)
 
 
 # ===========================