Skip to content

Instantly share code, notes, and snippets.

@ThiefMaster
Created June 25, 2013 12:58
Show Gist options
  • Save ThiefMaster/5858236 to your computer and use it in GitHub Desktop.
Save ThiefMaster/5858236 to your computer and use it in GitHub Desktop.
--- /home/adrian/dev/indico/env/lib/python2.7/site-packages/pep8.py 2013-06-09 15:46:35.000000000 +0200
+++ ./lib/python2.7/site-packages/pep8.py 2013-06-25 14:57:01.522980981 +0200
@@ -1100,21 +1100,24 @@
# For each file of the diff, the entry key is the filename,
# and the value is a set of row numbers to consider.
rv = {}
- path = nrows = None
+ path = nrows = row = None
for line in diff.splitlines():
if nrows:
+ if line[:1] == '+':
+ rv[path].add(row)
if line[:1] != '-':
nrows -= 1
+ row += 1
continue
if line[:3] == '@@ ':
hunk_match = HUNK_REGEX.match(line)
row, nrows = [int(g or '1') for g in hunk_match.groups()]
- rv[path].update(range(row, row + nrows))
elif line[:3] == '+++':
path = line[4:].split('\t', 1)[0]
if path[:2] == 'b/':
path = path[2:]
rv[path] = set()
+
return dict([(os.path.join(parent, path), rows)
for (path, rows) in rv.items()
if rows and filename_match(path, patterns)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment