@@ -1467,61 +1467,57 @@ def _dp(s, val=None):
1467
1467
_dp ("visit call, node" , node )
1468
1468
1469
1469
called = safe_infer (node .func , compare_constructors = True )
1470
- _dp ("a" )
1471
1470
self ._check_not_callable (node , called )
1472
- _dp ("b" )
1473
1471
try :
1474
- _dp ("c" )
1475
1472
called , implicit_args , callable_name = _determine_callable (called )
1476
- _dp ("d" )
1477
1473
except ValueError :
1478
1474
# Any error occurred during determining the function type, most of
1479
1475
# those errors are handled by different warnings.
1480
- _dp ("e" )
1481
1476
return
1482
1477
1483
- _dp ("f" )
1478
+ _dp ("Data dump for __init__ call" )
1479
+ call_site = astroid .arguments .CallSite .from_call (node )
1480
+ num_positional_args = len (call_site .positional_arguments )
1481
+ _dp ("node frame" , node .frame ())
1482
+ _dp ("isinst" , isinstance (node .frame (), nodes .ClassDef ))
1483
+ _dp ("funcdef" , isinstance (called , nodes .FunctionDef ))
1484
+ _dp ("called" , called )
1485
+ _dp ("frame body" , node .frame ().body )
1486
+ _dp ("called in frame body" , called in node .frame ().body )
1487
+ _dp ("npa" , num_positional_args )
1488
+ _dp ("dec names" , called .decoratornames ())
1489
+
1484
1490
if called .args .args is None :
1485
- _dp ("g " )
1491
+ _dp ("called.args.args is None " )
1486
1492
_dp ("called.name" , called .name )
1487
1493
if called .name == "isinstance" :
1488
1494
# Verify whether second argument of isinstance is a valid type
1489
- _dp ("h" )
1490
1495
self ._check_isinstance_args (node , callable_name )
1491
1496
# Built-in functions have no argument information.
1492
- _dp ("i " )
1497
+ _dp ("Returning now " )
1493
1498
return
1494
1499
1495
- _dp ("j" )
1496
1500
if len (called .argnames ()) != len (set (called .argnames ())):
1497
1501
# Duplicate parameter name (see duplicate-argument). We can't really
1498
1502
# make sense of the function call in this case, so just return.
1499
- _dp ("k" )
1500
1503
return
1501
1504
1502
1505
# Build the set of keyword arguments, checking for duplicate keywords,
1503
1506
# and count the positional arguments.
1504
- _dp ("L" )
1505
1507
call_site = astroid .arguments .CallSite .from_call (node )
1506
1508
1507
1509
# Warn about duplicated keyword arguments, such as `f=24, **{'f': 24}`
1508
- _dp ("m" )
1509
1510
for keyword in call_site .duplicated_keywords :
1510
- _dp ("N" )
1511
1511
self .add_message ("repeated-keyword" , node = node , args = (keyword ,))
1512
1512
1513
- _dp ("O" )
1514
1513
if call_site .has_invalid_arguments () or call_site .has_invalid_keywords ():
1515
1514
# Can't make sense of this.
1516
- _dp ("p" )
1517
1515
return
1518
1516
1519
1517
# Has the function signature changed in ways we cannot reliably detect?
1520
- _dp ("q" )
1521
1518
if hasattr (called , "decorators" ) and decorated_with (
1522
1519
called , self .linter .config .signature_mutators
1523
1520
):
1524
- _dp ("R" )
1525
1521
return
1526
1522
1527
1523
num_positional_args = len (call_site .positional_arguments )
@@ -1553,25 +1549,14 @@ def _dp(s, val=None):
1553
1549
# inside the class where the function is defined.
1554
1550
# This avoids emitting `too-many-function-args` since `num_positional_args`
1555
1551
# includes an implicit `self` argument which is not present in `called.args`.
1556
- _dp ("NOTE: about to dec" )
1557
- _dp ("node frame" , node .frame ())
1558
- _dp ("isinst" , isinstance (node .frame (), nodes .ClassDef ))
1559
- _dp ("funcdef" , isinstance (called , nodes .FunctionDef ))
1560
- _dp ("called" , called )
1561
- _dp ("frame body" , node .frame ().body )
1562
- _dp ("called in frame body" , called in node .frame ().body )
1563
- _dp ("npa" , num_positional_args )
1564
- _dp ("dec names" , called .decoratornames ())
1565
1552
if (
1566
1553
isinstance (node .frame (), nodes .ClassDef )
1567
1554
and isinstance (called , nodes .FunctionDef )
1568
1555
and called in node .frame ().body
1569
1556
and num_positional_args > 0
1570
1557
and "builtins.staticmethod" not in called .decoratornames ()
1571
1558
):
1572
- _dp ("NOTE: decrementing" )
1573
1559
num_positional_args -= 1
1574
- _dp ("NOTE: dec done" )
1575
1560
1576
1561
# Analyze the list of formal parameters.
1577
1562
args = list (itertools .chain (called .args .posonlyargs or (), called .args .args ))
0 commit comments