Skip to content

Refactor and remove redefined-variable-type disable #1224

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

Merged
merged 1 commit into from
Oct 24, 2021
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: 4 additions & 4 deletions astroid/brain/brain_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def dataclass_transform(node: ClassDef) -> None:
return

try:
reversed_mro = reversed(node.mro())
reversed_mro = list(reversed(node.mro()))
except MroError:
reversed_mro = [node]

Expand Down Expand Up @@ -208,9 +208,9 @@ def _generate_dataclass_init(assigns: List[AnnAssign]) -> str:
if not init_var:
assignments.append(assignment_str)

params = ", ".join(["self"] + params)
assignments = "\n ".join(assignments) if assignments else "pass"
return f"def __init__({params}) -> None:\n {assignments}"
params_string = ", ".join(["self"] + params)
assignments_string = "\n ".join(assignments) if assignments else "pass"
return f"def __init__({params_string}) -> None:\n {assignments_string}"


def infer_dataclass_attribute(
Expand Down
2 changes: 1 addition & 1 deletion astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def infer(self, context=None, **kwargs):
# explicit_inference is not bound, give it self explicitly
try:
# pylint: disable=not-callable
results = tuple(self._explicit_inference(self, context, **kwargs))
results = list(self._explicit_inference(self, context, **kwargs))
if context is not None:
context.nodes_inferred += len(results)
yield from results
Expand Down
5 changes: 0 additions & 5 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ disable=fixme,
too-many-statements,
# We know about it and we're doing our best to remove it in 2.0 (oups)
cyclic-import,
# The check is faulty in most cases and it doesn't take in
# account how the variable is being used. For instance,
# using a variable that is a list or a generator in an
# iteration context is fine.
redefined-variable-type,
# Requires major redesign for fixing this (and private
# access in the same project is fine)
protected-access,
Expand Down