@@ -68,14 +68,14 @@ def _filter(x):
68
68
"""
69
69
# Is `x` a container we can iterate on?
70
70
iter_on = None
71
- if isinstance (x , list ) or isinstance ( x , tuple ):
71
+ if isinstance (x , list | tuple ):
72
72
iter_on = x
73
73
elif isinstance (x , dict ):
74
74
iter_on = x .items ()
75
75
if iter_on is not None :
76
76
return all (_filter (y ) for y in iter_on )
77
77
else :
78
- return isinstance (x , Variable ) or isinstance ( x , until )
78
+ return isinstance (x , Variable | until )
79
79
80
80
if not _filter (ls ):
81
81
raise ValueError (
@@ -840,11 +840,7 @@ def wrap_into_list(x):
840
840
# add only the non-shared variables and non-constants to the arguments of
841
841
# the dummy function [ a function should not get shared variables or
842
842
# constants as input ]
843
- dummy_args = [
844
- arg
845
- for arg in args
846
- if (not isinstance (arg , SharedVariable ) and not isinstance (arg , Constant ))
847
- ]
843
+ dummy_args = [arg for arg in args if not isinstance (arg , SharedVariable | Constant )]
848
844
# when we apply the lambda expression we get a mixture of update rules
849
845
# and outputs that needs to be separated
850
846
@@ -1043,16 +1039,14 @@ def wrap_into_list(x):
1043
1039
other_inner_args = []
1044
1040
1045
1041
other_scan_args += [
1046
- arg
1047
- for arg in non_seqs
1048
- if (not isinstance (arg , SharedVariable ) and not isinstance (arg , Constant ))
1042
+ arg for arg in non_seqs if not isinstance (arg , SharedVariable | Constant )
1049
1043
]
1050
1044
1051
1045
# Step 5.6 all shared variables with no update rules
1052
1046
other_inner_args += [
1053
1047
safe_new (arg , "_copy" )
1054
1048
for arg in non_seqs
1055
- if ( not isinstance (arg , SharedVariable ) and not isinstance ( arg , Constant ) )
1049
+ if not isinstance (arg , SharedVariable | Constant )
1056
1050
]
1057
1051
1058
1052
inner_replacements .update (dict (zip (other_scan_args , other_inner_args )))
0 commit comments