@@ -68,14 +68,14 @@ def _filter(x):
6868 """
6969 # Is `x` a container we can iterate on?
7070 iter_on = None
71- if isinstance (x , list ) or isinstance ( x , tuple ):
71+ if isinstance (x , list | tuple ):
7272 iter_on = x
7373 elif isinstance (x , dict ):
7474 iter_on = x .items ()
7575 if iter_on is not None :
7676 return all (_filter (y ) for y in iter_on )
7777 else :
78- return isinstance (x , Variable ) or isinstance ( x , until )
78+ return isinstance (x , Variable | until )
7979
8080 if not _filter (ls ):
8181 raise ValueError (
@@ -840,11 +840,7 @@ def wrap_into_list(x):
840840 # add only the non-shared variables and non-constants to the arguments of
841841 # the dummy function [ a function should not get shared variables or
842842 # 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 )]
848844 # when we apply the lambda expression we get a mixture of update rules
849845 # and outputs that needs to be separated
850846
@@ -1043,16 +1039,14 @@ def wrap_into_list(x):
10431039 other_inner_args = []
10441040
10451041 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 )
10491043 ]
10501044
10511045 # Step 5.6 all shared variables with no update rules
10521046 other_inner_args += [
10531047 safe_new (arg , "_copy" )
10541048 for arg in non_seqs
1055- if ( not isinstance (arg , SharedVariable ) and not isinstance ( arg , Constant ) )
1049+ if not isinstance (arg , SharedVariable | Constant )
10561050 ]
10571051
10581052 inner_replacements .update (dict (zip (other_scan_args , other_inner_args )))
0 commit comments