Replace boolean test with is None
This commit is contained in:
parent
0f4940c0a8
commit
094662a165
|
@ -38,7 +38,7 @@ class NullFormatter:
|
|||
"""
|
||||
|
||||
def __init__(self, writer=None):
|
||||
if not writer:
|
||||
if writer is None:
|
||||
writer = NullWriter()
|
||||
self.writer = writer
|
||||
def end_paragraph(self, blankline): pass
|
||||
|
@ -433,7 +433,7 @@ class DumbWriter(NullWriter):
|
|||
def test(file = None):
|
||||
w = DumbWriter()
|
||||
f = AbstractFormatter(w)
|
||||
if file:
|
||||
if file is not None:
|
||||
fp = open(file)
|
||||
elif sys.argv[1:]:
|
||||
fp = open(sys.argv[1])
|
||||
|
|
|
@ -659,7 +659,7 @@ class Netrc:
|
|||
__defacct = None
|
||||
|
||||
def __init__(self, filename=None):
|
||||
if not filename:
|
||||
if filename is None:
|
||||
if os.environ.has_key("HOME"):
|
||||
filename = os.path.join(os.environ["HOME"],
|
||||
".netrc")
|
||||
|
|
|
@ -104,7 +104,7 @@ class NullTranslations:
|
|||
self._info = {}
|
||||
self._charset = None
|
||||
self._fallback = None
|
||||
if fp:
|
||||
if fp is not None:
|
||||
self._parse(fp)
|
||||
|
||||
def _parse(self, fp):
|
||||
|
|
|
@ -46,7 +46,7 @@ class HMAC:
|
|||
key = key + chr(0) * (blocksize - len(key))
|
||||
self.outer.update(_strxor(key, opad))
|
||||
self.inner.update(_strxor(key, ipad))
|
||||
if (msg):
|
||||
if msg is not None:
|
||||
self.update(msg)
|
||||
|
||||
## def clear(self):
|
||||
|
|
Loading…
Reference in New Issue