else:
return None
+def remove_underscore(s):
+ if len(s) > 2 and s[0] == "_" and s[1] != "_":
+ s = s[1:]
+ return s
+
name_to_idx = defaultdict(int)
classname_to_objs = dict()
if varname is None:
varname = get_var_name(frame)
if varname is not None:
+ varname = remove_underscore(varname)
l.insert(0, (varname, name_to_idx[varname]))
name_to_idx[varname] += 1
modules = frame.f_globals["__name__"]
modules = modules.split(".")
coname = modules[len(modules)-1]
+ coname = remove_underscore(coname)
l.insert(0, (coname, name_to_idx[coname]))
name_to_idx[coname] += 1
else:
except ValueError:
idx = len(objs)
objs.append(obj)
+ classname = remove_underscore(classname)
l.insert(0, (classname, idx))
varname = None