Skip to content

Commit 0eaf22d

Browse files
committed
Separate dev cruft from code.
1 parent 88e3449 commit 0eaf22d

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

pylint/checkers/typecheck.py

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,18 +1454,6 @@ def visit_call(self, node: nodes.Call) -> None:
14541454
and that passed arguments match the parameters in the inferred function.
14551455
"""
14561456

1457-
def _dp(s, val=None):
1458-
return
1459-
## if "Attribute.__init__" not in str(node):
1460-
## return
1461-
## if val is None:
1462-
## print(f" {s}", flush=True)
1463-
## else:
1464-
## print(f" {s}: {val}", flush=True)
1465-
1466-
_dp("-" * 25)
1467-
_dp("visit call, node", node)
1468-
14691457
called = safe_infer(node.func, compare_constructors=True)
14701458
self._check_not_callable(node, called)
14711459
try:
@@ -1475,27 +1463,38 @@ def _dp(s, val=None):
14751463
# those errors are handled by different warnings.
14761464
return
14771465

1478-
_dp("Data dump for __init__ call")
1466+
# Build the set of keyword arguments, checking for duplicate keywords,
1467+
# and count the positional arguments.
14791468
call_site = astroid.arguments.CallSite.from_call(node)
1480-
_dp("call_site", call_site)
1481-
# _dp("call_site args", call_site.arguments)
1482-
# _dp("call site positional args:", call_site.positional_arguments)
1483-
# _dp("call site keyword args:", call_site.keyword_arguments)
1484-
# _dp("call site invalid args", call_site.has_invalid_arguments())
1485-
# _dp("call site inv keywords", call_site.has_invalid_keywords())
1486-
_dp("node args", node.args)
1487-
_dp("node frame", node.frame())
1488-
# _dp("isinst", isinstance(node.frame(), nodes.ClassDef))
1489-
# _dp("funcdef", isinstance(called, nodes.FunctionDef))
1490-
_dp("called", called)
1491-
_dp(
1492-
"bound method init in called",
1493-
"BoundMethod __init__ of builtins.object" in str(called),
1494-
)
1495-
_dp("called.args", called.args)
1496-
_dp("frame body", node.frame().body)
1497-
# _dp("called in frame body", called in node.frame().body)
1498-
# _dp("dec names", called.decoratornames())
1469+
1470+
### Debug cruft used during dev, will remove when done.
1471+
### def _dp(s, val=None):
1472+
### return
1473+
### ## if "Attribute.__init__" not in str(node):
1474+
### ## return
1475+
### ## if val is None:
1476+
### ## print(f" {s}", flush=True)
1477+
### ## else:
1478+
### ## print(f" {s}: {val}", flush=True)
1479+
### _dp("-" * 25)
1480+
### _dp("visit call, node", node)
1481+
### _dp("Data dump for __init__ call")
1482+
### _dp("call_site", call_site)
1483+
### _dp("call_site args", call_site.arguments)
1484+
### _dp("call site positional args:", call_site.positional_arguments)
1485+
### _dp("call site keyword args:", call_site.keyword_arguments)
1486+
### _dp("call site invalid args", call_site.has_invalid_arguments())
1487+
### _dp("call site inv keywords", call_site.has_invalid_keywords())
1488+
### _dp("node args", node.args)
1489+
### _dp("node frame", node.frame())
1490+
### _dp("isinst", isinstance(node.frame(), nodes.ClassDef))
1491+
### _dp("funcdef", isinstance(called, nodes.FunctionDef))
1492+
### _dp("called", called)
1493+
### _dp("bound method init in called", "BoundMethod __init__ of builtins.object" in str(called))
1494+
### _dp("called.args", called.args)
1495+
### _dp("frame body", node.frame().body)
1496+
### _dp("called in frame body", called in node.frame().body)
1497+
### _dp("dec names", called.decoratornames())
14991498

15001499
def _call_site_has_args(cs):
15011500
"""True if any args passed."""
@@ -1527,10 +1526,6 @@ def _call_site_has_args(cs):
15271526
# make sense of the function call in this case, so just return.
15281527
return
15291528

1530-
# Build the set of keyword arguments, checking for duplicate keywords,
1531-
# and count the positional arguments.
1532-
call_site = astroid.arguments.CallSite.from_call(node)
1533-
15341529
# Warn about duplicated keyword arguments, such as `f=24, **{'f': 24}`
15351530
for keyword in call_site.duplicated_keywords:
15361531
self.add_message("repeated-keyword", node=node, args=(keyword,))

0 commit comments

Comments
 (0)