Skip to content

Commit 112edf9

Browse files
committed
Upgrade with pyupgrade --py38-plus
1 parent 0a11b78 commit 112edf9

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

src/pip/_internal/network/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def _set_password(self, service_name: str, username: str, password: str) -> None
151151
env["PYTHONIOENCODING"] = "utf-8"
152152
subprocess.run(
153153
[self.keyring, "set", service_name, username],
154-
input=f"{password}{os.linesep}".encode("utf-8"),
154+
input=f"{password}{os.linesep}".encode(),
155155
env=env,
156156
check=True,
157157
)

src/pip/_internal/network/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def send(
230230
# to return a better error message:
231231
resp.status_code = 404
232232
resp.reason = type(exc).__name__
233-
resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode("utf8"))
233+
resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode())
234234
else:
235235
modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
236236
content_type = mimetypes.guess_type(pathname)[0] or "text/plain"

src/pip/_internal/operations/build/build_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def add(self, req: InstallRequirement, key: TrackerId) -> None:
9999
except FileNotFoundError:
100100
pass
101101
else:
102-
message = "{} is already being built: {}".format(req.link, contents)
102+
message = f"{req.link} is already being built: {contents}"
103103
raise LookupError(message)
104104

105105
# If we're here, req should really not be building already.

src/pip/_internal/operations/build/metadata_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _find_egg_info(directory: str) -> str:
2727

2828
if len(filenames) > 1:
2929
raise InstallationError(
30-
"More than one .egg-info directory found in {}".format(directory)
30+
f"More than one .egg-info directory found in {directory}"
3131
)
3232

3333
return os.path.join(directory, filenames[0])

src/pip/_internal/req/req_uninstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def __init__(self, dist: BaseDistribution) -> None:
315315
# Create local cache of normalize_path results. Creating an UninstallPathSet
316316
# can result in hundreds/thousands of redundant calls to normalize_path with
317317
# the same args, which hurts performance.
318-
self._normalize_path_cached = functools.lru_cache()(normalize_path)
318+
self._normalize_path_cached = functools.lru_cache(normalize_path)
319319

320320
def _permitted(self, path: str) -> bool:
321321
"""

tests/data/packages/BrokenEmitsUTF8/setup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import sys
42
from distutils.core import setup
53

@@ -10,14 +8,10 @@ class FakeError(Exception):
108

119
if sys.argv[1] in ("install", "bdist_wheel"):
1210
if hasattr(sys.stdout, "buffer"):
11+
sys.stdout.buffer.write(b"\nThis package prints out UTF-8 stuff like:\n")
12+
sys.stdout.buffer.write("* return type of ‘main’ is not ‘int’\n".encode())
1313
sys.stdout.buffer.write(
14-
"\nThis package prints out UTF-8 stuff like:\n".encode("utf-8")
15-
)
16-
sys.stdout.buffer.write(
17-
"* return type of ‘main’ is not ‘int’\n".encode("utf-8")
18-
)
19-
sys.stdout.buffer.write(
20-
"* Björk Guðmundsdóttir [ˈpjœr̥k ˈkvʏðmʏntsˌtoʊhtɪr]".encode("utf-8")
14+
"* Björk Guðmundsdóttir [ˈpjœr̥k ˈkvʏðmʏntsˌtoʊhtɪr]".encode()
2115
)
2216
else:
2317
pass

tests/functional/test_cache.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ def list_matches_wheel_abspath(wheel_name: str, result: TestPipResult) -> bool:
114114
lines = result.stdout.splitlines()
115115
expected = f"{wheel_name}-py3-none-any.whl"
116116
return any(
117-
(
118-
(os.path.basename(line).startswith(expected) and os.path.exists(line))
119-
for line in lines
120-
)
117+
(os.path.basename(line).startswith(expected) and os.path.exists(line))
118+
for line in lines
121119
)
122120

123121

0 commit comments

Comments
 (0)