@@ -2251,7 +2251,7 @@ def _check_docstring(
2251
2251
func .bound , astroid .Instance
2252
2252
):
2253
2253
# Strings.
2254
- if func .bound .name in ( "str" , "unicode" , "bytes" ) :
2254
+ if func .bound .name in { "str" , "unicode" , "bytes" } :
2255
2255
return
2256
2256
if node_type == "module" :
2257
2257
message = "missing-module-docstring"
@@ -2386,7 +2386,7 @@ def _is_singleton_const(node) -> bool:
2386
2386
2387
2387
# True/False singletons have a special-cased message in case the user is
2388
2388
# mistakenly using == or != to check for truthiness
2389
- if singleton in ( True , False ) :
2389
+ if singleton in { True , False } :
2390
2390
suggestion_template = (
2391
2391
"{} if checking for the singleton value {}, or {} if testing for {}"
2392
2392
)
@@ -2440,7 +2440,7 @@ def _is_float_nan(node):
2440
2440
def _is_numpy_nan (node ):
2441
2441
if isinstance (node , nodes .Attribute ) and node .attrname == "NaN" :
2442
2442
if isinstance (node .expr , nodes .Name ):
2443
- return node .expr .name in ( "numpy" , "nmp" , "np" )
2443
+ return node .expr .name in { "numpy" , "nmp" , "np" }
2444
2444
return False
2445
2445
2446
2446
def _is_nan (node ) -> bool :
@@ -2540,16 +2540,16 @@ def visit_compare(self, node: nodes.Compare) -> None:
2540
2540
left = node .left
2541
2541
operator , right = node .ops [0 ]
2542
2542
2543
- if operator in ( "==" , "!=" ) :
2543
+ if operator in { "==" , "!=" } :
2544
2544
self ._check_singleton_comparison (
2545
2545
left , right , node , checking_for_absence = operator == "!="
2546
2546
)
2547
2547
2548
- if operator in ( "==" , "!=" , "is" , "is not" ) :
2548
+ if operator in { "==" , "!=" , "is" , "is not" } :
2549
2549
self ._check_nan_comparison (
2550
- left , right , node , checking_for_absence = operator in ( "!=" , "is not" )
2550
+ left , right , node , checking_for_absence = operator in { "!=" , "is not" }
2551
2551
)
2552
- if operator in ( "is" , "is not" ) :
2552
+ if operator in { "is" , "is not" } :
2553
2553
self ._check_literal_comparison (right , node )
2554
2554
2555
2555
def _check_unidiomatic_typecheck (self , node ):
@@ -2567,7 +2567,7 @@ def _check_type_x_is_y(self, node, left, operator, right):
2567
2567
):
2568
2568
return
2569
2569
2570
- if operator in ( "is" , "is not" ) and _is_one_arg_pos_call (right ):
2570
+ if operator in { "is" , "is not" } and _is_one_arg_pos_call (right ):
2571
2571
right_func = utils .safe_infer (right .func )
2572
2572
if (
2573
2573
isinstance (right_func , nodes .ClassDef )
0 commit comments