fix: lookup types with globalns
This commit is contained in:
parent
8b9848cdfb
commit
757be795c3
3 changed files with 4 additions and 4 deletions
|
@ -42,7 +42,7 @@ def main():
|
||||||
|
|
||||||
for addon in addons:
|
for addon in addons:
|
||||||
help_text += f"\n {addon.__name__} \t{addon.__doc__ or ''}"
|
help_text += f"\n {addon.__name__} \t{addon.__doc__ or ''}"
|
||||||
cfg_clazz = get_type_hints(addon)['config']
|
cfg_clazz = get_type_hints(addon, globalns=globals())['config']
|
||||||
if cfg_clazz is ConfigObject:
|
if cfg_clazz is ConfigObject:
|
||||||
continue # it's the superclass type hint
|
continue # it's the superclass type hint
|
||||||
for field in fields(cfg_clazz):
|
for field in fields(cfg_clazz):
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Addon:
|
||||||
self.name = type(self).__name__
|
self.name = type(self).__name__
|
||||||
cfg = self._client.config
|
cfg = self._client.config
|
||||||
opts: Dict[str, Any] = {}
|
opts: Dict[str, Any] = {}
|
||||||
cfg_clazz = get_type_hints(type(self))['config']
|
cfg_clazz = get_type_hints(type(self), globalns=globals())['config']
|
||||||
if cfg_clazz is not ConfigObject:
|
if cfg_clazz is not ConfigObject:
|
||||||
for field in fields(cfg_clazz):
|
for field in fields(cfg_clazz):
|
||||||
default = field.default if field.default is not MISSING \
|
default = field.default if field.default is not MISSING \
|
||||||
|
|
|
@ -84,6 +84,8 @@ class Treepuncher(
|
||||||
code= opt('code'),
|
code= opt('code'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
super().__init__(opt('server', required=True), online_mode=online_mode, authenticator=authenticator)
|
||||||
|
|
||||||
self.storage = Storage(self.name)
|
self.storage = Storage(self.name)
|
||||||
|
|
||||||
self.notifier = Notifier(self)
|
self.notifier = Notifier(self)
|
||||||
|
@ -95,8 +97,6 @@ class Treepuncher(
|
||||||
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy
|
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy
|
||||||
self.scheduler.start(paused=True)
|
self.scheduler.start(paused=True)
|
||||||
|
|
||||||
super().__init__(opt('server', required=True), online_mode=online_mode, authenticator=authenticator)
|
|
||||||
|
|
||||||
prev = self.storage.system() # if this isn't 1st time, this won't be None. Load token from there
|
prev = self.storage.system() # if this isn't 1st time, this won't be None. Load token from there
|
||||||
state = SystemState(self.name, __VERSION__, 0)
|
state = SystemState(self.name, __VERSION__, 0)
|
||||||
if prev:
|
if prev:
|
||||||
|
|
Loading…
Reference in a new issue