Skip to content

Commit ab40476

Browse files
authored
Merge pull request #13332 from ichard26/dead
Remove dead code detected by asottile/dead
2 parents e74c2d7 + b9a2543 commit ab40476

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

src/pip/_internal/commands/freeze.py

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class FreezeCommand(Command):
3232
ignore_require_venv = True
3333
usage = """
3434
%prog [options]"""
35-
log_streams = ("ext://sys.stderr", "ext://sys.stderr")
3635

3736
def add_options(self) -> None:
3837
self.cmd_opts.add_option(

src/pip/_internal/locations/__init__.py

+1-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pathlib
55
import sys
66
import sysconfig
7-
from typing import Any, Dict, Generator, Optional, Tuple
7+
from typing import Any, Dict, Optional
88

99
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
1010
from pip._internal.utils.compat import WINDOWS
@@ -174,22 +174,6 @@ def _looks_like_msys2_mingw_scheme() -> bool:
174174
)
175175

176176

177-
def _fix_abiflags(parts: Tuple[str]) -> Generator[str, None, None]:
178-
ldversion = sysconfig.get_config_var("LDVERSION")
179-
abiflags = getattr(sys, "abiflags", None)
180-
181-
# LDVERSION does not end with sys.abiflags. Just return the path unchanged.
182-
if not ldversion or not abiflags or not ldversion.endswith(abiflags):
183-
yield from parts
184-
return
185-
186-
# Strip sys.abiflags from LDVERSION-based path components.
187-
for part in parts:
188-
if part.endswith(ldversion):
189-
part = part[: (0 - len(abiflags))]
190-
yield part
191-
192-
193177
@functools.lru_cache(maxsize=None)
194178
def _warn_mismatched(old: pathlib.Path, new: pathlib.Path, *, key: str) -> None:
195179
issue_url = "https://github.com/pypa/pip/issues/10151"

src/pip/_internal/utils/packaging.py

+1-16
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)