From 81221c409165e4fcf74f66264c6eac52ff827f26 Mon Sep 17 00:00:00 2001 From: anjakefala Date: Fri, 1 Dec 2023 21:35:26 -0800 Subject: [PATCH] [settings perf-] Cache sheet obj instead of name in _mappings Sheet names can change between creations of the cache. d362033473d8f619b418ea7d2fbd113fd0ef8277 --- visidata/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/visidata/settings.py b/visidata/settings.py index de7a7baf5..141c6a98b 100644 --- a/visidata/settings.py +++ b/visidata/settings.py @@ -73,7 +73,7 @@ def _mappings(self, obj): ''' mappings = [] if obj: - mappings += [self.objname(obj)] + mappings += [obj] mappings += [self.objname(cls) for cls in inspect.getmro(type(obj))] mappings += ['global', 'default'] @@ -83,7 +83,7 @@ def _get(self, key, obj=None): d = self.get(key, None) if d: for m in self._mappings(obj or vd.activeSheet): - v = d.get(m) + v = d.get(self.objname(m)) if v: return v @@ -93,6 +93,7 @@ def iter(self, obj=None): obj = vd.activeSheet for o in self._mappings(obj): + o = self.objname(o) for k in self.keys(): for o2 in self[k]: if o == o2: