Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16e3c42

Browse files
committed
Replace boolean test with is None.
1 parent 793d4b4 commit 16e3c42

7 files changed

Lines changed: 12 additions & 12 deletions

File tree

Lib/mhlib.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ class MH:
9898

9999
def __init__(self, path = None, profile = None):
100100
"""Constructor."""
101-
if not profile: profile = MH_PROFILE
101+
if profile is None: profile = MH_PROFILE
102102
self.profile = os.path.expanduser(profile)
103-
if not path: path = self.getprofile('Path')
103+
if path is None: path = self.getprofile('Path')
104104
if not path: path = PATH
105105
if not os.path.isabs(path) and path[0] != '~':
106106
path = os.path.join('~', path)
@@ -665,7 +665,7 @@ def __init__(self, f, n, fp = None):
665665
"""Constructor."""
666666
self.folder = f
667667
self.number = n
668-
if not fp:
668+
if fp is None:
669669
path = f.getmessagefilename(n)
670670
fp = open(path, 'r')
671671
mimetools.Message.__init__(self, fp)
@@ -679,7 +679,7 @@ def getheadertext(self, pred = None):
679679
argument is specified, it is used as a filter predicate to
680680
decide which headers to return (its argument is the header
681681
name converted to lower case)."""
682-
if not pred:
682+
if pred is None:
683683
return ''.join(self.headers)
684684
headers = []
685685
hit = 0
@@ -791,7 +791,7 @@ def __init__(self, data = None, sep = ',', rng = '-'):
791791
self.pairs = []
792792
self.sep = sep
793793
self.rng = rng
794-
if data: self.fromstring(data)
794+
if data is not None: self.fromstring(data)
795795

796796
def reset(self):
797797
self.pairs = []

Lib/netrc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __str__(self):
2121

2222
class netrc:
2323
def __init__(self, file=None):
24-
if not file:
24+
if file is None:
2525
try:
2626
file = os.path.join(os.environ['HOME'], ".netrc")
2727
except KeyError:

Lib/poplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def list(self, which=None):
220220
Result when a message number argument is given is a
221221
single response: the "scan listing" for that message.
222222
"""
223-
if which:
223+
if which is not None:
224224
return self._shortcmd('LIST %s' % which)
225225
return self._longcmd('LIST')
226226

@@ -313,7 +313,7 @@ def uidl(self, which=None):
313313
in the form 'response mesgnum uid', otherwise result is
314314
the list ['response', ['mesgnum uid', ...], octets]
315315
"""
316-
if which:
316+
if which is not None:
317317
return self._shortcmd('UIDL %s' % which)
318318
return self._longcmd('UIDL')
319319

Lib/pprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(self, indent=1, width=80, depth=None, stream=None):
101101
self.__depth = depth
102102
self.__indent_per_level = indent
103103
self.__width = width
104-
if stream:
104+
if stream is not None:
105105
self.__stream = stream
106106
else:
107107
self.__stream = sys.stdout

Lib/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def __init__(self, timer=None, bias=None):
150150
bias = self.bias
151151
self.bias = bias # Materialize in local dict for lookup speed.
152152

153-
if not timer:
153+
if timer is None:
154154
if os.name == 'mac':
155155
self.timer = MacOS.GetTicks
156156
self.dispatcher = self.trace_dispatch_mac

Lib/pstats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ class ProfileBrowser(cmd.Cmd):
506506
def __init__(self, profile=None):
507507
cmd.Cmd.__init__(self)
508508
self.prompt = "% "
509-
if profile:
509+
if profile is not None:
510510
self.stats = Stats(profile)
511511
else:
512512
self.stats = None

Lib/py_compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def compile(file, cfile=None, dfile=None):
6767
sys.stderr.write(line.replace('File "<string>"',
6868
'File "%s"' % (dfile or file)))
6969
return
70-
if not cfile:
70+
if cfile is None:
7171
cfile = file + (__debug__ and 'c' or 'o')
7272
fc = open(cfile, 'wb')
7373
fc.write('\0\0\0\0')

0 commit comments

Comments
 (0)