From 88fe0a35dae88ad62bab3b10298c3dd9a45525ac Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Tue, 8 Nov 2011 22:31:11 -0500 Subject: [PATCH] some small cleanup --HG-- branch : pmacs2 --- etags.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etags.py b/etags.py index b66e9bd..e9e2d4b 100644 --- a/etags.py +++ b/etags.py @@ -15,7 +15,7 @@ class EtagsRunError(Exception): pass class TagManager(object): lang = None - prune = ('SCCS', 'RCS', 'CVS', '.svn', '.hg', '.git', '.bzr') + prune = set(['SCCS', 'RCS', 'CVS', '.svn', '.hg', '.git', '.bzr']) exts = set() def __init__(self, base='.'): @@ -133,13 +133,13 @@ class Etags(object): raise size = int(size) subblock = data[n+1:n+size+1] + # ... for lineitem in subblock.split('\n'): - if len(lineitem) == 0: - continue + if len(lineitem) == 0: continue record = self._parse_record(lineitem, filename) self._add_record(record) - return n+size+1 + return n + size + 1 def _parse_record(self, lineitem, filename): try: @@ -177,12 +177,13 @@ class EtagRecord(object): return "%s [%s:%d]" % (self.name, self.path, self.line) - if __name__ == '__main__': import sys from pprint import pprint + etags = Etags(sys.argv[1]) etags.parse() + if len(sys.argv) > 2: print etags[sys.argv[2]] else: