cleanup: use __builtins__.any instead of util.any
authorAugie Fackler <augie@google.com>
Sat, 16 May 2015 14:30:07 -0400
changeset 25149 3f0744eeaeaf
parent 25148 3b5cd6f13dcc
child 25150 d28cc89d92f0
cleanup: use __builtins__.any instead of util.any any() is available in all Python versions we support now.
hgext/convert/filemap.py
hgext/gpg.py
hgext/histedit.py
hgext/largefiles/lfutil.py
hgext/largefiles/reposetup.py
hgext/mq.py
mercurial/archival.py
mercurial/commands.py
mercurial/exchange.py
mercurial/hgweb/webcommands.py
mercurial/localrepo.py
mercurial/obsolete.py
mercurial/patch.py
mercurial/repoview.py
mercurial/revset.py
mercurial/ui.py
mercurial/wireproto.py
--- a/hgext/convert/filemap.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/convert/filemap.py	Sat May 16 14:30:07 2015 -0400
@@ -332,7 +332,7 @@
             mp1 = self.parentmap[p1]
             if mp1 == SKIPREV or mp1 in knownparents:
                 continue
-            isancestor = util.any(p2 for p2 in parents
+            isancestor = any(p2 for p2 in parents
                                   if p1 != p2 and mp1 != self.parentmap[p2]
                                   and mp1 in self.wantedancestors[p2])
             if not isancestor and not hasbranchparent and len(parents) > 1:
--- a/hgext/gpg.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/gpg.py	Sat May 16 14:30:07 2015 -0400
@@ -255,7 +255,7 @@
 
     if not opts["force"]:
         msigs = match.exact(repo.root, '', ['.hgsigs'])
-        if util.any(repo.status(match=msigs, unknown=True, ignored=True)):
+        if any(repo.status(match=msigs, unknown=True, ignored=True)):
             raise util.Abort(_("working copy of .hgsigs is changed "),
                              hint=_("please commit .hgsigs manually"))
 
--- a/hgext/histedit.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/histedit.py	Sat May 16 14:30:07 2015 -0400
@@ -707,15 +707,15 @@
     if force and not outg:
         raise util.Abort(_('--force only allowed with --outgoing'))
     if cont:
-        if util.any((outg, abort, revs, freeargs, rules, editplan)):
+        if any((outg, abort, revs, freeargs, rules, editplan)):
             raise util.Abort(_('no arguments allowed with --continue'))
         goal = 'continue'
     elif abort:
-        if util.any((outg, revs, freeargs, rules, editplan)):
+        if any((outg, revs, freeargs, rules, editplan)):
             raise util.Abort(_('no arguments allowed with --abort'))
         goal = 'abort'
     elif editplan:
-        if util.any((outg, revs, freeargs)):
+        if any((outg, revs, freeargs)):
             raise util.Abort(_('only --commands argument allowed with '
                                '--edit-plan'))
         goal = 'edit-plan'
--- a/hgext/largefiles/lfutil.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/largefiles/lfutil.py	Sat May 16 14:30:07 2015 -0400
@@ -364,10 +364,10 @@
 
 def islfilesrepo(repo):
     if ('largefiles' in repo.requirements and
-            util.any(shortnameslash in f[0] for f in repo.store.datafiles())):
+            any(shortnameslash in f[0] for f in repo.store.datafiles())):
         return True
 
-    return util.any(openlfdirstate(repo.ui, repo, False))
+    return any(openlfdirstate(repo.ui, repo, False))
 
 class storeprotonotcapable(Exception):
     def __init__(self, storetypes):
--- a/hgext/largefiles/reposetup.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/largefiles/reposetup.py	Sat May 16 14:30:07 2015 -0400
@@ -365,7 +365,7 @@
     repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook)
 
     def checkrequireslfiles(ui, repo, **kwargs):
-        if 'largefiles' not in repo.requirements and util.any(
+        if 'largefiles' not in repo.requirements and any(
                 lfutil.shortname+'/' in f[0] for f in repo.store.datafiles()):
             repo.requirements.add('largefiles')
             repo._writerequirements()
--- a/hgext/mq.py	Sat May 16 14:31:03 2015 -0400
+++ b/hgext/mq.py	Sat May 16 14:30:07 2015 -0400
@@ -298,7 +298,7 @@
         self.haspatch = diffstart > 1
         self.plainmode = (plainmode or
                           '# HG changeset patch' not in self.comments and
-                          util.any(c.startswith('Date: ') or
+                          any(c.startswith('Date: ') or
                                    c.startswith('From: ')
                                    for c in self.comments))
 
--- a/mercurial/archival.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/archival.py	Sat May 16 14:30:07 2015 -0400
@@ -54,7 +54,7 @@
 
 def guesskind(dest):
     for kind, extensions in exts.iteritems():
-        if util.any(dest.endswith(ext) for ext in extensions):
+        if any(dest.endswith(ext) for ext in extensions):
             return kind
     return None
 
--- a/mercurial/commands.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/commands.py	Sat May 16 14:30:07 2015 -0400
@@ -4047,8 +4047,8 @@
             parents = ctx.parents()
             changed = ""
             if default or id or num:
-                if (util.any(repo.status())
-                    or util.any(ctx.sub(s).dirty() for s in ctx.substate)):
+                if (any(repo.status())
+                    or any(ctx.sub(s).dirty() for s in ctx.substate)):
                     changed = '+'
             if default or id:
                 output = ["%s%s" %
@@ -5522,7 +5522,7 @@
             hint = _("uncommitted merge, use --all to discard all changes,"
                      " or 'hg update -C .' to abort the merge")
             raise util.Abort(msg, hint=hint)
-        dirty = util.any(repo.status())
+        dirty = any(repo.status())
         node = ctx.node()
         if node != parent:
             if dirty:
--- a/mercurial/exchange.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/exchange.py	Sat May 16 14:30:07 2015 -0400
@@ -1181,7 +1181,7 @@
     # bundle10 case
     usebundle2 = False
     if bundlecaps is not None:
-        usebundle2 = util.any((cap.startswith('HG2') for cap in bundlecaps))
+        usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps))
     if not usebundle2:
         if bundlecaps and not kwargs.get('cg', True):
             raise ValueError(_('request for bundle10 must include changegroup'))
--- a/mercurial/hgweb/webcommands.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/hgweb/webcommands.py	Sat May 16 14:30:07 2015 -0400
@@ -232,7 +232,7 @@
             # no revset syntax used
             return MODE_KEYWORD, query
 
-        if util.any((token, (value or '')[:3]) == ('string', 're:')
+        if any((token, (value or '')[:3]) == ('string', 're:')
                     for token, value, pos in revset.tokenize(revdef)):
             return MODE_KEYWORD, query
 
--- a/mercurial/localrepo.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/localrepo.py	Sat May 16 14:30:07 2015 -0400
@@ -627,7 +627,7 @@
 
         if not local:
             m = matchmod.exact(self.root, '', ['.hgtags'])
-            if util.any(self.status(match=m, unknown=True, ignored=True)):
+            if any(self.status(match=m, unknown=True, ignored=True)):
                 raise util.Abort(_('working copy of .hgtags is changed'),
                                  hint=_('please commit .hgtags manually'))
 
--- a/mercurial/obsolete.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/obsolete.py	Sat May 16 14:30:07 2015 -0400
@@ -1117,7 +1117,7 @@
     for rev, ctx in revs:
         # A rev is unstable if one of its parent is obsolete or unstable
         # this works since we traverse following growing rev order
-        if util.any((x.obsolete() or (x.rev() in unstable))
+        if any((x.obsolete() or (x.rev() in unstable))
                 for x in ctx.parents()):
             unstable.add(rev)
     return unstable
--- a/mercurial/patch.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/patch.py	Sat May 16 14:30:07 2015 -0400
@@ -830,7 +830,7 @@
         self.hunks = []
 
     def binary(self):
-        return util.any(h.startswith('index ') for h in self.header)
+        return any(h.startswith('index ') for h in self.header)
 
     def pretty(self, fp):
         for h in self.header:
@@ -853,7 +853,7 @@
         fp.write(''.join(self.header))
 
     def allhunks(self):
-        return util.any(self.allhunks_re.match(h) for h in self.header)
+        return any(self.allhunks_re.match(h) for h in self.header)
 
     def files(self):
         match = self.diffgit_re.match(self.header[0])
@@ -872,7 +872,7 @@
         return '<header %s>' % (' '.join(map(repr, self.files())))
 
     def isnewfile(self):
-        return util.any(self.newfile_re.match(h) for h in self.header)
+        return any(self.newfile_re.match(h) for h in self.header)
 
     def special(self):
         # Special files are shown only at the header level and not at the hunk
@@ -885,7 +885,7 @@
         nocontent = len(self.header) == 2
         emptynewfile = self.isnewfile() and nocontent
         return emptynewfile or \
-                util.any(self.special_re.match(h) for h in self.header)
+                any(self.special_re.match(h) for h in self.header)
 
 class recordhunk(object):
     """patch hunk
--- a/mercurial/repoview.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/repoview.py	Sat May 16 14:30:07 2015 -0400
@@ -196,7 +196,7 @@
     Secret and hidden changeset should not pretend to be here."""
     assert not repo.changelog.filteredrevs
     # fast check to avoid revset call on huge repo
-    if util.any(repo._phasecache.phaseroots[1:]):
+    if any(repo._phasecache.phaseroots[1:]):
         getphase = repo._phasecache.phase
         maymutable = filterrevs(repo, 'base')
         return frozenset(r for r in maymutable if getphase(repo, r))
--- a/mercurial/revset.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/revset.py	Sat May 16 14:30:07 2015 -0400
@@ -1121,7 +1121,7 @@
 
     def matches(r):
         c = repo[r]
-        return util.any(kw in encoding.lower(t) for t in c.files() + [c.user(),
+        return any(kw in encoding.lower(t) for t in c.files() + [c.user(),
             c.description()])
 
     return subset.filter(matches)
@@ -1779,7 +1779,7 @@
             return s.added or s.modified or s.removed
 
         if s.added:
-            return util.any(submatches(c.substate.keys()))
+            return any(submatches(c.substate.keys()))
 
         if s.modified:
             subs = set(c.p1().substate.keys())
@@ -1790,7 +1790,7 @@
                     return True
 
         if s.removed:
-            return util.any(submatches(c.p1().substate.keys()))
+            return any(submatches(c.p1().substate.keys()))
 
         return False
 
--- a/mercurial/ui.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/ui.py	Sat May 16 14:30:07 2015 -0400
@@ -842,7 +842,7 @@
         output will be redirected if fout is not stdout.
         '''
         out = self.fout
-        if util.any(s[1] for s in self._bufferstates):
+        if any(s[1] for s in self._bufferstates):
             out = self
         return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
                            errprefix=errprefix, out=out)
--- a/mercurial/wireproto.py	Sat May 16 14:31:03 2015 -0400
+++ b/mercurial/wireproto.py	Sat May 16 14:30:07 2015 -0400
@@ -367,7 +367,7 @@
                                % keytype)
             opts[key] = value
         f = self._callcompressable("getbundle", **opts)
-        if util.any((cap.startswith('HG2') for cap in bundlecaps)):
+        if any((cap.startswith('HG2') for cap in bundlecaps)):
             return bundle2.getunbundler(self.ui, f)
         else:
             return changegroupmod.cg1unpacker(f, 'UN')