forked from jan/fatamorgana
remove extra assignments to *_count and *_vector, and adjust validity checks
This commit is contained in:
parent
5ac774c386
commit
bc15a66ecc
@ -1206,25 +1206,20 @@ class GridRepetition:
|
|||||||
InvalidDataError: if `b_count` and `b_vector` inputs conflict
|
InvalidDataError: if `b_count` and `b_vector` inputs conflict
|
||||||
with each other or if `a_count < 1`.
|
with each other or if `a_count < 1`.
|
||||||
"""
|
"""
|
||||||
self.a_vector = a_vector
|
if b_vector is None or b_count is None:
|
||||||
self.b_vector = b_vector
|
if b_vector is not None or b_count is not None:
|
||||||
self.a_count = a_count
|
|
||||||
self.b_count = b_count
|
|
||||||
|
|
||||||
if self.b_vector is None or self.b_count is None:
|
|
||||||
if self.b_vector is not None or self.b_count is not None:
|
|
||||||
raise InvalidDataError('Repetition has only one of'
|
raise InvalidDataError('Repetition has only one of'
|
||||||
'b_vector and b_count')
|
'b_vector and b_count')
|
||||||
else:
|
else:
|
||||||
if self.b_count < 1:
|
if b_count < 1:
|
||||||
raise InvalidDataError('Repetition has too-small b_count')
|
raise InvalidDataError('Repetition has too-small b_count')
|
||||||
if self.b_count < 2:
|
if b_count < 2:
|
||||||
self.b_count = None
|
b_count = None
|
||||||
self.b_vector = None
|
b_vector = None
|
||||||
warnings.warn('Removed b_count and b_vector since b_count == 1')
|
warnings.warn('Removed b_count and b_vector since b_count == 1')
|
||||||
|
|
||||||
if self.a_count < 2:
|
if a_count < 2:
|
||||||
raise InvalidDataError('Repetition has too-small x-count: '
|
raise InvalidDataError('Repetition has too-small a_count: '
|
||||||
'{}'.format(a_count))
|
'{}'.format(a_count))
|
||||||
self.a_vector = a_vector
|
self.a_vector = a_vector
|
||||||
self.b_vector = b_vector
|
self.b_vector = b_vector
|
||||||
|
Loading…
Reference in New Issue
Block a user