mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
More naturally sort requirements.
This commit is contained in:
parent
a4ba3ca567
commit
151d485a81
2 changed files with 5 additions and 1 deletions
|
|
@ -18,7 +18,10 @@ class Requirement(object):
|
|||
elif requirement.value == b'\n':
|
||||
return False
|
||||
else:
|
||||
return self.value < requirement.value
|
||||
return (
|
||||
self.value.partition(b'==') <
|
||||
requirement.value.partition(b'==')
|
||||
)
|
||||
|
||||
|
||||
def fix_requirements(f):
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ TESTS = (
|
|||
(b'#comment\n\nbar\nfoo\n', 0, b'#comment\n\nbar\nfoo\n'),
|
||||
(b'\nfoo\nbar\n', 1, b'bar\n\nfoo\n'),
|
||||
(b'\nbar\nfoo\n', 0, b'\nbar\nfoo\n'),
|
||||
(b'pyramid==1\npyramid-foo==2\n', 0, b'pyramid==1\npyramid-foo==2\n'),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue