Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed excess logging.
Browse files Browse the repository at this point in the history
jzohrab committed Jan 17, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 604a03e commit a08d9b4
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
@@ -1467,61 +1467,57 @@ def _dp(s, val=None):
_dp("visit call, node", node)

called = safe_infer(node.func, compare_constructors=True)
_dp("a")
self._check_not_callable(node, called)
_dp("b")
try:
_dp("c")
called, implicit_args, callable_name = _determine_callable(called)
_dp("d")
except ValueError:
# Any error occurred during determining the function type, most of
# those errors are handled by different warnings.
_dp("e")
return

_dp("f")
_dp("Data dump for __init__ call")
call_site = astroid.arguments.CallSite.from_call(node)
num_positional_args = len(call_site.positional_arguments)
_dp("node frame", node.frame())
_dp("isinst", isinstance(node.frame(), nodes.ClassDef))
_dp("funcdef", isinstance(called, nodes.FunctionDef))
_dp("called", called)
_dp("frame body", node.frame().body)
_dp("called in frame body", called in node.frame().body)
_dp("npa", num_positional_args)
_dp("dec names", called.decoratornames())

if called.args.args is None:
_dp("g")
_dp("called.args.args is None")
_dp("called.name", called.name)
if called.name == "isinstance":
# Verify whether second argument of isinstance is a valid type
_dp("h")
self._check_isinstance_args(node, callable_name)
# Built-in functions have no argument information.
_dp("i")
_dp("Returning now")
return

_dp("j")
if len(called.argnames()) != len(set(called.argnames())):
# Duplicate parameter name (see duplicate-argument). We can't really
# make sense of the function call in this case, so just return.
_dp("k")
return

# Build the set of keyword arguments, checking for duplicate keywords,
# and count the positional arguments.
_dp("L")
call_site = astroid.arguments.CallSite.from_call(node)

# Warn about duplicated keyword arguments, such as `f=24, **{'f': 24}`
_dp("m")
for keyword in call_site.duplicated_keywords:
_dp("N")
self.add_message("repeated-keyword", node=node, args=(keyword,))

_dp("O")
if call_site.has_invalid_arguments() or call_site.has_invalid_keywords():
# Can't make sense of this.
_dp("p")
return

# Has the function signature changed in ways we cannot reliably detect?
_dp("q")
if hasattr(called, "decorators") and decorated_with(
called, self.linter.config.signature_mutators
):
_dp("R")
return

num_positional_args = len(call_site.positional_arguments)
@@ -1553,25 +1549,14 @@ def _dp(s, val=None):
# inside the class where the function is defined.
# This avoids emitting `too-many-function-args` since `num_positional_args`
# includes an implicit `self` argument which is not present in `called.args`.
_dp("NOTE: about to dec")
_dp("node frame", node.frame())
_dp("isinst", isinstance(node.frame(), nodes.ClassDef))
_dp("funcdef", isinstance(called, nodes.FunctionDef))
_dp("called", called)
_dp("frame body", node.frame().body)
_dp("called in frame body", called in node.frame().body)
_dp("npa", num_positional_args)
_dp("dec names", called.decoratornames())
if (
isinstance(node.frame(), nodes.ClassDef)
and isinstance(called, nodes.FunctionDef)
and called in node.frame().body
and num_positional_args > 0
and "builtins.staticmethod" not in called.decoratornames()
):
_dp("NOTE: decrementing")
num_positional_args -= 1
_dp("NOTE: dec done")

# Analyze the list of formal parameters.
args = list(itertools.chain(called.args.posonlyargs or (), called.args.args))

0 comments on commit a08d9b4

Please sign in to comment.