Skip to content

Commit b9a2543

Browse files
committed
Remove pkg_resources era safe_extra()
PEP 685 renders this normalization helper useless.
1 parent 7c9a6b1 commit b9a2543

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/pip/_internal/utils/packaging.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import functools
22
import logging
3-
import re
4-
from typing import NewType, Optional, Tuple, cast
3+
from typing import Optional, Tuple
54

65
from pip._vendor.packaging import specifiers, version
76
from pip._vendor.packaging.requirements import Requirement
87

9-
NormalizedExtra = NewType("NormalizedExtra", str)
10-
118
logger = logging.getLogger(__name__)
129

1310

@@ -44,15 +41,3 @@ def get_requirement(req_string: str) -> Requirement:
4441
# minimize repeated parsing of the same string to construct equivalent
4542
# Requirement objects.
4643
return Requirement(req_string)
47-
48-
49-
def safe_extra(extra: str) -> NormalizedExtra:
50-
"""Convert an arbitrary string to a standard 'extra' name
51-
52-
Any runs of non-alphanumeric characters are replaced with a single '_',
53-
and the result is always lowercased.
54-
55-
This function is duplicated from ``pkg_resources``. Note that this is not
56-
the same to either ``canonicalize_name`` or ``_egg_link_name``.
57-
"""
58-
return cast(NormalizedExtra, re.sub("[^A-Za-z0-9.-]+", "_", extra).lower())

0 commit comments

Comments
 (0)