Skip to content

Commit

Permalink
[Backport maintenance/3.3.x] Address pylint 3.3 messages (#2577)
Browse files Browse the repository at this point in the history
* Address pylint 3.3 messages (#2575)

(cherry picked from commit 706fcdb)
  • Loading branch information
github-actions[bot] authored Sep 22, 2024
1 parent a01a9c9 commit 875651b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
8 changes: 3 additions & 5 deletions astroid/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _infer_stmts(
stmts: Iterable[InferenceResult],
context: InferenceContext | None,
frame: nodes.NodeNG | BaseInstance | None = None,
) -> collections.abc.Generator[InferenceResult, None, None]:
) -> collections.abc.Generator[InferenceResult]:
"""Return an iterator on statements inferred by each statement in *stmts*."""
inferred = False
constraint_failed = False
Expand Down Expand Up @@ -354,7 +354,7 @@ def infer_binary_op(
other: InferenceResult,
context: InferenceContext,
method: SuccessfulInferenceResult,
) -> Generator[InferenceResult, None, None]:
) -> Generator[InferenceResult]:
return method.infer_call_result(self, context)

def __repr__(self) -> str:
Expand Down Expand Up @@ -491,9 +491,7 @@ def _infer_builtin_new(
self,
caller: SuccessfulInferenceResult | None,
context: InferenceContext,
) -> collections.abc.Generator[
nodes.Const | Instance | UninferableBase, None, None
]:
) -> collections.abc.Generator[nodes.Const | Instance | UninferableBase]:
if not isinstance(caller, nodes.Call):
return
if not caller.args:
Expand Down
2 changes: 1 addition & 1 deletion astroid/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class InferenceError(ResolveError): # pylint: disable=too-many-instance-attribu
context: InferenceContext object.
"""

def __init__( # pylint: disable=too-many-arguments
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
self,
message: str = "Inference failed for {node!r}.",
node: InferenceResult | None = None,
Expand Down
2 changes: 1 addition & 1 deletion astroid/nodes/_base_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
InferenceContext,
InferenceContext,
],
list[partial[Generator[InferenceResult, None, None]]],
list[partial[Generator[InferenceResult]]],
]


Expand Down
4 changes: 2 additions & 2 deletions astroid/nodes/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _is_const(value) -> bool:
]
InferBinaryOperation = Callable[
[_NodesT, Optional[InferenceContext]],
Generator[Union[InferenceResult, _BadOpMessageT], None, None],
Generator[Union[InferenceResult, _BadOpMessageT]],
]
InferLHS = Callable[
[_NodesT, Optional[InferenceContext]],
Expand Down Expand Up @@ -737,7 +737,7 @@ def __init__(
self.vararg_node = vararg_node
self.kwarg_node = kwarg_node

# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, too-many-positional-arguments
def postinit(
self,
args: list[AssignName] | None,
Expand Down
2 changes: 1 addition & 1 deletion astroid/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AstroidManagerBrain(TypedDict):
"InferenceContext",
SuccessfulInferenceResult,
],
Generator[InferenceResult, None, None],
Generator[InferenceResult],
]


Expand Down
3 changes: 3 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ exclude-protected=_asdict,_fields,_replace,_source,_make
# Maximum number of arguments for function / method
max-args=10

# Maximum number of positional arguments for function / method.
max-positional-arguments=8

# Argument names that match this expression will be ignored. Default to name

# with leading underscore
Expand Down

0 comments on commit 875651b

Please sign in to comment.