def _clean_names(cls):
'''
Remove indices from non-repeated peeker names that don't need them.
When created, all peekers get an index appended to their name to
disambiguate any repeated names. If the name isn't actually repeated,
then the index is removed.
'''
index_re = '\[\d+\]$'
for name, peeker in cls._peekers.items():
if not peeker.name_dup:
new_name = re.sub(index_re, '', name)
if new_name != name:
peeker.trace.name = new_name
cls._peekers[new_name] = cls._peekers.pop(name)
评论列表
文章目录