Skip to content

Commit

Permalink
A round of ruff format after ruff check --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed May 23, 2024
1 parent 96cab0a commit c8b5741
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ class _LoaderProtocol(Protocol):
def load_module(self, fullname: str, /) -> types.ModuleType: ...


_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE)
_PEP440_FALLBACK = re.compile(
r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE
)


class PEP440Warning(RuntimeWarning):
Expand Down
4 changes: 3 additions & 1 deletion setuptools/_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
_VALID_NAME = re.compile(r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE)
_UNSAFE_NAME_CHARS = re.compile(r"[^A-Z0-9._-]+", re.IGNORECASE)
_NON_ALPHANUMERIC = re.compile(r"[^A-Z0-9]+", re.IGNORECASE)
_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE)
_PEP440_FALLBACK = re.compile(
r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.IGNORECASE
)


def safe_identifier(name: str) -> str:
Expand Down
8 changes: 6 additions & 2 deletions setuptools/config/_validate_pyproject/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
(?:\+(?P<local>[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
"""

VERSION_REGEX = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
VERSION_REGEX = re.compile(
r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE
)


def pep440(version: str) -> bool:
Expand Down Expand Up @@ -260,7 +262,9 @@ def url(value: str) -> bool:
ENTRYPOINT_PATTERN = r"[^\[\s=]([^=]*[^\s=])?"
ENTRYPOINT_REGEX = re.compile(f"^{ENTRYPOINT_PATTERN}$", re.IGNORECASE)
RECOMMEDED_ENTRYPOINT_PATTERN = r"[\w.-]+"
RECOMMEDED_ENTRYPOINT_REGEX = re.compile(f"^{RECOMMEDED_ENTRYPOINT_PATTERN}$", re.IGNORECASE)
RECOMMEDED_ENTRYPOINT_REGEX = re.compile(
f"^{RECOMMEDED_ENTRYPOINT_PATTERN}$", re.IGNORECASE
)
ENTRYPOINT_GROUP_PATTERN = r"\w+(\.\w+)*"
ENTRYPOINT_GROUP_REGEX = re.compile(f"^{ENTRYPOINT_GROUP_PATTERN}$", re.IGNORECASE)

Expand Down
4 changes: 3 additions & 1 deletion setuptools/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def wrapper(*args, **kwargs):
return wrapper


REL = re.compile(r"""<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>""", re.IGNORECASE)
REL = re.compile(
r"""<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>""", re.IGNORECASE
)
"""
Regex for an HTML tag with 'rel="val"' attributes.
"""
Expand Down
4 changes: 3 additions & 1 deletion setuptools/tests/config/test_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ def test_invalid_example(tmp_path, example, error_msg):
pyproject = tmp_path / "pyproject.toml"
pyproject.write_text(cleandoc(example), encoding="utf-8")

pattern = re.compile(f"invalid pyproject.toml.*{error_msg}.*", re.MULTILINE | re.DOTALL)
pattern = re.compile(
f"invalid pyproject.toml.*{error_msg}.*", re.MULTILINE | re.DOTALL
)
with pytest.raises(ValueError, match=pattern):
read_configuration(pyproject)

Expand Down

0 comments on commit c8b5741

Please sign in to comment.