comparison mercurial/util.py @ 25587:ac2e66f481c9

util: drop any() and all() polyfills
author Augie Fackler <augie@google.com>
date Sat, 16 May 2015 14:37:24 -0400
parents 0ca8410ea345
children 277a535c0b3a
comparison
equal deleted inserted replaced
25586:6eb4bdad198f 25587:ac2e66f481c9
1718 return pid 1718 return pid
1719 finally: 1719 finally:
1720 if prevhandler is not None: 1720 if prevhandler is not None:
1721 signal.signal(signal.SIGCHLD, prevhandler) 1721 signal.signal(signal.SIGCHLD, prevhandler)
1722 1722
1723 try:
1724 any, all = any, all
1725 except NameError:
1726 def any(iterable):
1727 for i in iterable:
1728 if i:
1729 return True
1730 return False
1731
1732 def all(iterable):
1733 for i in iterable:
1734 if not i:
1735 return False
1736 return True
1737
1738 def interpolate(prefix, mapping, s, fn=None, escape_prefix=False): 1723 def interpolate(prefix, mapping, s, fn=None, escape_prefix=False):
1739 """Return the result of interpolating items in the mapping into string s. 1724 """Return the result of interpolating items in the mapping into string s.
1740 1725
1741 prefix is a single character string, or a two character string with 1726 prefix is a single character string, or a two character string with
1742 a backslash as the first character if the prefix needs to be escaped in 1727 a backslash as the first character if the prefix needs to be escaped in