From f44e685425c329ee04b9901a7bedcf7d07c4819a Mon Sep 17 00:00:00 2001 From: "Zooko O'Whielacronx zooko@zooko.com" Date: Sun, 15 Apr 2007 04:13:41 +0530 Subject: [PATCH] pyfec: argparse: simplify darcs-hash:96a4b8dc58951e4a02c6c0bef878c1f22b21f718 --- pyfec/fec/util/argparse.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pyfec/fec/util/argparse.py b/pyfec/fec/util/argparse.py index e615910..cb67cdb 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) # =========================== -- 2.45.2