Skip to content

Commit

Permalink
Rebuild the project using ruff style.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 23, 2023
1 parent 7f8d898 commit aa98d78
Show file tree
Hide file tree
Showing 49 changed files with 635 additions and 704 deletions.
24 changes: 11 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,17 @@
# Preserve authored syntax for defaults
autodoc_preserve_defaults = True

intersphinx_mapping.update(
{
'pip': ('https://pip.pypa.io/en/latest', None),
'build': ('https://pypa-build.readthedocs.io/en/latest', None),
'PyPUG': ('https://packaging.python.org/en/latest/', None),
'packaging': ('https://packaging.pypa.io/en/latest/', None),
'twine': ('https://twine.readthedocs.io/en/stable/', None),
'importlib-resources': (
'https://importlib-resources.readthedocs.io/en/latest',
None,
),
}
)
intersphinx_mapping.update({
'pip': ('https://pip.pypa.io/en/latest', None),
'build': ('https://pypa-build.readthedocs.io/en/latest', None),
'PyPUG': ('https://packaging.python.org/en/latest/', None),
'packaging': ('https://packaging.pypa.io/en/latest/', None),
'twine': ('https://twine.readthedocs.io/en/stable/', None),
'importlib-resources': (
'https://importlib-resources.readthedocs.io/en/latest',
None,
),
})

# Add support for linking usernames
github_url = 'https://github.com'
Expand Down
86 changes: 37 additions & 49 deletions pkg_resources/tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,10 @@ def test_marker_evaluation_with_extras(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
metadata=Metadata(
(
"METADATA",
"Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
)
),
metadata=Metadata((
"METADATA",
"Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
)),
)
ad.add(Foo)
assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
Expand All @@ -275,13 +273,11 @@ def test_marker_evaluation_with_extras_normlized(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
metadata=Metadata(
(
"METADATA",
"Provides-Extra: baz-lightyear\n"
"Requires-Dist: quux; extra=='baz-lightyear'",
)
),
metadata=Metadata((
"METADATA",
"Provides-Extra: baz-lightyear\n"
"Requires-Dist: quux; extra=='baz-lightyear'",
)),
)
ad.add(Foo)
assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
Expand All @@ -295,15 +291,13 @@ def test_marker_evaluation_with_multiple_extras(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
metadata=Metadata(
(
"METADATA",
"Provides-Extra: baz\n"
"Requires-Dist: quux; extra=='baz'\n"
"Provides-Extra: bar\n"
"Requires-Dist: fred; extra=='bar'\n",
)
),
metadata=Metadata((
"METADATA",
"Provides-Extra: baz\n"
"Requires-Dist: quux; extra=='baz'\n"
"Provides-Extra: bar\n"
"Requires-Dist: fred; extra=='bar'\n",
)),
)
ad.add(Foo)
quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
Expand All @@ -326,15 +320,13 @@ def test_marker_evaluation_with_extras_loop(self):
)
c = Distribution.from_filename(
"/foo_dir/c-1.0.dist-info",
metadata=Metadata(
(
"METADATA",
"Provides-Extra: a\n"
"Requires-Dist: b;extra=='a'\n"
"Provides-Extra: b\n"
"Requires-Dist: foo;extra=='b'",
)
),
metadata=Metadata((
"METADATA",
"Provides-Extra: a\n"
"Requires-Dist: b;extra=='a'\n"
"Provides-Extra: b\n"
"Requires-Dist: foo;extra=='b'",
)),
)
foo = Distribution.from_filename("/foo_dir/foo-0.1.dist-info")
for dist in (a, b, c, foo):
Expand Down Expand Up @@ -572,26 +564,22 @@ def testOptionsAndHashing(self):
assert set(r1.extras) == set(("foo", "bar"))
assert set(r2.extras) == set(("foo", "bar"))
assert hash(r1) == hash(r2)
assert hash(r1) == hash(
(
"twisted",
None,
packaging.specifiers.SpecifierSet(">=1.2"),
frozenset(["foo", "bar"]),
None,
)
)
assert hash(r1) == hash((
"twisted",
None,
packaging.specifiers.SpecifierSet(">=1.2"),
frozenset(["foo", "bar"]),
None,
))
assert hash(
Requirement.parse("Twisted @ https://localhost/twisted.zip")
) == hash(
(
"twisted",
"https://localhost/twisted.zip",
packaging.specifiers.SpecifierSet(),
frozenset(),
None,
)
)
) == hash((
"twisted",
"https://localhost/twisted.zip",
packaging.specifiers.SpecifierSet(),
frozenset(),
None,
))

def testVersionEquality(self):
r1 = Requirement.parse("foo==0.3a2")
Expand Down
76 changes: 38 additions & 38 deletions pkg_resources/tests/test_working_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def strip_comments(s):


def parse_distributions(s):
'''
"""
Parse a series of distribution specs of the form:
{project_name}-{version}
[optional, indented requirements specification]
Expand All @@ -36,7 +36,7 @@ def parse_distributions(s):
- project_name=foo, version=0.2
- project_name=bar, version=1.0,
requires=['foo>=3.0', 'baz; extra=="feature"']
'''
"""
s = s.strip()
for spec in re.split(r'\n(?=[^\s])', s):
if not spec:
Expand Down Expand Up @@ -113,7 +113,7 @@ def parametrize_test_working_set_resolve(*test_list):


@parametrize_test_working_set_resolve(
'''
"""
# id
noop
Expand All @@ -126,8 +126,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved
# resolved [replace conflicting]
''',
'''
""",
"""
# id
already_installed
Expand All @@ -144,8 +144,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.0
''',
'''
""",
"""
# id
installable_not_installed
Expand All @@ -163,8 +163,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.0
''',
'''
""",
"""
# id
not_installable
Expand All @@ -180,8 +180,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
''',
'''
""",
"""
# id
no_matching_version
Expand All @@ -198,8 +198,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
''',
'''
""",
"""
# id
installable_with_installed_conflict
Expand All @@ -217,8 +217,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.5
''',
'''
""",
"""
# id
not_installable_with_installed_conflict
Expand All @@ -235,8 +235,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
''',
'''
""",
"""
# id
installed_with_installed_require
Expand All @@ -257,8 +257,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
''',
'''
""",
"""
# id
installed_with_conflicting_installed_require
Expand All @@ -277,8 +277,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
''',
'''
""",
"""
# id
installed_with_installable_conflicting_require
Expand All @@ -299,8 +299,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
baz-0.1
foo-2.9
''',
'''
""",
"""
# id
installed_with_installable_require
Expand All @@ -321,8 +321,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
''',
'''
""",
"""
# id
installable_with_installed_require
Expand All @@ -343,8 +343,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
''',
'''
""",
"""
# id
installable_with_installable_require
Expand All @@ -365,8 +365,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
''',
'''
""",
"""
# id
installable_with_conflicting_installable_require
Expand All @@ -387,8 +387,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
baz-0.1
foo-2.9
''',
'''
""",
"""
# id
conflicting_installables
Expand All @@ -407,8 +407,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
''',
'''
""",
"""
# id
installables_with_conflicting_requires
Expand All @@ -431,8 +431,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
''',
'''
""",
"""
# id
installables_with_conflicting_nested_requires
Expand All @@ -459,8 +459,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
''',
'''
""",
"""
# id
wanted_normalized_name_installed_canonical
Expand All @@ -477,7 +477,7 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo.bar-3.6
''',
""",
)
def test_working_set_resolve(
installed_dists,
Expand Down
1 change: 1 addition & 0 deletions setuptools/_core_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
See: https://packaging.python.org/en/latest/specifications/core-metadata/
"""

import os
import stat
import textwrap
Expand Down
1 change: 1 addition & 0 deletions setuptools/_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
"""

import re
from pathlib import Path
from typing import Union
Expand Down
Loading

0 comments on commit aa98d78

Please sign in to comment.