Skip to content

Commit

Permalink
Update pylint codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Sep 20, 2024
1 parent 0e19fad commit f25fda9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pylint/checkers/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def predicate(obj: Any) -> bool:

def _annotated_unpack_infer(
stmt: nodes.NodeNG, context: InferenceContext | None = None
) -> Generator[tuple[nodes.NodeNG, SuccessfulInferenceResult], None, None]:
) -> Generator[tuple[nodes.NodeNG, SuccessfulInferenceResult]]:
"""Recursively generate nodes inferred by the given statement.
If the inferred value is a list or a tuple, recurse on the elements.
Expand Down
4 changes: 2 additions & 2 deletions pylint/checkers/symilar.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def _get_similarity_report(
# pylint: disable = too-many-locals
def _find_common(
self, lineset1: LineSet, lineset2: LineSet
) -> Generator[Commonality, None, None]:
) -> Generator[Commonality]:
"""Find similarities in the two given linesets.
This the core of the algorithm. The idea is to compute the hashes of a
Expand Down Expand Up @@ -541,7 +541,7 @@ def _find_common(
if eff_cmn_nb > self.namespace.min_similarity_lines:
yield com

def _iter_sims(self) -> Generator[Commonality, None, None]:
def _iter_sims(self) -> Generator[Commonality]:
"""Iterate on similarities among all files, by making a Cartesian
product.
"""
Expand Down
4 changes: 1 addition & 3 deletions pylint/checkers/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ class C: ...
return frame.lineno < defframe.lineno # type: ignore[no-any-return]


def _infer_name_module(
node: nodes.Import, name: str
) -> Generator[InferenceResult, None, None]:
def _infer_name_module(node: nodes.Import, name: str) -> Generator[InferenceResult]:
context = astroid.context.InferenceContext()
context.lookupname = name
return node.infer(context, asname=False) # type: ignore[no-any-return]
Expand Down
4 changes: 2 additions & 2 deletions pylint/pyreverse/diadefslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def add_class(self, node: nodes.ClassDef) -> None:

def get_ancestors(
self, node: nodes.ClassDef, level: int
) -> Generator[nodes.ClassDef, None, None]:
) -> Generator[nodes.ClassDef]:
"""Return ancestor nodes of a class node."""
if level == 0:
return
Expand All @@ -95,7 +95,7 @@ def get_ancestors(

def get_associated(
self, klass_node: nodes.ClassDef, level: int
) -> Generator[nodes.ClassDef, None, None]:
) -> Generator[nodes.ClassDef]:
"""Return associated nodes of a class node."""
if level == 0:
return
Expand Down
2 changes: 1 addition & 1 deletion pylint/testutils/checker_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def assertNoMessages(self) -> Iterator[None]:
@contextlib.contextmanager
def assertAddsMessages(
self, *messages: MessageTest, ignore_position: bool = False
) -> Generator[None, None, None]:
) -> Generator[None]:
"""Assert that exactly the given method adds the given messages.
The list of messages must exactly match *all* the messages added by the
Expand Down
6 changes: 3 additions & 3 deletions pylint/testutils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _patch_streams(out: TextIO) -> Iterator[None]:
@contextlib.contextmanager
def _test_sys_path(
replacement_sys_path: list[str] | None = None,
) -> Generator[None, None, None]:
) -> Generator[None]:
original_path = sys.path
try:
if replacement_sys_path is not None:
Expand All @@ -40,7 +40,7 @@ def _test_sys_path(
@contextlib.contextmanager
def _test_cwd(
current_working_directory: str | Path | None = None,
) -> Generator[None, None, None]:
) -> Generator[None]:
original_dir = os.getcwd()
try:
if current_working_directory is not None:
Expand All @@ -53,7 +53,7 @@ def _test_cwd(
@contextlib.contextmanager
def _test_environ_pythonpath(
new_pythonpath: str | None = None,
) -> Generator[None, None, None]:
) -> Generator[None]:
original_pythonpath = os.environ.get("PYTHONPATH")
if new_pythonpath:
os.environ["PYTHONPATH"] = new_pythonpath
Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/pragma_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class InvalidPragmaError(PragmaParserError):
"""Thrown in case the pragma is invalid."""


def parse_pragma(pylint_pragma: str) -> Generator[PragmaRepresenter, None, None]:
def parse_pragma(pylint_pragma: str) -> Generator[PragmaRepresenter]:
action: str | None = None
messages: list[str] = []
assignment_required = False
Expand Down

0 comments on commit f25fda9

Please sign in to comment.