Skip to content

Commit

Permalink
Merge pull request pypa#12594 from notatallshaw/update-black-to-24.3.0
Browse files Browse the repository at this point in the history
Update black to 24.4.0
  • Loading branch information
sbidoul authored Apr 14, 2024
2 parents 5da6b2f + 3bd8a7e commit be278a3
Show file tree
Hide file tree
Showing 43 changed files with 59 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
exclude: .patch

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.4.0
hooks:
- id: black

Expand Down
1 change: 1 addition & 0 deletions news/12594.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Black pre-commit to 24.4.0
2 changes: 1 addition & 1 deletion src/pip/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_log.init_logging()


def main(args: (Optional[List[str]]) = None) -> int:
def main(args: Optional[List[str]] = None) -> int:
"""This is preserved for old console scripts that may still be referencing
it.
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Primary application entrypoint.
"""

import locale
import logging
import os
Expand Down
10 changes: 5 additions & 5 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def _create_truststore_ssl_context() -> Optional["SSLContext"]:


class SessionCommandMixin(CommandContextMixIn):

"""
A class mixin for command classes needing _build_session().
"""
Expand Down Expand Up @@ -155,7 +154,6 @@ def _build_session(


class IndexGroupCommand(Command, SessionCommandMixin):

"""
Abstract base class for commands with the index_group options.
Expand Down Expand Up @@ -442,9 +440,11 @@ def get_requirements(
isolated=options.isolated_mode,
use_pep517=options.use_pep517,
user_supplied=True,
config_settings=parsed_req.options.get("config_settings")
if parsed_req.options
else None,
config_settings=(
parsed_req.options.get("config_settings")
if parsed_req.options
else None
),
)
requirements.append(req_to_add)

Expand Down
4 changes: 1 addition & 3 deletions src/pip/_internal/index/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ def __hash__(self) -> int:


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


def with_cached_index_content(fn: ParseLinks) -> ParseLinks:
Expand Down Expand Up @@ -395,7 +394,6 @@ class CollectedSources(NamedTuple):


class LinkCollector:

"""
Responsible for collecting Link objects from all configured locations,
making network requests as needed.
Expand Down
3 changes: 0 additions & 3 deletions src/pip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class LinkType(enum.Enum):


class LinkEvaluator:

"""
Responsible for evaluating links for a particular project.
"""
Expand Down Expand Up @@ -324,7 +323,6 @@ def filter_unallowed_hashes(


class CandidatePreferences:

"""
Encapsulates some of the preferences for filtering and sorting
InstallationCandidate objects.
Expand Down Expand Up @@ -383,7 +381,6 @@ def iter_applicable(self) -> Iterable[InstallationCandidate]:


class CandidateEvaluator:

"""
Responsible for filtering and sorting candidates for installation based
on what tags are valid.
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/models/direct_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" PEP 610 """

import json
import re
import urllib.parse
Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/models/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
https://docs.python.org/3/install/index.html#alternate-installation.
"""


SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"]


Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/models/search_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class SearchScope:

"""
Encapsulates the locations that pip is configured to search.
"""
Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/models/target_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class TargetPython:

"""
Encapsulates the properties of a Python interpreter one is targeting
for a package install, download, etc.
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/models/wheel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Represents a wheel file and provides access to the various parts of the
name that have meaning.
"""

import re
from typing import Dict, Iterable, List

Expand Down
9 changes: 5 additions & 4 deletions src/pip/_internal/network/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Contains interface (MultiDomainBasicAuth) and associated glue code for
providing credentials in the context of network requests.
"""

import logging
import os
import shutil
Expand Down Expand Up @@ -47,12 +48,12 @@ class KeyRingBaseProvider(ABC):
has_keyring: bool

@abstractmethod
def get_auth_info(self, url: str, username: Optional[str]) -> Optional[AuthInfo]:
...
def get_auth_info(
self, url: str, username: Optional[str]
) -> Optional[AuthInfo]: ...

@abstractmethod
def save_auth_info(self, url: str, username: str, password: str) -> None:
...
def save_auth_info(self, url: str, username: str, password: str) -> None: ...


class KeyRingNullProvider(KeyRingBaseProvider):
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/network/download.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Download files with progress indicators.
"""

import email.message
import logging
import mimetypes
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/operations/install/editable_legacy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Legacy editable installation process, i.e. `setup.py develop`.
"""

import logging
from typing import Optional, Sequence

Expand Down
6 changes: 3 additions & 3 deletions src/pip/_internal/resolution/legacy/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ def _add_requirement_to_set(
return [install_req], None

try:
existing_req: Optional[
InstallRequirement
] = requirement_set.get_requirement(install_req.name)
existing_req: Optional[InstallRequirement] = (
requirement_set.get_requirement(install_req.name)
)
except KeyError:
existing_req = None

Expand Down
16 changes: 10 additions & 6 deletions src/pip/_internal/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,23 @@ def deprecated(
(reason, f"{DEPRECATION_MSG_PREFIX}{{}}"),
(
gone_in,
"pip {} will enforce this behaviour change."
if not is_gone
else "Since pip {}, this is no longer supported.",
(
"pip {} will enforce this behaviour change."
if not is_gone
else "Since pip {}, this is no longer supported."
),
),
(
replacement,
"A possible replacement is {}.",
),
(
feature_flag,
"You can use the flag --use-feature={} to test the upcoming behaviour."
if not is_gone
else None,
(
"You can use the flag --use-feature={} to test the upcoming behaviour."
if not is_gone
else None
),
),
(
issue,
Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def filter(self, record: logging.LogRecord) -> bool:


class ExcludeLoggerFilter(Filter):

"""
A logging Filter that excludes records from a logger (or its children).
"""
Expand Down
1 change: 0 additions & 1 deletion src/pip/_internal/vcs/versioncontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(self, url: str):


class RevOptions:

"""
Encapsulates a VCS-specific revision to install, along with any VCS
install options.
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Basic CLI functionality checks.
"""

import subprocess
import sys
from pathlib import Path
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def __call__(
cwd: Union[Path, str, None] = None,
include_env: bool = True,
expect_error: bool = True,
) -> Tuple[TestPipResult, PipTestEnvironment]:
...
) -> Tuple[TestPipResult, PipTestEnvironment]: ...


@pytest.fixture
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the config command
"""

import re
import textwrap

Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_hash.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ``pip hash`` command"""

from pathlib import Path

from tests.lib import PipTestEnvironment
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_install_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Tests for compatibility workarounds.
"""

import os
from pathlib import Path

Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def args(self) -> Any:


class ArgRecordingSdistMaker(Protocol):
def __call__(self, name: str, **kwargs: Any) -> ArgRecordingSdist:
...
def __call__(self, name: str, **kwargs: Any) -> ArgRecordingSdist: ...


@pytest.fixture()
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_install_user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
tests specific to "pip install --user"
"""

import os
import textwrap
from os.path import curdir, isdir, isfile
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/test_new_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,7 @@ def __call__(
version: str,
requires: List[str],
extras: Dict[str, List[str]],
) -> str:
...
) -> str: ...


def _local_with_setup(
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_no_color.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test specific for the --no-color option
"""

import os
import shutil
import subprocess
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_uninstall_user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
tests specific to uninstalling --user installs
"""

from os.path import isdir, isfile, normcase

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_vcs_git.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Contains functional tests of the Git class.
"""

import logging
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""'pip wheel' tests"""

import os
import re
import sys
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,7 @@ def __call__(
tmpdir: pathlib.Path,
virtualenv: Optional[VirtualEnvironment] = None,
environ: Optional[Dict[AnyStr, AnyStr]] = None,
) -> PipTestEnvironment:
...
) -> PipTestEnvironment: ...


CertFactory = Callable[[], str]
1 change: 1 addition & 0 deletions tests/lib/filesystem.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helpers for filesystem-dependent tests.
"""

import os
from functools import partial
from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions tests/lib/test_lib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the test support."""

import filecmp
import pathlib
import re
Expand Down
1 change: 1 addition & 0 deletions tests/lib/test_wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for wheel helper.
"""

import csv
from email import message_from_string
from email.message import Message
Expand Down
1 change: 1 addition & 0 deletions tests/lib/wheel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helper for building wheels as would be in test cases.
"""

import csv
import itertools
from base64 import urlsafe_b64encode
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
locations.py tests
"""

import getpass
import os
import shutil
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def test_cache_dir__PIP_NO_CACHE_DIR_invalid__with_no_cache_dir(


class TestUsePEP517Options:

"""
Test options related to using --use-pep517.
"""
Expand Down
Loading

0 comments on commit be278a3

Please sign in to comment.