From: Zooko O'Whielacronx Date: Sat, 14 Apr 2007 22:43:41 +0000 (-0700) Subject: pyfec: argparse: simplify X-Git-Url: https://git.rkrishnan.org/components/%22news.html/...?a=commitdiff_plain;h=c5c7605d548a0f4528f900c88e9588525bc5d6d1;p=tahoe-lafs%2Ftahoe-lafs.git pyfec: argparse: simplify --- diff --git a/pyfec/fec/util/argparse.py b/pyfec/fec/util/argparse.py index e6159102..cb67cdb7 100644 --- a/pyfec/fec/util/argparse.py +++ b/pyfec/fec/util/argparse.py @@ -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) # ===========================