Skip to content

Commit be278a3

Browse files
authored
Merge pull request #12594 from notatallshaw/update-black-to-24.3.0
Update black to 24.4.0
2 parents 5da6b2f + 3bd8a7e commit be278a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+59
-46
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
exclude: .patch
1818

1919
- repo: https://github.com/psf/black-pre-commit-mirror
20-
rev: 23.12.1
20+
rev: 24.4.0
2121
hooks:
2222
- id: black
2323

news/12594.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update Black pre-commit to 24.4.0

src/pip/_internal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
_log.init_logging()
88

99

10-
def main(args: (Optional[List[str]]) = None) -> int:
10+
def main(args: Optional[List[str]] = None) -> int:
1111
"""This is preserved for old console scripts that may still be referencing
1212
it.
1313

src/pip/_internal/cli/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Primary application entrypoint.
22
"""
3+
34
import locale
45
import logging
56
import os

src/pip/_internal/cli/req_command.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def _create_truststore_ssl_context() -> Optional["SSLContext"]:
6666

6767

6868
class SessionCommandMixin(CommandContextMixIn):
69-
7069
"""
7170
A class mixin for command classes needing _build_session().
7271
"""
@@ -155,7 +154,6 @@ def _build_session(
155154

156155

157156
class IndexGroupCommand(Command, SessionCommandMixin):
158-
159157
"""
160158
Abstract base class for commands with the index_group options.
161159
@@ -442,9 +440,11 @@ def get_requirements(
442440
isolated=options.isolated_mode,
443441
use_pep517=options.use_pep517,
444442
user_supplied=True,
445-
config_settings=parsed_req.options.get("config_settings")
446-
if parsed_req.options
447-
else None,
443+
config_settings=(
444+
parsed_req.options.get("config_settings")
445+
if parsed_req.options
446+
else None
447+
),
448448
)
449449
requirements.append(req_to_add)
450450

src/pip/_internal/index/collector.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ def __hash__(self) -> int:
196196

197197

198198
class ParseLinks(Protocol):
199-
def __call__(self, page: "IndexContent") -> Iterable[Link]:
200-
...
199+
def __call__(self, page: "IndexContent") -> Iterable[Link]: ...
201200

202201

203202
def with_cached_index_content(fn: ParseLinks) -> ParseLinks:
@@ -395,7 +394,6 @@ class CollectedSources(NamedTuple):
395394

396395

397396
class LinkCollector:
398-
399397
"""
400398
Responsible for collecting Link objects from all configured locations,
401399
making network requests as needed.

src/pip/_internal/index/package_finder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class LinkType(enum.Enum):
106106

107107

108108
class LinkEvaluator:
109-
110109
"""
111110
Responsible for evaluating links for a particular project.
112111
"""
@@ -324,7 +323,6 @@ def filter_unallowed_hashes(
324323

325324

326325
class CandidatePreferences:
327-
328326
"""
329327
Encapsulates some of the preferences for filtering and sorting
330328
InstallationCandidate objects.
@@ -383,7 +381,6 @@ def iter_applicable(self) -> Iterable[InstallationCandidate]:
383381

384382

385383
class CandidateEvaluator:
386-
387384
"""
388385
Responsible for filtering and sorting candidates for installation based
389386
on what tags are valid.

src/pip/_internal/models/direct_url.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" PEP 610 """
2+
23
import json
34
import re
45
import urllib.parse

src/pip/_internal/models/scheme.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
https://docs.python.org/3/install/index.html#alternate-installation.
66
"""
77

8-
98
SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"]
109

1110

src/pip/_internal/models/search_scope.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
class SearchScope:
18-
1918
"""
2019
Encapsulates the locations that pip is configured to search.
2120
"""

src/pip/_internal/models/target_python.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class TargetPython:
11-
1211
"""
1312
Encapsulates the properties of a Python interpreter one is targeting
1413
for a package install, download, etc.

src/pip/_internal/models/wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Represents a wheel file and provides access to the various parts of the
22
name that have meaning.
33
"""
4+
45
import re
56
from typing import Dict, Iterable, List
67

src/pip/_internal/network/auth.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Contains interface (MultiDomainBasicAuth) and associated glue code for
44
providing credentials in the context of network requests.
55
"""
6+
67
import logging
78
import os
89
import shutil
@@ -47,12 +48,12 @@ class KeyRingBaseProvider(ABC):
4748
has_keyring: bool
4849

4950
@abstractmethod
50-
def get_auth_info(self, url: str, username: Optional[str]) -> Optional[AuthInfo]:
51-
...
51+
def get_auth_info(
52+
self, url: str, username: Optional[str]
53+
) -> Optional[AuthInfo]: ...
5254

5355
@abstractmethod
54-
def save_auth_info(self, url: str, username: str, password: str) -> None:
55-
...
56+
def save_auth_info(self, url: str, username: str, password: str) -> None: ...
5657

5758

5859
class KeyRingNullProvider(KeyRingBaseProvider):

src/pip/_internal/network/download.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Download files with progress indicators.
22
"""
3+
34
import email.message
45
import logging
56
import mimetypes

src/pip/_internal/operations/install/editable_legacy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Legacy editable installation process, i.e. `setup.py develop`.
22
"""
3+
34
import logging
45
from typing import Optional, Sequence
56

src/pip/_internal/resolution/legacy/resolver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ def _add_requirement_to_set(
245245
return [install_req], None
246246

247247
try:
248-
existing_req: Optional[
249-
InstallRequirement
250-
] = requirement_set.get_requirement(install_req.name)
248+
existing_req: Optional[InstallRequirement] = (
249+
requirement_set.get_requirement(install_req.name)
250+
)
251251
except KeyError:
252252
existing_req = None
253253

src/pip/_internal/utils/deprecation.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,23 @@ def deprecated(
8787
(reason, f"{DEPRECATION_MSG_PREFIX}{{}}"),
8888
(
8989
gone_in,
90-
"pip {} will enforce this behaviour change."
91-
if not is_gone
92-
else "Since pip {}, this is no longer supported.",
90+
(
91+
"pip {} will enforce this behaviour change."
92+
if not is_gone
93+
else "Since pip {}, this is no longer supported."
94+
),
9395
),
9496
(
9597
replacement,
9698
"A possible replacement is {}.",
9799
),
98100
(
99101
feature_flag,
100-
"You can use the flag --use-feature={} to test the upcoming behaviour."
101-
if not is_gone
102-
else None,
102+
(
103+
"You can use the flag --use-feature={} to test the upcoming behaviour."
104+
if not is_gone
105+
else None
106+
),
103107
),
104108
(
105109
issue,

src/pip/_internal/utils/logging.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ def filter(self, record: logging.LogRecord) -> bool:
212212

213213

214214
class ExcludeLoggerFilter(Filter):
215-
216215
"""
217216
A logging Filter that excludes records from a logger (or its children).
218217
"""

src/pip/_internal/vcs/versioncontrol.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def __init__(self, url: str):
115115

116116

117117
class RevOptions:
118-
119118
"""
120119
Encapsulates a VCS-specific revision to install, along with any VCS
121120
install options.

tests/functional/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Basic CLI functionality checks.
22
"""
3+
34
import subprocess
45
import sys
56
from pathlib import Path

tests/functional/test_completion.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def __call__(
126126
cwd: Union[Path, str, None] = None,
127127
include_env: bool = True,
128128
expect_error: bool = True,
129-
) -> Tuple[TestPipResult, PipTestEnvironment]:
130-
...
129+
) -> Tuple[TestPipResult, PipTestEnvironment]: ...
131130

132131

133132
@pytest.fixture

tests/functional/test_configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for the config command
22
"""
3+
34
import re
45
import textwrap
56

tests/functional/test_hash.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for the ``pip hash`` command"""
2+
23
from pathlib import Path
34

45
from tests.lib import PipTestEnvironment

tests/functional/test_install_compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Tests for compatibility workarounds.
33
44
"""
5+
56
import os
67
from pathlib import Path
78

tests/functional/test_install_reqs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def args(self) -> Any:
2929

3030

3131
class ArgRecordingSdistMaker(Protocol):
32-
def __call__(self, name: str, **kwargs: Any) -> ArgRecordingSdist:
33-
...
32+
def __call__(self, name: str, **kwargs: Any) -> ArgRecordingSdist: ...
3433

3534

3635
@pytest.fixture()

tests/functional/test_install_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
tests specific to "pip install --user"
33
"""
4+
45
import os
56
import textwrap
67
from os.path import curdir, isdir, isfile

tests/functional/test_new_resolver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,7 @@ def __call__(
930930
version: str,
931931
requires: List[str],
932932
extras: Dict[str, List[str]],
933-
) -> str:
934-
...
933+
) -> str: ...
935934

936935

937936
def _local_with_setup(

tests/functional/test_no_color.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Test specific for the --no-color option
33
"""
4+
45
import os
56
import shutil
67
import subprocess

tests/functional/test_uninstall_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
tests specific to uninstalling --user installs
33
"""
4+
45
from os.path import isdir, isfile, normcase
56

67
import pytest

tests/functional/test_vcs_git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Contains functional tests of the Git class.
33
"""
4+
45
import logging
56
import os
67
import pathlib

tests/functional/test_wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""'pip wheel' tests"""
2+
23
import os
34
import re
45
import sys

tests/lib/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,7 @@ def __call__(
13711371
tmpdir: pathlib.Path,
13721372
virtualenv: Optional[VirtualEnvironment] = None,
13731373
environ: Optional[Dict[AnyStr, AnyStr]] = None,
1374-
) -> PipTestEnvironment:
1375-
...
1374+
) -> PipTestEnvironment: ...
13761375

13771376

13781377
CertFactory = Callable[[], str]

tests/lib/filesystem.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Helpers for filesystem-dependent tests.
22
"""
3+
34
import os
45
from functools import partial
56
from itertools import chain

tests/lib/test_lib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test the test support."""
2+
23
import filecmp
34
import pathlib
45
import re

tests/lib/test_wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for wheel helper.
22
"""
3+
34
import csv
45
from email import message_from_string
56
from email.message import Message

tests/lib/wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Helper for building wheels as would be in test cases.
22
"""
3+
34
import csv
45
import itertools
56
from base64 import urlsafe_b64encode

tests/unit/test_locations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
locations.py tests
33
44
"""
5+
56
import getpass
67
import os
78
import shutil

tests/unit/test_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def test_cache_dir__PIP_NO_CACHE_DIR_invalid__with_no_cache_dir(
195195

196196

197197
class TestUsePEP517Options:
198-
199198
"""
200199
Test options related to using --use-pep517.
201200
"""

0 commit comments

Comments
 (0)