Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use a compiled regex for performance

  • Loading branch information...
commit 4efdd3b359d71d7962fc7c65f74f3d1727610b92 1 parent e080a5f
Michael Fogleman fogleman authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  git_gutter_handler.py
3  git_gutter_handler.py
View
@@ -65,9 +65,10 @@ def process_diff(self, diff_str):
inserted = []
modified = []
deleted = []
+ pattern = re.compile(r'(\d+),?(\d*)(.)(\d+),?(\d*)')
lines = diff_str.splitlines()
for line in lines:
- m = re.match('(\d+),?(\d*)(.)(\d+),?(\d*)', line)
+ m = pattern.match(line)
if not m:
continue
kind = m.group(3)
Please sign in to comment.
Something went wrong with that request. Please try again.