mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
util: use the built-in any() and all() methods if they are available
This commit is contained in:
parent
a6d934b6af
commit
0c8f350f3b
@ -1343,14 +1343,17 @@ def rundetached(args, condfn):
|
||||
if prevhandler is not None:
|
||||
signal.signal(signal.SIGCHLD, prevhandler)
|
||||
|
||||
def any(iterable):
|
||||
for i in iterable:
|
||||
if i:
|
||||
return True
|
||||
return False
|
||||
try:
|
||||
any, all = any, all
|
||||
except NameError:
|
||||
def any(iterable):
|
||||
for i in iterable:
|
||||
if i:
|
||||
return True
|
||||
return False
|
||||
|
||||
def all(iterable):
|
||||
for i in iterable:
|
||||
if not i:
|
||||
return False
|
||||
return True
|
||||
def all(iterable):
|
||||
for i in iterable:
|
||||
if not i:
|
||||
return False
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user