Skip to content

Commit fc425e7

Browse files
committed
Vector3Array validation no longer iterates through numpy arrays
1 parent 37166db commit fc425e7

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

properties/math.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,16 @@ def validate(self, instance, value):
418418
"""
419419
if not isinstance(value, (tuple, list, np.ndarray)):
420420
self.error(instance, value)
421-
for i, val in enumerate(value):
422-
if isinstance(val, string_types):
423-
if val.upper() not in VECTOR_DIRECTIONS:
424-
self.error(
425-
instance=instance,
426-
value=val,
427-
extra='This is an invalid Vector3 representation.',
428-
)
429-
value[i] = VECTOR_DIRECTIONS[val.upper()]
421+
if isinstance(value, (tuple, list)):
422+
for i, val in enumerate(value):
423+
if isinstance(val, string_types):
424+
if val.upper() not in VECTOR_DIRECTIONS:
425+
self.error(
426+
instance=instance,
427+
value=val,
428+
extra='This is an invalid Vector3 representation.',
429+
)
430+
value[i] = VECTOR_DIRECTIONS[val.upper()]
430431

431432
return super(Vector3Array, self).validate(instance, value)
432433

0 commit comments

Comments
 (0)