split_suffix in RecurrentStack does not handle names with multiple # correctly
Closed this issue · 0 comments
rustonaut commented
Hy,
the "split_suffix" code:
@staticmethod
def split_suffix(name):
# Target name with suffix to the correct layer
name_level = name.split(RECURRENTSTACK_SEPARATOR)
if len(name_level) == 2 and name_level[-1].isdigit():
name = RECURRENTSTACK_SEPARATOR.join(name_level[:-1])
level = int(name_level[-1])
else:
# It must be from bottom layer
level = 0
return name, level
won't work correctly if the name hase more than one # ("#"==RECURRENTSTACK_SEPARATOR)
,
it will see that len(name_level)
is > 2 and set the level to 0 (but on the other hand it reconstructs the name in the first line of the if body as if it could have had a len > 2.
PS:
I will send in a fix using .rsplit(..., 1)
(split only one time first occurrence from right)