Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
style: apply automated linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
megalinter-bot committed Mar 14, 2024
1 parent 6d780b4 commit 0c24103
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ def get_symbol(self, node: astroid.NodeNG, current_scope: astroid.NodeNG | None)
astroid.TryExcept() | astroid.TryFinally()
): # TODO: can we summarize Lambda and ListComp here? -> only if nodes in try except are not global
return LocalVariable(
node=node, id=NodeID.calc_node_id(node), name=node.name if hasattr(node, "name") else "None",
node=node,
id=NodeID.calc_node_id(node),
name=node.name if hasattr(node, "name") else "None",
)

# This line is a fallback but should never be reached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ def _find_target_references(
continue
# Do not add functions that are not of the current class (or superclass).
if function.symbol.name not in klass.class_variables or not is_function_of_class(
function.symbol.node, klass,
function.symbol.node,
klass,
):
# Collect all functions of superclasses for the current klass instance.
super_functions = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ def transform_member_access(member_access: MemberAccess) -> str:
),
(
astroid.ClassDef(
"A", lineno=2, col_offset=3, parent=astroid.Module("numpy"), end_lineno=2, end_col_offset=10,
"A",
lineno=2,
col_offset=3,
parent=astroid.Module("numpy"),
end_lineno=2,
end_col_offset=10,
),
"numpy.A.2.3",
),
Expand All @@ -343,7 +348,12 @@ def transform_member_access(member_access: MemberAccess) -> str:
lineno=1,
col_offset=0,
parent=astroid.ClassDef(
"A", lineno=2, col_offset=3, parent=astroid.Module("numpy"), end_lineno=2, end_col_offset=10,
"A",
lineno=2,
col_offset=3,
parent=astroid.Module("numpy"),
end_lineno=2,
end_col_offset=10,
),
),
"numpy.global_func.1.0",
Expand Down Expand Up @@ -371,7 +381,12 @@ def transform_member_access(member_access: MemberAccess) -> str:
lineno=1,
col_offset=0,
parent=astroid.ClassDef(
"A", lineno=2, col_offset=3, parent=astroid.Module("numpy"), end_lineno=2, end_col_offset=10,
"A",
lineno=2,
col_offset=3,
parent=astroid.Module("numpy"),
end_lineno=2,
end_col_offset=10,
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ def g():
{
"__init__.line3": Pure(),
"f.line9": SimpleImpure(
{"NonLocalVariableRead.ClassVariable.B.upper_class", "NonLocalVariableRead.InstanceVariable.A.name"},
{
"NonLocalVariableRead.ClassVariable.B.upper_class",
"NonLocalVariableRead.InstanceVariable.A.name",
},
),
"g.line13": SimpleImpure({
"NonLocalVariableWrite.ClassVariable.B.upper_class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1542,13 +1542,19 @@ def try_except_else_finally(num1, num2, num3):
ReferenceTestNode("num3.line12", "FunctionDef.try_except_else_finally", ["Parameter.num3.line2"]),
ReferenceTestNode("print.line14", "FunctionDef.try_except_else_finally", ["Builtin.print"]),
ReferenceTestNode(
"result.line14", "FunctionDef.try_except_else_finally", ["LocalVariable.result.line4"],
"result.line14",
"FunctionDef.try_except_else_finally",
["LocalVariable.result.line4"],
),
ReferenceTestNode(
"result2.line14", "FunctionDef.try_except_else_finally", ["LocalVariable.result2.line10"],
"result2.line14",
"FunctionDef.try_except_else_finally",
["LocalVariable.result2.line10"],
),
ReferenceTestNode(
"final.line14", "FunctionDef.try_except_else_finally", ["LocalVariable.final.line12"],
"final.line14",
"FunctionDef.try_except_else_finally",
["LocalVariable.final.line12"],
),
],
),
Expand Down

0 comments on commit 0c24103

Please sign in to comment.