From 7fca74144d14a85af70100ea7e6dd76cf5948eec Mon Sep 17 00:00:00 2001 From: Austin Appleby Date: Tue, 12 Mar 2024 14:19:39 -0700 Subject: [PATCH] Hack in a rule_dir field. Need to redo how config works... --- hancho.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hancho.py b/hancho.py index c888b74..77f3425 100755 --- a/hancho.py +++ b/hancho.py @@ -463,12 +463,16 @@ def __init__(self, **kwargs): super().__init__(self) self.base = None self |= kwargs + if config is not None and self.rule_dir is None: + self.rule_dir = relpath( + Path(inspect.stack(context=0)[1].filename).parent, self.root_dir + ) def __missing__(self, key): if self.base: # Why does this trigger pylint? return self.base[key] # pylint: disable=unsubscriptable-object - if id(self) != id(config): + if config is not None and id(self) != id(config): return config[key] return None @@ -566,7 +570,6 @@ async def run_async(self): if self.debug: log("") - ######################################## async def task_main(self):