File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,11 +33,13 @@ def to_property_value(py_val: PyValue) -> Any:
3333 pv .string_value = py_val
3434 elif isinstance (py_val , bytes ):
3535 pv .bytes_value = py_val
36- elif isinstance (py_val , ( list , tuple ) ):
36+ elif isinstance (py_val , list | tuple ):
3737 # Homogeneous float list → Vector; mixed/str list → PropertyList.
3838 # bool is a subclass of int, so exclude it explicitly — [True, False] must
3939 # not be serialised as a Vector of 1.0/0.0 but as a PropertyList.
40- if py_val and all (isinstance (v , (int , float )) and not isinstance (v , bool ) for v in py_val ):
40+ # list | tuple union syntax is valid in isinstance() for Python ≥3.10 (PEP 604).
41+ # This project targets Python ≥3.11 (pyproject.toml: requires-python = ">=3.11").
42+ if py_val and all (isinstance (v , int | float ) and not isinstance (v , bool ) for v in py_val ):
4143 vec = Vector (values = [float (v ) for v in py_val ])
4244 pv .vector_value .CopyFrom (vec )
4345 else :
You can’t perform that action at this time.
0 commit comments