From b52df96805b265c1de15c8a40561c595b0772df6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 4 Jun 2014 07:36:58 -0400 Subject: [PATCH] Cleanup for new pylint. --- Makefile | 11 +++++++---- rcs-fast-import | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e88086b..6335e01 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ rcs-fast-import.html: rcs-fast-import.xml xmlto html-nochunks rcs-fast-import.xml clean: - rm -f *~ *.1 *.html *.tar.gz MANIFEST SHIPPER.* + rm -f *~ *.1 *.html *.tar.gz MANIFEST rm -fr .rs* typescript test/typescript rcs-fast-import-$(VERS).tar.gz: $(SOURCES) rcs-fast-import.1 @@ -23,9 +23,12 @@ rcs-fast-import-$(VERS).tar.gz: $(SOURCES) rcs-fast-import.1 (cd ..; tar -czvf rcs-fast-import/rcs-fast-import-$(VERS).tar.gz `cat rcs-fast-import/MANIFEST`) @(cd ..; rm rcs-fast-import-$(VERS)) -PYLINTOPTS = --rcfile=/dev/null --reports=n --include-ids=y --disable="C0103,C0111,C0301,C0323,R0902,R0903,R0912,R0913,R0914,R0915,W0141,W0333,W0142,W0621,E1101" +PYLINTOPTS = --rcfile=/dev/null --reports=n \ + --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ + --dummy-variables-rgx='^_' +SUPPRESSIONS = "C0103,C0111,C0301,C0323,C1001,R0902,R0903,R0912,R0913,R0914,R0915,W0110,W0141,W0333,W0142,W0621,E1101" pylint: - @pylint --output-format=parseable $(PYLINTOPTS) rcs-fast-import + @pylint $(PYLINTOPTS) --disable=$(SUPPRESSIONS) rcs-fast-import version: @echo $(VERS) @@ -33,4 +36,4 @@ version: dist: rcs-fast-import-$(VERS).tar.gz release: rcs-fast-import-$(VERS).tar.gz rcs-fast-import.html - shipper -u -m -t; make clean + shipper -u -t version=$(VERS); make clean diff --git a/rcs-fast-import b/rcs-fast-import index 460d938..b1fa59f 100755 --- a/rcs-fast-import +++ b/rcs-fast-import @@ -7,7 +7,7 @@ # Requires Python 2.5 or newer and RCS 5.7 or newer. # """ -Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-V] [-?] +Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-V] [-?] Break the content of a git-fast-import stream on stdin into individual RCS master files in RCS subdirectories of the corresponding directory structure. @@ -105,7 +105,7 @@ class Date: def __init__(self, text): "Recognize date formats that exporters or email programs might emit." # First, look for git's preferred format. - text = text.strip() + text = text.strip() if re.match(r"[0-9]+\s*[+-][0-9]+$", text): (self.timestamp, self.timezone) = text.split() self.timestamp = int(self.timestamp) @@ -216,10 +216,10 @@ class Commit: self.childbranches = [] # Count of child branches at this point. def children(self): "Get a list of this commit's children." - return filter(lambda e:self.mark in e.parent_marks, self.repo.commits()) + return filter(lambda e:self.mark in e.parent_marks, self.repo.commits()) def parents(self): "Get a list of this commit's parents." - return filter(lambda e:e.mark in self.parent_marks, self.repo.commits()) + return filter(lambda e:e.mark in self.parent_marks, self.repo.commits()) def is_tip(self): "Is this commit a branch tip?" # Added for rcs-fast-import @@ -279,7 +279,7 @@ class Repository: self.import_line = 0 self.basedir = os.getcwd() # __enter and __exit__ added for rcs-fast-import - def __enter__(self): + def __enter__(self): return self def __exit__(self, type_unused, value_unused, traceback_unused): self.cleanup() @@ -291,7 +291,7 @@ class Repository: if not name: return os.path.join(self.basedir, ".rs" + `os.getpid()`) else: - return os.path.join(self.basedir, ".rs" + `os.getpid()`+ "-" + name) + return os.path.join(self.basedir, ".rs" + `os.getpid()`+ "-" + name) def error(self, msg, atline=True): if atline: raise FatalException(msg + " at line " + `self.import_line`) @@ -631,7 +631,7 @@ class Generic: raise FatalException("can't create RCS directory.") self.branch_tips = {} def get_tip(self, path, branch): - "Get the tip ID for a patch/branch combination that already exists." + "Get the tip ID for a patch/branch combination that already exists." return self.branch_tips[(path, branch)] def make_tip(self, commit, path): "Make a new tip ID for a given path and branch." @@ -790,21 +790,21 @@ if __name__ == '__main__': checkout_mode = None roundtrip = True for (switch, val) in options: - if (switch == '-?'): + if switch == '-?': print __doc__ - raise SystemExit, 0 + raise SystemExit(0) elif switch == '-p': roundtrip = False elif switch in ('-l', '-u'): checkout_mode = switch - elif (switch == '-v'): + elif switch == '-v': verbose += 1 - elif (switch == '-V'): + elif switch == '-V': print "rcs-fast-import version %s" % version - raise SystemExit, 0 + raise SystemExit(0) vcs = RCS() - vcs.roundtrip = roundtrip + vcs.roundtrip = roundtrip try: with Repository() as repo: here = os.getcwd() @@ -854,12 +854,12 @@ if __name__ == '__main__': finally: nuke(tempdir, "cleaning up") vcs.postactions(checkout_mode) - raise SystemExit, 0 + raise SystemExit(0) except FatalException, e: complain(e.msg) - raise SystemExit, 1 + raise SystemExit(1) except OSError, e: complain(e) - raise SystemExit, 1 + raise SystemExit(1) # end -- 2.43.0