def __init__(self, path = None, profile = None):
"""Constructor."""
- if not profile: profile = MH_PROFILE
+ if profile is None: profile = MH_PROFILE
self.profile = os.path.expanduser(profile)
- if not path: path = self.getprofile('Path')
+ if path is None: path = self.getprofile('Path')
if not path: path = PATH
if not os.path.isabs(path) and path[0] != '~':
path = os.path.join('~', path)
"""Constructor."""
self.folder = f
self.number = n
- if not fp:
+ if fp is None:
path = f.getmessagefilename(n)
fp = open(path, 'r')
mimetools.Message.__init__(self, fp)
argument is specified, it is used as a filter predicate to
decide which headers to return (its argument is the header
name converted to lower case)."""
- if not pred:
+ if pred is None:
return ''.join(self.headers)
headers = []
hit = 0
self.pairs = []
self.sep = sep
self.rng = rng
- if data: self.fromstring(data)
+ if data is not None: self.fromstring(data)
def reset(self):
self.pairs = []
class netrc:
def __init__(self, file=None):
- if not file:
+ if file is None:
try:
file = os.path.join(os.environ['HOME'], ".netrc")
except KeyError:
Result when a message number argument is given is a
single response: the "scan listing" for that message.
"""
- if which:
+ if which is not None:
return self._shortcmd('LIST %s' % which)
return self._longcmd('LIST')
in the form 'response mesgnum uid', otherwise result is
the list ['response', ['mesgnum uid', ...], octets]
"""
- if which:
+ if which is not None:
return self._shortcmd('UIDL %s' % which)
return self._longcmd('UIDL')
self.__depth = depth
self.__indent_per_level = indent
self.__width = width
- if stream:
+ if stream is not None:
self.__stream = stream
else:
self.__stream = sys.stdout
bias = self.bias
self.bias = bias # Materialize in local dict for lookup speed.
- if not timer:
+ if timer is None:
if os.name == 'mac':
self.timer = MacOS.GetTicks
self.dispatcher = self.trace_dispatch_mac
def __init__(self, profile=None):
cmd.Cmd.__init__(self)
self.prompt = "% "
- if profile:
+ if profile is not None:
self.stats = Stats(profile)
else:
self.stats = None
sys.stderr.write(line.replace('File "<string>"',
'File "%s"' % (dfile or file)))
return
- if not cfile:
+ if cfile is None:
cfile = file + (__debug__ and 'c' or 'o')
fc = open(cfile, 'wb')
fc.write('\0\0\0\0')