mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Convert a pile of obvious "yes/no" functions to return bool.
This commit is contained in:
parent
2f486b7fa6
commit
bc0e910826
34 changed files with 117 additions and 122 deletions
|
@ -35,7 +35,7 @@ def cmp(f1, f2, shallow=1, use_statcache=0):
|
|||
|
||||
Return value:
|
||||
|
||||
integer -- 1 if the files are the same, 0 otherwise.
|
||||
True if the files are the same, False otherwise.
|
||||
|
||||
This function uses a cache for past comparisons and the results,
|
||||
with a cache invalidation mechanism relying on stale signatures.
|
||||
|
@ -50,11 +50,11 @@ def cmp(f1, f2, shallow=1, use_statcache=0):
|
|||
s1 = _sig(stat_function(f1))
|
||||
s2 = _sig(stat_function(f2))
|
||||
if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG:
|
||||
return 0
|
||||
return False
|
||||
if shallow and s1 == s2:
|
||||
return 1
|
||||
return True
|
||||
if s1[1] != s2[1]:
|
||||
return 0
|
||||
return False
|
||||
|
||||
result = _cache.get((f1, f2))
|
||||
if result and (s1, s2) == result[:2]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue