From e041feb7161dd256e14ae83302e08181aac1d7d1 Mon Sep 17 00:00:00 2001 From: S0AndS0 Date: Thu, 17 Oct 2024 16:47:08 -0700 Subject: [PATCH] Attempt to address #119 > Note: I'm not yet savvy enough with the source to sort-out why > `self.locals.get` is returning `None` instead of an empty string. > > But this seems to work well enough for me :shrug: --- vimdoc/block.py | 5 ++++- vimdoc/module.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vimdoc/block.py b/vimdoc/block.py index b02113b..84b8aa0 100644 --- a/vimdoc/block.py +++ b/vimdoc/block.py @@ -254,7 +254,10 @@ def FullName(self): return '{}.{}'.format(self.locals['dict'], attribute) if 'exception' in self.locals: return 'ERROR({})'.format(self.locals['exception'] or self.LocalName()) - return self.locals.get('namespace', '') + self.LocalName() + if self.locals.get('namespace', '') is None: + print("Warning: skipping None returned by -> `self.locals.get('namespace', '')` for ->", self.LocalName()) + else: + return self.locals.get('namespace', '') + self.LocalName() return self.LocalName() def TagName(self): diff --git a/vimdoc/module.py b/vimdoc/module.py index c11b829..f843c2a 100644 --- a/vimdoc/module.py +++ b/vimdoc/module.py @@ -99,8 +99,11 @@ def GetCollection(self, typ): # Sort by namespace, but preserve order within the same namespace. This # lets us avoid variability in the order files are traversed without # losing all useful order information. - collection = sorted(collection, - key=lambda x: x.locals.get('namespace', '')) + try: + collection = sorted(collection, + key=lambda x: x.locals.get('namespace', '')) + except TypeError as e: + print('Module.GetCollection failed sorting collection ->', collection) elif typ == vimdoc.DICTIONARY: collection = sorted(collection) non_default_names = set(x.TagName() for x in collection