Skip to content

Commit

Permalink
Ensure key_from_req returns consistent canonicalized names
Browse files Browse the repository at this point in the history
Fixes jazzband#1570

Remove assert:
- assert doesn't belong in non-test code
- if key's not a str, canonicalize should fail
  • Loading branch information
AndydeCleyre committed Feb 5, 2022
1 parent c58c4cb commit 82089c8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions piptools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def key_from_req(
else:
# from packaging, such as install requirements from requirements.txt
key = req.name
assert isinstance(key, str)
key = key.replace("_", "-").lower()
return key
return str(canonicalize_name(key))


def comment(text: str) -> str:
Expand Down

0 comments on commit 82089c8

Please sign in to comment.