[Polygon.rect] raise a PatternError when given the wrong number of args
instead of assert
This commit is contained in:
parent
fd11df382c
commit
c93882e8b2
@ -256,6 +256,11 @@ class Polygon(Shape):
|
|||||||
Returns:
|
Returns:
|
||||||
A Polygon object containing the requested rectangle
|
A Polygon object containing the requested rectangle
|
||||||
"""
|
"""
|
||||||
|
if sum(int(pp is None) for pp in (xmin, xmax, xctr, lx)) != 2:
|
||||||
|
raise PatternError('Exactly two of xmin, xctr, xmax, lx must be provided!')
|
||||||
|
if sum(int(pp is None) for pp in (ymin, ymax, yctr, ly)) != 2:
|
||||||
|
raise PatternError('Exactly two of ymin, yctr, ymax, ly must be provided!')
|
||||||
|
|
||||||
if lx is None:
|
if lx is None:
|
||||||
if xctr is None:
|
if xctr is None:
|
||||||
assert xmin is not None
|
assert xmin is not None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user