Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport maintenance/3.3.x] Address pylint 3.3 messages #2577

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading