Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 8, 2023
1 parent 847e696 commit 5146772
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pylint/checkers/base/basic_checker.py
Expand Up @@ -615,7 +615,9 @@ def _check_dangerous_default(self, node: nodes.FunctionDef) -> None:
def is_iterable(internal_node: nodes.NodeNG) -> bool:
return isinstance(internal_node, (nodes.List, nodes.Set, nodes.Dict))

def is_callable_immutable_builtins_func(default: nodes.NodeNG, value: nodes.NodeNG) -> bool:
def is_callable_immutable_builtins_func(
default: nodes.NodeNG, value: nodes.NodeNG
) -> bool:
"""Indirect recognize immutable builtins function exceptions:
1 - If the name is the same
Expand Down Expand Up @@ -664,7 +666,9 @@ def is_callable_immutable_builtins_func(default: nodes.NodeNG, value: nodes.Node
msg = f"{default.as_string()} ({DEFAULT_ARGUMENT_SYMBOLS[value.qname()]})"
self.add_message("dangerous-default-value", node=node, args=(msg,))

elif isinstance(default, astroid.nodes.node_classes.Call) and not is_callable_immutable_builtins_func(default, value):
elif isinstance(
default, astroid.nodes.node_classes.Call
) and not is_callable_immutable_builtins_func(default, value):
msg = f"{default.as_string()} Callable"
self.add_message("dangerous-default-value", node=node, args=(msg,))

Expand Down

0 comments on commit 5146772

Please sign in to comment.