Skip to content

Commit

Permalink
Simplify regex that looks for the old name (#113)
Browse files Browse the repository at this point in the history
* Simplify regex that looks for the old name

* Make linter happy
  • Loading branch information
techtonik authored and peterbe committed Sep 3, 2019
1 parent c3efcba commit 10a7048
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions hashin.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ def is_different_lines(package, new_lines):

for package, old_name, new_lines in all_new_lines:
regex = re.compile(
r"(^|\n|\n\r){0}==|(^|\n|\n\r){0}\[.*\]==".format(re.escape(old_name)),
re.IGNORECASE,
r"^{0}(\[.*\])?==".format(re.escape(old_name)), re.IGNORECASE | re.MULTILINE
)
# if the package wasn't already there, add it to the bottom
if not regex.search(requirements):
Expand Down

0 comments on commit 10a7048

Please sign in to comment.