Skip to content

Commit 5e072e2

Browse files
authored
Merge pull request #9773 from sbidoul/fix-pre-commit-ci
2 parents fb57da1 + 29c50c8 commit 5e072e2

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- uses: actions/setup-python@v2
4444
- uses: pre-commit/[email protected]
4545
with:
46-
extra_args: --hook-stage=manual
46+
extra_args: --all-files --hook-stage=manual
4747

4848
packaging:
4949
name: packaging

docs/pip_sphinxext.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
import sys
77
from textwrap import dedent
8-
from typing import Iterable, List, Optional
8+
from typing import Iterable, Iterator, List, Optional
99

1010
from docutils import nodes, statemachine
1111
from docutils.parsers import rst
@@ -20,7 +20,9 @@
2020
class PipNewsInclude(rst.Directive):
2121
required_arguments = 1
2222

23-
def _is_version_section_title_underline(self, prev, curr):
23+
def _is_version_section_title_underline(
24+
self, prev: Optional[str], curr: str
25+
) -> bool:
2426
"""Find a ==== line that marks the version section title."""
2527
if prev is None:
2628
return False
@@ -30,7 +32,7 @@ def _is_version_section_title_underline(self, prev, curr):
3032
return False
3133
return True
3234

33-
def _iter_lines_with_refs(self, lines):
35+
def _iter_lines_with_refs(self, lines: Iterable[str]) -> Iterator[str]:
3436
"""Transform the input lines to add a ref before each section title.
3537
3638
This is done by looking one line ahead and locate a title's underline,
@@ -44,6 +46,7 @@ def _iter_lines_with_refs(self, lines):
4446
for line in lines:
4547
# Transform the previous line to include an explicit ref.
4648
if self._is_version_section_title_underline(prev, line):
49+
assert prev is not None
4750
vref = prev.split(None, 1)[0].replace(".", "-")
4851
yield f".. _`v{vref}`:"
4952
yield "" # Empty line between ref and the title.
@@ -53,7 +56,7 @@ def _iter_lines_with_refs(self, lines):
5356
if prev is not None:
5457
yield prev
5558

56-
def run(self):
59+
def run(self) -> List[nodes.Node]:
5760
source = self.state_machine.input_lines.source(
5861
self.lineno - self.state_machine.input_offset - 1,
5962
)

news/9748.feature.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Improve performance when picking the best file from indexes during `pip install`.
1+
Improve performance when picking the best file from indexes during ``pip install``.

src/pip/_internal/models/wheel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name that have meaning.
33
"""
44
import re
5-
from typing import Dict, List
5+
from typing import Dict, Iterable, List
66

77
from pip._vendor.packaging.tags import Tag
88

@@ -82,7 +82,9 @@ def find_most_preferred_tag(self, tags, tag_to_priority):
8282
:raises ValueError: If none of the wheel's file tags match one of
8383
the supported tags.
8484
"""
85-
return min(tag_to_priority[tag] for tag in self.file_tags if tag in tag_to_priority)
85+
return min(
86+
tag_to_priority[tag] for tag in self.file_tags if tag in tag_to_priority
87+
)
8688

8789
def supported(self, tags):
8890
# type: (Iterable[Tag]) -> bool

0 commit comments

Comments
 (0)