mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +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
63596aeb33
commit
132dce2246
55 changed files with 520 additions and 519 deletions
|
@ -16,13 +16,13 @@ def cmp(f1, f2, shallow=1):
|
|||
Return 1 for identical files, 0 for different.
|
||||
Raise exceptions if either file could not be statted, read, etc."""
|
||||
s1, s2 = sig(os.stat(f1)), sig(os.stat(f2))
|
||||
if s1[0] <> 8 or s2[0] <> 8:
|
||||
if s1[0] != 8 or s2[0] != 8:
|
||||
# Either is a not a plain file -- always report as different
|
||||
return 0
|
||||
if shallow and s1 == s2:
|
||||
# type, size & mtime match -- report same
|
||||
return 1
|
||||
if s1[:2] <> s2[:2]: # Types or sizes differ, don't bother
|
||||
if s1[:2] != s2[:2]: # Types or sizes differ, don't bother
|
||||
# types or sizes differ -- report different
|
||||
return 0
|
||||
# same type and size -- look in the cache
|
||||
|
@ -59,5 +59,5 @@ def do_cmp(f1, f2):
|
|||
while 1:
|
||||
b1 = fp1.read(bufsize)
|
||||
b2 = fp2.read(bufsize)
|
||||
if b1 <> b2: return 0
|
||||
if b1 != b2: return 0
|
||||
if not b1: return 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue