cleanup: "not x in y" -> "x not in y"
authorBrodie Rao <brodie@sf.io>
Sat, 12 May 2012 16:00:57 +0200
changeset 16686 67964cda8701
parent 16685 43d55088415a
child 16687 e34106fa0dc3
cleanup: "not x in y" -> "x not in y"
doc/hgmanpage.py
hgext/convert/convcmd.py
hgext/convert/hg.py
hgext/extdiff.py
hgext/keyword.py
hgext/largefiles/wirestore.py
hgext/relink.py
mercurial/bundlerepo.py
mercurial/dirstate.py
mercurial/dispatch.py
mercurial/keepalive.py
mercurial/patch.py
mercurial/pure/osutil.py
mercurial/revlog.py
mercurial/templatefilters.py
mercurial/templater.py
tests/test-walkrepo.py
--- a/doc/hgmanpage.py	Sat May 12 16:00:53 2012 +0200
+++ b/doc/hgmanpage.py	Sat May 12 16:00:57 2012 +0200
@@ -582,7 +582,7 @@
                                     self._docinfo[name],
                                     self.defs['indent'][1],
                                     self.defs['indent'][1]))
-            elif not name in skip:
+            elif name not in skip:
                 if name in self._docinfo_names:
                     label = self._docinfo_names[name]
                 else:
--- a/hgext/convert/convcmd.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/convert/convcmd.py	Sat May 12 16:00:57 2012 +0200
@@ -190,7 +190,7 @@
                 children.setdefault(n, [])
                 hasparent = False
                 for p in parents[n]:
-                    if not p in self.map:
+                    if p not in self.map:
                         visit.append(p)
                         hasparent = True
                     children.setdefault(p, []).append(n)
--- a/hgext/convert/hg.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/convert/hg.py	Sat May 12 16:00:57 2012 +0200
@@ -224,7 +224,7 @@
             bookmarks.write(self.repo)
 
     def hascommit(self, rev):
-        if not rev in self.repo and self.clonebranches:
+        if rev not in self.repo and self.clonebranches:
             raise util.Abort(_('revision %s not found in destination '
                                'repository (lookups with clonebranches=true '
                                'are not implemented)') % rev)
--- a/hgext/extdiff.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/extdiff.py	Sat May 12 16:00:57 2012 +0200
@@ -88,7 +88,7 @@
     ctx = repo[node]
     for fn in files:
         wfn = util.pconvert(fn)
-        if not wfn in ctx:
+        if wfn not in ctx:
             # File doesn't exist; could be a bogus modify
             continue
         ui.note('  %s\n' % wfn)
--- a/hgext/keyword.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/keyword.py	Sat May 12 16:00:57 2012 +0200
@@ -238,7 +238,7 @@
     def iskwfile(self, cand, ctx):
         '''Returns subset of candidates which are configured for keyword
         expansion but are not symbolic links.'''
-        return [f for f in cand if self.match(f) and not 'l' in ctx.flags(f)]
+        return [f for f in cand if self.match(f) and 'l' not in ctx.flags(f)]
 
     def overwrite(self, ctx, candidates, lookup, expand, rekw=False):
         '''Overwrites selected files expanding/shrinking keywords.'''
@@ -651,7 +651,7 @@
             return kwt.match(source)
 
         candidates = [f for f in repo.dirstate.copies() if
-                      not 'l' in wctx.flags(f) and haskwsource(f)]
+                      'l' not in wctx.flags(f) and haskwsource(f)]
         kwt.overwrite(wctx, candidates, False, False)
 
     def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts):
@@ -680,7 +680,7 @@
         # not make sense
         if (fctx._filerev is None and
             (self._repo._encodefilterpats or
-             kwt.match(fctx.path()) and not 'l' in fctx.flags() or
+             kwt.match(fctx.path()) and 'l' not in fctx.flags() or
              self.size() - 4 == fctx.size()) or
             self.size() == fctx.size()):
             return self._filelog.cmp(self._filenode, fctx.data())
--- a/hgext/largefiles/wirestore.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/largefiles/wirestore.py	Sat May 12 16:00:57 2012 +0200
@@ -14,7 +14,7 @@
         if not cap:
             raise lfutil.storeprotonotcapable([])
         storetypes = cap.split(',')
-        if not 'serve' in storetypes:
+        if 'serve' not in storetypes:
             raise lfutil.storeprotonotcapable(storetypes)
         self.remote = remote
         super(wirestore, self).__init__(ui, repo, remote.url())
--- a/hgext/relink.py	Sat May 12 16:00:53 2012 +0200
+++ b/hgext/relink.py	Sat May 12 16:00:57 2012 +0200
@@ -79,7 +79,7 @@
         dirnames.sort()
         relpath = dirpath[len(src) + seplen:]
         for filename in sorted(filenames):
-            if not filename[-2:] in ('.d', '.i'):
+            if filename[-2:] not in ('.d', '.i'):
                 continue
             st = os.stat(os.path.join(dirpath, filename))
             if not stat.S_ISREG(st.st_mode):
--- a/mercurial/bundlerepo.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/bundlerepo.py	Sat May 12 16:00:57 2012 +0200
@@ -54,7 +54,7 @@
                 continue
 
             for p in (p1, p2):
-                if not p in self.nodemap:
+                if p not in self.nodemap:
                     raise error.LookupError(p, self.indexfile,
                                             _("unknown parent"))
             # start, size, full unc. size, base (unused), link, p1, p2, node
--- a/mercurial/dirstate.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/dirstate.py	Sat May 12 16:00:57 2012 +0200
@@ -696,7 +696,7 @@
             visit = sorted([f for f in dmap if f not in results and matchfn(f)])
             for nf, st in zip(visit, util.statfiles([join(i) for i in visit])):
                 if (not st is None and
-                    not getkind(st.st_mode) in (regkind, lnkkind)):
+                    getkind(st.st_mode) not in (regkind, lnkkind)):
                     st = None
                 results[nf] = st
         for s in subrepos:
--- a/mercurial/dispatch.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/dispatch.py	Sat May 12 16:00:57 2012 +0200
@@ -706,7 +706,7 @@
     field = ui.config('profiling', 'sort', default='inlinetime')
     climit = ui.configint('profiling', 'nested', default=5)
 
-    if not format in ['text', 'kcachegrind']:
+    if format not in ['text', 'kcachegrind']:
         ui.warn(_("unrecognized profiling format '%s'"
                     " - Ignored\n") % format)
         format = 'text'
--- a/mercurial/keepalive.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/keepalive.py	Sat May 12 16:00:57 2012 +0200
@@ -136,7 +136,7 @@
     def add(self, host, connection, ready):
         self._lock.acquire()
         try:
-            if not host in self._hostmap:
+            if host not in self._hostmap:
                 self._hostmap[host] = []
             self._hostmap[host].append(connection)
             self._connmap[connection] = host
--- a/mercurial/patch.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/patch.py	Sat May 12 16:00:57 2012 +0200
@@ -1659,7 +1659,7 @@
                 if line.startswith('@'):
                     head = False
             else:
-                if line and not line[0] in ' +-@\\':
+                if line and line[0] not in ' +-@\\':
                     head = True
             stripline = line
             if not head and line and line[0] in '+-':
--- a/mercurial/pure/osutil.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/pure/osutil.py	Sat May 12 16:00:57 2012 +0200
@@ -119,7 +119,7 @@
                 flags = _O_TEXT
 
             m0 = mode[0]
-            if m0 == 'r' and not '+' in mode:
+            if m0 == 'r' and '+' not in mode:
                 flags |= _O_RDONLY
                 access = _GENERIC_READ
             else:
--- a/mercurial/revlog.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/revlog.py	Sat May 12 16:00:57 2012 +0200
@@ -1208,7 +1208,7 @@
                     continue
 
                 for p in (p1, p2):
-                    if not p in self.nodemap:
+                    if p not in self.nodemap:
                         raise LookupError(p, self.indexfile,
                                           _('unknown parent'))
 
--- a/mercurial/templatefilters.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/templatefilters.py	Sat May 12 16:00:57 2012 +0200
@@ -260,7 +260,7 @@
     >>> person('"Foo Bar <foo@bar>')
     'Foo Bar'
     """
-    if not '@' in author:
+    if '@' not in author:
         return author
     f = author.find('<')
     if f != -1:
--- a/mercurial/templater.py	Sat May 12 16:00:53 2012 +0200
+++ b/mercurial/templater.py	Sat May 12 16:00:57 2012 +0200
@@ -312,7 +312,7 @@
 
     def load(self, t):
         '''Get the template for the given template name. Use a local cache.'''
-        if not t in self.cache:
+        if t not in self.cache:
             try:
                 self.cache[t] = util.readfile(self.map[t][1])
             except KeyError, inst:
--- a/tests/test-walkrepo.py	Sat May 12 16:00:53 2012 +0200
+++ b/tests/test-walkrepo.py	Sat May 12 16:00:57 2012 +0200
@@ -43,7 +43,7 @@
         print "reposet = %r" % (reposet,)
         print "sub1set and reposet should have exactly one path in common."
     sub3 = pjoin('.', 'circle', 'top1')
-    if sym and not (sub3 in reposet):
+    if sym and sub3 not in reposet:
         print "reposet = %r" % (reposet,)
         print "Symbolic links are supported and %s is not in reposet" % (sub3,)