Skip to content

Commit 9c203ab

Browse files
committed
when finding out object names, only use names starting with _ if there are only such names
1 parent 469959d commit 9c203ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

larray_editor/api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def find_names(obj, depth=0):
3535
"""
3636
# noinspection PyProtectedMember
3737
l = sys._getframe(depth + 1).f_locals
38-
return sorted(k for k, v in l.items() if v is obj)
38+
names = [k for k, v in l.items() if v is obj]
39+
if any(not name.startswith('_') for name in names):
40+
names = [name for name in names if not name.startswith('_')]
41+
return sorted(names)
3942

4043

4144
def get_title(obj, depth=0, maxnames=3):
@@ -335,6 +338,10 @@ def restore_display_hook():
335338
# file = abspath('test_session.xlsx')
336339
# ses.save(file)
337340

341+
# import cProfile as profile
342+
# profile.runctx('edit(la.Session(arr2=arr2))', vars(), {},
343+
# 'c:\\tmp\\edit.profile')
344+
338345
edit(ses)
339346
# edit(ses)
340347
# edit(file)

0 commit comments

Comments
 (0)