mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-14 06:34:44 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,18 +1,24 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import re
|
||||
from typing import NewType, Optional, Tuple, cast
|
||||
from typing import cast
|
||||
from typing import NewType
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
from pip._vendor.packaging import specifiers, version
|
||||
from pip._vendor.packaging import specifiers
|
||||
from pip._vendor.packaging import version
|
||||
from pip._vendor.packaging.requirements import Requirement
|
||||
|
||||
NormalizedExtra = NewType("NormalizedExtra", str)
|
||||
NormalizedExtra = NewType('NormalizedExtra', str)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_requires_python(
|
||||
requires_python: Optional[str], version_info: Tuple[int, ...]
|
||||
requires_python: str | None, version_info: tuple[int, ...],
|
||||
) -> bool:
|
||||
"""
|
||||
Check if the given Python version matches a "Requires-Python" specifier.
|
||||
|
|
@ -30,7 +36,7 @@ def check_requires_python(
|
|||
return True
|
||||
requires_python_specifier = specifiers.SpecifierSet(requires_python)
|
||||
|
||||
python_version = version.parse(".".join(map(str, version_info)))
|
||||
python_version = version.parse('.'.join(map(str, version_info)))
|
||||
return python_version in requires_python_specifier
|
||||
|
||||
|
||||
|
|
@ -54,4 +60,4 @@ def safe_extra(extra: str) -> NormalizedExtra:
|
|||
This function is duplicated from ``pkg_resources``. Note that this is not
|
||||
the same to either ``canonicalize_name`` or ``_egg_link_name``.
|
||||
"""
|
||||
return cast(NormalizedExtra, re.sub("[^A-Za-z0-9.-]+", "_", extra).lower())
|
||||
return cast(NormalizedExtra, re.sub('[^A-Za-z0-9.-]+', '_', extra).lower())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue