mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
This commit is contained in:
parent
c140131995
commit
8152d32375
36 changed files with 101 additions and 99 deletions
12
Lib/uu.py
12
Lib/uu.py
|
@ -46,9 +46,9 @@ def encode(in_file, out_file, name=None, mode=None):
|
|||
if in_file == '-':
|
||||
in_file = sys.stdin
|
||||
elif type(in_file) == type(''):
|
||||
if name == None:
|
||||
if name is None:
|
||||
name = os.path.basename(in_file)
|
||||
if mode == None:
|
||||
if mode is None:
|
||||
try:
|
||||
mode = os.stat(in_file)[0]
|
||||
except AttributeError:
|
||||
|
@ -64,9 +64,9 @@ def encode(in_file, out_file, name=None, mode=None):
|
|||
#
|
||||
# Set defaults for name and mode
|
||||
#
|
||||
if name == None:
|
||||
if name is None:
|
||||
name = '-'
|
||||
if mode == None:
|
||||
if mode is None:
|
||||
mode = 0666
|
||||
#
|
||||
# Write the data
|
||||
|
@ -104,9 +104,9 @@ def decode(in_file, out_file=None, mode=None):
|
|||
break
|
||||
except ValueError:
|
||||
pass
|
||||
if out_file == None:
|
||||
if out_file is None:
|
||||
out_file = hdrfields[2]
|
||||
if mode == None:
|
||||
if mode is None:
|
||||
mode = string.atoi(hdrfields[1], 8)
|
||||
#
|
||||
# Open the output file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue