@@ -86,15 +86,6 @@ def infer_end(
86
86
yield self
87
87
88
88
89
- # We add ignores to all assignments to methods
90
- # See https://github.com/python/mypy/issues/2427
91
- nodes .Module ._infer = infer_end
92
- nodes .ClassDef ._infer = infer_end
93
- nodes .Lambda ._infer = infer_end # type: ignore[assignment]
94
- nodes .Const ._infer = infer_end # type: ignore[assignment]
95
- nodes .Slice ._infer = infer_end # type: ignore[assignment]
96
-
97
-
98
89
def _infer_sequence_helper (
99
90
node : _BaseContainerT , context : InferenceContext | None = None
100
91
) -> list [SuccessfulInferenceResult ]:
@@ -140,11 +131,6 @@ def infer_sequence(
140
131
yield self
141
132
142
133
143
- nodes .List ._infer = infer_sequence # type: ignore[assignment]
144
- nodes .Tuple ._infer = infer_sequence # type: ignore[assignment]
145
- nodes .Set ._infer = infer_sequence # type: ignore[assignment]
146
-
147
-
148
134
def infer_map (
149
135
self : nodes .Dict , context : InferenceContext | None = None
150
136
) -> Iterator [nodes .Dict ]:
@@ -207,9 +193,6 @@ def _infer_map(
207
193
return values
208
194
209
195
210
- nodes .Dict ._infer = infer_map # type: ignore[assignment]
211
-
212
-
213
196
def _higher_function_scope (node : nodes .NodeNG ) -> nodes .FunctionDef | None :
214
197
"""Search for the first function which encloses the given
215
198
scope. This can be used for looking up in that function's
@@ -255,6 +238,8 @@ def infer_name(
255
238
return bases ._infer_stmts (stmts , context , frame )
256
239
257
240
241
+ # The order of the decorators here is important
242
+ # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
258
243
@decorators .raise_if_nothing_inferred
259
244
@decorators .path_wrapper
260
245
def _infer_name (
@@ -265,12 +250,6 @@ def _infer_name(
265
250
return infer_name (self , context , ** kwargs )
266
251
267
252
268
- # pylint: disable=no-value-for-parameter
269
- # The order of the decorators here is important
270
- # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
271
- nodes .Name ._infer = decorators .raise_if_nothing_inferred (
272
- decorators .path_wrapper (infer_name )
273
- )
274
253
nodes .AssignName .infer_lhs = infer_name # won't work with a path wrapper
275
254
276
255
@@ -300,9 +279,6 @@ def infer_call(
300
279
return InferenceErrorInfo (node = self , context = context )
301
280
302
281
303
- nodes .Call ._infer = infer_call # type: ignore[assignment]
304
-
305
-
306
282
@decorators .raise_if_nothing_inferred
307
283
@decorators .path_wrapper
308
284
def infer_import (
@@ -326,9 +302,6 @@ def infer_import(
326
302
raise InferenceError (node = self , context = context ) from exc
327
303
328
304
329
- nodes .Import ._infer = infer_import
330
-
331
-
332
305
@decorators .raise_if_nothing_inferred
333
306
@decorators .path_wrapper
334
307
def infer_import_from (
@@ -364,9 +337,6 @@ def infer_import_from(
364
337
) from error
365
338
366
339
367
- nodes .ImportFrom ._infer = infer_import_from # type: ignore[assignment]
368
-
369
-
370
340
def infer_attribute (
371
341
self : nodes .Attribute | nodes .AssignAttr ,
372
342
context : InferenceContext | None = None ,
@@ -399,6 +369,8 @@ def infer_attribute(
399
369
return InferenceErrorInfo (node = self , context = context )
400
370
401
371
372
+ # The order of the decorators here is important
373
+ # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
402
374
@decorators .raise_if_nothing_inferred
403
375
@decorators .path_wrapper
404
376
def _infer_attribute (
@@ -409,11 +381,6 @@ def _infer_attribute(
409
381
return infer_attribute (self , context , ** kwargs )
410
382
411
383
412
- # The order of the decorators here is important
413
- # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
414
- nodes .Attribute ._infer = decorators .raise_if_nothing_inferred (
415
- decorators .path_wrapper (infer_attribute )
416
- )
417
384
# won't work with a path wrapper
418
385
nodes .AssignAttr .infer_lhs = decorators .raise_if_nothing_inferred (infer_attribute )
419
386
@@ -433,9 +400,6 @@ def infer_global(
433
400
) from error
434
401
435
402
436
- nodes .Global ._infer = infer_global # type: ignore[assignment]
437
-
438
-
439
403
_SUBSCRIPT_SENTINEL = object ()
440
404
441
405
@@ -498,6 +462,8 @@ def infer_subscript(
498
462
return None
499
463
500
464
465
+ # The order of the decorators here is important
466
+ # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
501
467
@decorators .raise_if_nothing_inferred
502
468
@decorators .path_wrapper
503
469
def _infer_subscript (
@@ -506,11 +472,6 @@ def _infer_subscript(
506
472
return infer_subscript (self , context = context , ** kwargs )
507
473
508
474
509
- # The order of the decorators here is important
510
- # See https://github.com/pylint-dev/astroid/commit/0a8a75db30da060a24922e05048bc270230f5
511
- nodes .Subscript ._infer = decorators .raise_if_nothing_inferred ( # type: ignore[assignment]
512
- decorators .path_wrapper (infer_subscript )
513
- )
514
475
nodes .Subscript .infer_lhs = decorators .raise_if_nothing_inferred (infer_subscript )
515
476
516
477
@@ -569,9 +530,6 @@ def _infer_boolop(
569
530
return InferenceErrorInfo (node = self , context = context )
570
531
571
532
572
- nodes .BoolOp ._infer = _infer_boolop
573
-
574
-
575
533
# UnaryOp, BinOp and AugAssign inferences
576
534
577
535
@@ -668,7 +626,6 @@ def infer_unaryop(
668
626
669
627
670
628
nodes .UnaryOp ._infer_unaryop = _infer_unaryop
671
- nodes .UnaryOp ._infer = infer_unaryop
672
629
673
630
674
631
def _is_not_implemented (const ) -> bool :
@@ -1020,7 +977,6 @@ def infer_binop(
1020
977
1021
978
1022
979
nodes .BinOp ._infer_binop = _infer_binop
1023
- nodes .BinOp ._infer = infer_binop
1024
980
1025
981
COMPARE_OPS : dict [str , Callable [[Any , Any ], bool ]] = {
1026
982
"==" : operator .eq ,
@@ -1118,9 +1074,6 @@ def _infer_compare(
1118
1074
yield nodes .Const (retval )
1119
1075
1120
1076
1121
- nodes .Compare ._infer = _infer_compare # type: ignore[assignment]
1122
-
1123
-
1124
1077
def _infer_augassign (
1125
1078
self : nodes .AugAssign , context : InferenceContext | None = None
1126
1079
) -> Generator [InferenceResult | util .BadBinaryOperationMessage , None , None ]:
@@ -1160,7 +1113,6 @@ def infer_augassign(
1160
1113
1161
1114
1162
1115
nodes .AugAssign ._infer_augassign = _infer_augassign
1163
- nodes .AugAssign ._infer = infer_augassign
1164
1116
1165
1117
# End of binary operation inference.
1166
1118
@@ -1174,9 +1126,6 @@ def infer_arguments(
1174
1126
return protocols ._arguments_infer_argname (self , context .lookupname , context )
1175
1127
1176
1128
1177
- nodes .Arguments ._infer = infer_arguments # type: ignore[assignment]
1178
-
1179
-
1180
1129
@decorators .raise_if_nothing_inferred
1181
1130
@decorators .path_wrapper
1182
1131
def infer_assign (
@@ -1194,10 +1143,6 @@ def infer_assign(
1194
1143
return bases ._infer_stmts (stmts , context )
1195
1144
1196
1145
1197
- nodes .AssignName ._infer = infer_assign
1198
- nodes .AssignAttr ._infer = infer_assign
1199
-
1200
-
1201
1146
@decorators .raise_if_nothing_inferred
1202
1147
@decorators .path_wrapper
1203
1148
def infer_empty_node (
@@ -1214,9 +1159,6 @@ def infer_empty_node(
1214
1159
yield util .Uninferable
1215
1160
1216
1161
1217
- nodes .EmptyNode ._infer = infer_empty_node # type: ignore[assignment]
1218
-
1219
-
1220
1162
def _populate_context_lookup (call : nodes .Call , context : InferenceContext | None ):
1221
1163
# Allows context to be saved for later
1222
1164
# for inference inside a function
@@ -1269,9 +1211,6 @@ def infer_ifexp(
1269
1211
yield from self .orelse .infer (context = rhs_context )
1270
1212
1271
1213
1272
- nodes .IfExp ._infer = infer_ifexp # type: ignore[assignment]
1273
-
1274
-
1275
1214
def infer_functiondef (
1276
1215
self : _FunctionDefT , context : InferenceContext | None = None , ** kwargs : Any
1277
1216
) -> Generator [Property | _FunctionDefT , None , InferenceErrorInfo ]:
@@ -1306,9 +1245,6 @@ def infer_functiondef(
1306
1245
return InferenceErrorInfo (node = self , context = context )
1307
1246
1308
1247
1309
- nodes .FunctionDef ._infer = infer_functiondef
1310
-
1311
-
1312
1248
# pylint: disable-next=too-many-return-statements
1313
1249
def _infer_node (
1314
1250
node : nodes .NodeNG , context : InferenceContext | None = None , ** kwargs : Any
0 commit comments