Improve consistency of ndarray members

This commit is contained in:
Jan Petykiewicz 2020-05-11 18:49:30 -07:00
commit fa8fc52dd6
6 changed files with 9 additions and 9 deletions

View file

@ -98,7 +98,7 @@ class Path(Shape):
@vertices.setter
def vertices(self, val: numpy.ndarray):
val = numpy.array(val, dtype=float)
val = numpy.array(val, dtype=float) #TODO document that these might not be copied
if len(val.shape) < 2 or val.shape[1] != 2:
raise PatternError('Vertices must be an Nx2 array')
if val.shape[0] < 2:

View file

@ -30,7 +30,7 @@ class Polygon(Shape):
@vertices.setter
def vertices(self, val: numpy.ndarray):
val = numpy.array(val, dtype=float)
val = numpy.array(val, dtype=float) #TODO document that these might not be copied
if len(val.shape) < 2 or val.shape[1] != 2:
raise PatternError('Vertices must be an Nx2 array')
if val.shape[0] < 3:

View file

@ -64,7 +64,7 @@ class Text(Shape):
def mirrored(self, val: List[bool]):
if is_scalar(val):
raise PatternError('Mirrored must be a 2-element list of booleans')
self._mirrored = list(val)
self._mirrored = numpy.ndarray(val, dtype=bool, copy=True)
def __init__(self,
string: str,