Commit b221f12d authored by Martin Reinecke's avatar Martin Reinecke
Browse files

better argument name

parent f07a6090
...@@ -76,16 +76,16 @@ def safe_cast(tfunc, val): ...@@ -76,16 +76,16 @@ def safe_cast(tfunc, val):
return tmp return tmp
def parse_spaces(spaces, maxidx): def parse_spaces(spaces, nspc):
maxidx = safe_cast(int, maxidx) nspc = safe_cast(int, nspc)
if spaces is None: if spaces is None:
return tuple(range(maxidx)) return tuple(range(nspc))
elif np.isscalar(spaces): elif np.isscalar(spaces):
spaces = (safe_cast(int, spaces),) spaces = (safe_cast(int, spaces),)
else: else:
spaces = tuple(safe_cast(int, item) for item in spaces) spaces = tuple(safe_cast(int, item) for item in spaces)
tmp = tuple(set(spaces)) tmp = tuple(set(spaces))
if tmp[0] < 0 or tmp[-1] >= maxidx: if tmp[0] < 0 or tmp[-1] >= nspc:
raise ValueError("space index out of range") raise ValueError("space index out of range")
if len(tmp) != len(spaces): if len(tmp) != len(spaces):
raise ValueError("multiply defined space indices") raise ValueError("multiply defined space indices")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment