changeset 1062:6d5a62a549fa

pep-0008 cleanup - Don't use spaces around the '=' sign when used to indicate a keyword argument or a default parameter value.
author benoit.boissinot@ens-lyon.fr
date Fri, 26 Aug 2005 13:06:58 +0200
parents fed8d078840b
children 58eefdfb8472
files mercurial/commands.py mercurial/hg.py mercurial/hgweb.py mercurial/lock.py mercurial/revlog.py mercurial/transaction.py mercurial/ui.py mercurial/util.py
diffstat 8 files changed, 100 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/commands.py	Fri Aug 26 13:06:58 2005 +0200
@@ -29,20 +29,20 @@
         return [util.normpath(os.path.join(cwd, x)) for x in args]
     return args
 
-def matchpats(repo, cwd, pats = [], opts = {}, head = ''):
+def matchpats(repo, cwd, pats=[], opts={}, head=''):
     return util.matcher(repo, cwd, pats or ['.'], opts.get('include'),
                         opts.get('exclude'), head)
 
-def makewalk(repo, pats, opts, head = ''):
+def makewalk(repo, pats, opts, head=''):
     cwd = repo.getcwd()
     files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head)
     exact = dict(zip(files, files))
     def walk():
-        for src, fn in repo.walk(files = files, match = matchfn):
+        for src, fn in repo.walk(files=files, match=matchfn):
             yield src, fn, util.pathto(cwd, fn), fn in exact
     return files, matchfn, walk()
 
-def walk(repo, pats, opts, head = ''):
+def walk(repo, pats, opts, head=''):
     files, matchfn, results = makewalk(repo, pats, opts, head)
     for r in results: yield r
 
@@ -220,7 +220,7 @@
         return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
 
     if not changes:
-        (c, a, d, u) = repo.changes(node1, node2, files, match = match)
+        (c, a, d, u) = repo.changes(node1, node2, files, match=match)
     else:
         (c, a, d, u) = changes
     if files:
@@ -626,7 +626,7 @@
     fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '',
                                     pats, opts)
     if pats:
-        c, a, d, u = repo.changes(files = fns, match = match)
+        c, a, d, u = repo.changes(files=fns, match=match)
         files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
     else:
         files = []
@@ -793,7 +793,7 @@
             if not exact: ui.status('forgetting ', rel, '\n')
     repo.forget(forget)
 
-def grep(ui, repo, pattern = None, *pats, **opts):
+def grep(ui, repo, pattern=None, *pats, **opts):
     """search for a pattern in specified files and revisions"""
     if pattern is None: pattern = opts['regexp']
     if not pattern: raise util.Abort('no pattern to search for')
@@ -1089,7 +1089,7 @@
         if n != hg.nullid:
             show_changeset(ui, repo, changenode=n)
 
-def paths(ui, search = None):
+def paths(ui, search=None):
     """show definition of symbolic path names"""
     try:
         repo = hg.repository(ui=ui)
--- a/mercurial/hg.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/hg.py	Fri Aug 26 13:06:58 2005 +0200
@@ -360,7 +360,7 @@
         if not self.dirty:
             self.dirty = 1
 
-    def setparents(self, p1, p2 = nullid):
+    def setparents(self, p1, p2=nullid):
         self.markdirty()
         self.pl = p1, p2
 
@@ -480,7 +480,7 @@
                 bs += 1
         return ret
 
-    def walk(self, files = None, match = util.always, dc=None):
+    def walk(self, files=None, match=util.always, dc=None):
         self.read()
 
         # walk all files by default
@@ -816,7 +816,7 @@
         else:
             self.ui.warn("no undo information available\n")
 
-    def lock(self, wait = 1):
+    def lock(self, wait=1):
         try:
             return lock.lock(self.join("lock"), 0)
         except lock.LockHeld, inst:
@@ -911,7 +911,7 @@
                 else:
                     self.ui.warn("%s not tracked!\n" % f)
         else:
-            (c, a, d, u) = self.changes(match = match)
+            (c, a, d, u) = self.changes(match=match)
             commit = c + a
             remove = d
 
@@ -1018,7 +1018,7 @@
             return None
         return n
 
-    def walk(self, node = None, files = [], match = util.always):
+    def walk(self, node=None, files=[], match=util.always):
         if node:
             for fn in self.manifest.read(self.changelog.read(node)[0]):
                 if match(fn): yield 'm', fn
--- a/mercurial/hgweb.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/hgweb.py	Fri Aug 26 13:06:58 2005 +0200
@@ -65,7 +65,7 @@
             sys.stdout.write(str(thing))
 
 class templater:
-    def __init__(self, mapfile, filters = {}, defaults = {}):
+    def __init__(self, mapfile, filters={}, defaults={}):
         self.cache = {}
         self.map = {}
         self.base = os.path.dirname(mapfile)
@@ -92,7 +92,7 @@
             tmpl = self.cache[t] = file(self.map[t]).read()
         return self.template(tmpl, self.filters, **m)
 
-    def template(self, tmpl, filters = {}, **map):
+    def template(self, tmpl, filters={}, **map):
         while tmpl:
             m = re.search(r"#([a-zA-Z0-9]+)((%[a-zA-Z0-9]+)*)((\|[a-zA-Z0-9]+)*)#", tmpl)
             if m:
@@ -162,13 +162,13 @@
 
     def listfiles(self, files, mf):
         for f in files[:self.maxfiles]:
-            yield self.t("filenodelink", node = hex(mf[f]), file = f)
+            yield self.t("filenodelink", node=hex(mf[f]), file=f)
         if len(files) > self.maxfiles:
             yield self.t("fileellipses")
 
     def listfilediffs(self, files, changeset):
         for f in files[:self.maxfiles]:
-            yield self.t("filedifflink", node = hex(changeset), file = f)
+            yield self.t("filedifflink", node=hex(changeset), file=f)
         if len(files) > self.maxfiles:
             yield self.t("fileellipses")
 
@@ -176,11 +176,11 @@
         if not rev: rev = lambda x: ""
         for node in nodes:
             if node != nullid:
-                yield self.t(t1, node = hex(node), rev = rev(node), **args)
+                yield self.t(t1, node=hex(node), rev=rev(node), **args)
 
     def showtag(self, t1, node=nullid, **args):
         for t in self.repo.nodetags(node):
-             yield self.t(t1, tag = t, **args)
+             yield self.t(t1, tag=t, **args)
 
     def diff(self, node1, node2, files):
         def filterfiles(list, files):
@@ -203,13 +203,13 @@
         def prettyprintlines(diff):
             for l in diff.splitlines(1):
                 if l.startswith('+'):
-                    yield self.t("difflineplus", line = l)
+                    yield self.t("difflineplus", line=l)
                 elif l.startswith('-'):
-                    yield self.t("difflineminus", line = l)
+                    yield self.t("difflineminus", line=l)
                 elif l.startswith('@'):
-                    yield self.t("difflineat", line = l)
+                    yield self.t("difflineat", line=l)
                 else:
-                    yield self.t("diffline", line = l)
+                    yield self.t("diffline", line=l)
 
         r = self.repo
         cl = r.changelog
@@ -240,7 +240,7 @@
 
     def changelog(self, pos):
         def changenav(**map):
-            def seq(factor = 1):
+            def seq(factor=1):
                 yield 1 * factor
                 yield 3 * factor
                 #yield 5 * factor
@@ -296,9 +296,9 @@
         pos = end - 1
 
         yield self.t('changelog',
-                     changenav = changenav,
-                     manifest = hex(mf),
-                     rev = pos, changesets = count, entries = changelist)
+                     changenav=changenav,
+                     manifest=hex(mf),
+                     rev=pos, changesets=count, entries=changelist)
 
     def search(self, query):
 
@@ -334,17 +334,17 @@
 
                 yield self.t(
                     'searchentry',
-                    parity = count & 1,
-                    author = changes[1],
-                    parent = self.parents("changelogparent",
+                    parity=count & 1,
+                    author=changes[1],
+                    parent=self.parents("changelogparent",
                                           cl.parents(n), cl.rev),
-                    changelogtag = self.showtag("changelogtag",n),
-                    manifest = hex(changes[0]),
-                    desc = changes[4],
-                    date = t,
-                    files = self.listfilediffs(changes[3], n),
-                    rev = i,
-                    node = hn)
+                    changelogtag=self.showtag("changelogtag",n),
+                    manifest=hex(changes[0]),
+                    desc=changes[4],
+                    date=t,
+                    files=self.listfilediffs(changes[3], n),
+                    rev=i,
+                    node=hn)
 
                 if count >= self.maxchanges: break
 
@@ -352,9 +352,9 @@
         mf = cl.read(cl.tip())[0]
 
         yield self.t('search',
-                     query = query,
-                     manifest = hex(mf),
-                     entries = changelist)
+                     query=query,
+                     manifest=hex(mf),
+                     entries=changelist)
 
     def changeset(self, nodeid):
         n = bin(nodeid)
@@ -367,23 +367,23 @@
         mf = self.repo.manifest.read(changes[0])
         for f in changes[3]:
             files.append(self.t("filenodelink",
-                                filenode = hex(mf.get(f, nullid)), file = f))
+                                filenode = hex(mf.get(f, nullid)), file=f))
 
         def diff(**map):
             yield self.diff(p1, n, None)
 
         yield self.t('changeset',
-                     diff = diff,
-                     rev = cl.rev(n),
-                     node = nodeid,
-                     parent = self.parents("changesetparent",
+                     diff=diff,
+                     rev=cl.rev(n),
+                     node=nodeid,
+                     parent=self.parents("changesetparent",
                                            cl.parents(n), cl.rev),
-                     changesettag = self.showtag("changesettag",n),
-                     manifest = hex(changes[0]),
-                     author = changes[1],
-                     desc = changes[4],
-                     date = t,
-                     files = files)
+                     changesettag=self.showtag("changesettag",n),
+                     manifest=hex(changes[0]),
+                     author=changes[1],
+                     desc=changes[4],
+                     date=t,
+                     files=files)
 
     def filelog(self, f, filenode):
         cl = self.repo.changelog
@@ -417,9 +417,9 @@
             for e in l: yield e
 
         yield self.t("filelog",
-                     file = f,
-                     filenode = filenode,
-                     entries = entries)
+                     file=f,
+                     filenode=filenode,
+                     entries=entries)
 
     def filerevision(self, f, node):
         fl = self.repo.file(f)
@@ -438,18 +438,18 @@
                        "linenumber": "% 6d" % (l + 1),
                        "parity": l & 1}
 
-        yield self.t("filerevision", file = f,
-                     filenode = node,
-                     path = up(f),
-                     text = lines(),
-                     rev = changerev,
-                     node = hex(cn),
-                     manifest = hex(mfn),
-                     author = cs[1],
-                     date = t,
-                     parent = self.parents("filerevparent",
+        yield self.t("filerevision", file=f,
+                     filenode=node,
+                     path=up(f),
+                     text=lines(),
+                     rev=changerev,
+                     node=hex(cn),
+                     manifest=hex(mfn),
+                     author=cs[1],
+                     date=t,
+                     parent=self.parents("filerevparent",
                                            fl.parents(n), fl.rev, file=f),
-                     permissions = self.repo.manifest.readflags(mfn)[f])
+                     permissions=self.repo.manifest.readflags(mfn)[f])
 
     def fileannotate(self, f, node):
         bcache = {}
@@ -566,13 +566,13 @@
                 parity = 1 - parity
 
         yield self.t("manifest",
-                     manifest = mnode,
-                     rev = rev,
-                     node = hex(node),
-                     path = path,
-                     up = up(path),
-                     fentries = filelist,
-                     dentries = dirlist)
+                     manifest=mnode,
+                     rev=rev,
+                     node=hex(node),
+                     path=path,
+                     up=up(path),
+                     fentries=filelist,
+                     dentries=dirlist)
 
     def tags(self):
         cl = self.repo.changelog
@@ -590,8 +590,8 @@
                 parity = 1 - parity
 
         yield self.t("tags",
-                     manifest = hex(mf),
-                     entries = entries)
+                     manifest=hex(mf),
+                     entries=entries)
 
     def filediff(self, file, changeset):
         n = bin(changeset)
@@ -604,13 +604,13 @@
             yield self.diff(p1, n, file)
 
         yield self.t("filediff",
-                     file = file,
-                     filenode = hex(mf.get(file, nullid)),
-                     node = changeset,
-                     rev = self.repo.changelog.rev(n),
-                     parent = self.parents("filediffparent",
+                     file=file,
+                     filenode=hex(mf.get(file, nullid)),
+                     node=changeset,
+                     rev=self.repo.changelog.rev(n),
+                     parent=self.parents("filediffparent",
                               cl.parents(n), cl.rev),
-                     diff = diff)
+                     diff=diff)
 
     # add tags to things
     # tags -> list of changesets corresponding to tags
@@ -643,10 +643,10 @@
         url = "http://%s%s%s" % (os.environ["SERVER_NAME"], port, uri)
 
         self.t = templater(m, common_filters,
-                           {"url":url,
-                            "repo":self.reponame,
-                            "header":header,
-                            "footer":footer,
+                           {"url": url,
+                            "repo": self.reponame,
+                            "header": header,
+                            "footer": footer,
                             })
 
         if not args.has_key('cmd'):
@@ -827,8 +827,8 @@
     else:
         return BaseHTTPServer.HTTPServer((address, port), hgwebhandler)
 
-def server(path, name, templates, address, port, use_ipv6 = False,
-           accesslog = sys.stdout, errorlog = sys.stderr):
+def server(path, name, templates, address, port, use_ipv6=False,
+           accesslog=sys.stdout, errorlog=sys.stderr):
     httpd = create_server(path, name, templates, address, port, use_ipv6,
                           accesslog, errorlog)
     httpd.serve_forever()
@@ -879,14 +879,14 @@
                 url = os.environ["REQUEST_URI"] + "/" + v
                 url = url.replace("//", "/")
 
-                yield dict(author = get("web", "author", "unknown"),
-                           name = get("web", "name", v),
-                           url = url,
-                           parity = parity,
-                           shortdesc = get("web", "description", "unknown"),
-                           lastupdate = os.stat(os.path.join(r, ".hg",
+                yield dict(author=get("web", "author", "unknown"),
+                           name=get("web", "name", v),
+                           url=url,
+                           parity=parity,
+                           shortdesc=get("web", "description", "unknown"),
+                           lastupdate=os.stat(os.path.join(r, ".hg",
                                                 "00changelog.d")).st_mtime)
 
                 parity = 1 - parity
 
-        write(tmpl("index", entries = entries))
+        write(tmpl("index", entries=entries))
--- a/mercurial/lock.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/lock.py	Fri Aug 26 13:06:58 2005 +0200
@@ -12,7 +12,7 @@
     pass
 
 class lock:
-    def __init__(self, file, wait = 1):
+    def __init__(self, file, wait=1):
         self.f = file
         self.held = 0
         self.wait = wait
--- a/mercurial/revlog.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/revlog.py	Fri Aug 26 13:06:58 2005 +0200
@@ -473,7 +473,7 @@
 
         yield struct.pack(">l", 0)
 
-    def addgroup(self, revs, linkmapper, transaction, unique = 0):
+    def addgroup(self, revs, linkmapper, transaction, unique=0):
         # given a set of deltas, add them to the revision log. the
         # first delta is against its parent, which should be in our
         # log, the rest are against the previous delta.
--- a/mercurial/transaction.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/transaction.py	Fri Aug 26 13:06:58 2005 +0200
@@ -15,7 +15,7 @@
 import util
 
 class transaction:
-    def __init__(self, report, opener, journal, after = None):
+    def __init__(self, report, opener, journal, after=None):
         self.journal = None
 
         # abort here if the journal already exists
--- a/mercurial/ui.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/ui.py	Fri Aug 26 13:06:58 2005 +0200
@@ -89,7 +89,7 @@
 
     def readline(self):
         return sys.stdin.readline()[:-1]
-    def prompt(self, msg, pat, default = "y"):
+    def prompt(self, msg, pat, default="y"):
         if not self.interactive: return default
         while 1:
             self.write(msg, " ")
@@ -118,7 +118,7 @@
                   os.environ.get("EDITOR", "vi"))
 
         os.environ["HGUSER"] = self.username()
-        util.system("%s %s" % (editor, name), errprefix = "edit failed")
+        util.system("%s %s" % (editor, name), errprefix="edit failed")
 
         t = open(name).read()
         t = re.sub("(?m)^HG:.*\n", "", t)
--- a/mercurial/util.py	Fri Aug 26 02:03:35 2005 -0700
+++ b/mercurial/util.py	Fri Aug 26 13:06:58 2005 +0200
@@ -27,7 +27,7 @@
 def always(fn): return True
 def never(fn): return False
 
-def globre(pat, head = '^', tail = '$'):
+def globre(pat, head='^', tail='$'):
     "convert a glob pattern into a regexp"
     i, n = 0, len(pat)
     res = ''
@@ -98,7 +98,7 @@
     else:
         raise Abort('%s not under repository root' % myname)
 
-def matcher(repo, cwd, names, inc, exc, head = ''):
+def matcher(repo, cwd, names, inc, exc, head=''):
     def patkind(name):
         for prefix in 're:', 'glob:', 'path:', 'relpath:':
             if name.startswith(prefix): return name.split(':', 1)