File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -284,19 +284,19 @@ def _to_value_pattern(
284284 explicitly write this as:
285285 ::
286286 z = op.Add(x, op.Constant(0))
287-
287+
288288 If a callable is provided, it will be converted to a ValuePattern with the callable as the check attribute.
289289 """
290290 if x is None or isinstance (x , ValuePattern ):
291291 return x
292- if callable (x ):
293- return ValuePattern (None , check = x )
294292 if isinstance (x , (int , float )):
295293 return Constant (x )
296294 if isinstance (x , Sequence ):
297295 if all (isinstance (i , (int , float )) for i in x ):
298296 return Constant (x )
299297 raise ValueError ("Only lists of int/float can be used as a ValuePattern" )
298+ if callable (x ):
299+ return ValuePattern (None , check = x )
300300
301301 raise TypeError (f"Cannot convert { type (x )} to ValuePattern" )
302302
You can’t perform that action at this time.
0 commit comments