File tree 3 files changed +13
-16
lines changed
3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,8 @@ Release date: TBA
314
314
Closes #6597
315
315
316
316
* ``is_class_subscriptable_pep585_with_postponed_evaluation_enabled`` has been deprecated.
317
- Use ``subscriptable_with_postponed_evaluation_enabled`` instead.
317
+ Use ``is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node)``
318
+ instead.
318
319
319
320
Ref #6536
320
321
Original file line number Diff line number Diff line change @@ -215,7 +215,6 @@ Other Changes
215
215
216
216
* The ``set_config_directly `` decorator has been removed.
217
217
218
-
219
218
* Fix falsely issuing ``useless-suppression `` on the ``wrong-import-position `` checker.
220
219
221
220
Closes #5219
@@ -253,11 +252,6 @@ Other Changes
253
252
254
253
Closes #6597
255
254
256
- * ``is_class_subscriptable_pep585_with_postponed_evaluation_enabled `` has been deprecated.
257
- Use ``subscriptable_with_postponed_evaluation_enabled `` instead.
258
-
259
- Ref #6536
260
-
261
255
* The refactoring checker now also raises 'consider-using-a-generator' messages for
262
256
``max() ``, ``min() `` and ``sum() ``.
263
257
@@ -371,3 +365,9 @@ Deprecations
371
365
be removed in a future release.
372
366
373
367
Ref #5392
368
+
369
+ * ``is_class_subscriptable_pep585_with_postponed_evaluation_enabled `` has been deprecated.
370
+ Use ``is_postponed_evaluation_enabled(node) and is_node_in_type_annotation_context(node) ``
371
+ instead.
372
+
373
+ Ref #6536
Original file line number Diff line number Diff line change @@ -1217,7 +1217,9 @@ def supports_getitem(value: nodes.NodeNG, node: nodes.NodeNG) -> bool:
1217
1217
if isinstance (value , nodes .ClassDef ):
1218
1218
if _supports_protocol_method (value , CLASS_GETITEM_METHOD ):
1219
1219
return True
1220
- if subscriptable_with_postponed_evaluation_enabled (node ):
1220
+ if is_postponed_evaluation_enabled (node ) and is_node_in_type_annotation_context (
1221
+ node
1222
+ ):
1221
1223
return True
1222
1224
return _supports_protocol (value , _supports_getitem_protocol )
1223
1225
@@ -1405,7 +1407,8 @@ def is_class_subscriptable_pep585_with_postponed_evaluation_enabled(
1405
1407
warnings .warn (
1406
1408
"'is_class_subscriptable_pep585_with_postponed_evaluation_enabled' has been "
1407
1409
"deprecated and will be removed in pylint 3.0. "
1408
- "Use 'subscriptable_with_postponed_evaluation_enabled' instead." ,
1410
+ "Use 'is_postponed_evaluation_enabled(node) and "
1411
+ "is_node_in_type_annotation_context(node)' instead." ,
1409
1412
DeprecationWarning ,
1410
1413
)
1411
1414
return (
@@ -1415,13 +1418,6 @@ def is_class_subscriptable_pep585_with_postponed_evaluation_enabled(
1415
1418
)
1416
1419
1417
1420
1418
- def subscriptable_with_postponed_evaluation_enabled (node : nodes .NodeNG ) -> bool :
1419
- """Check if class can be subscriptable in type annotation context."""
1420
- return is_postponed_evaluation_enabled (node ) and is_node_in_type_annotation_context (
1421
- node
1422
- )
1423
-
1424
-
1425
1421
def is_node_in_type_annotation_context (node : nodes .NodeNG ) -> bool :
1426
1422
"""Check if node is in type annotation context.
1427
1423
You can’t perform that action at this time.
0 commit comments