mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-02-06 06:55:00 +00:00
Update base.py
This commit is contained in:
parent
0b94de24e9
commit
2d2e54cd2d
10
base.py
10
base.py
|
@ -7,7 +7,7 @@
|
|||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||
# https://github.com/gnh1201/caterpillar
|
||||
# Created at: 2024-05-20
|
||||
# Updated at: 2024-07-06
|
||||
# Updated at: 2024-07-09
|
||||
#
|
||||
|
||||
import hashlib
|
||||
|
@ -72,13 +72,17 @@ class Extension():
|
|||
cls.buffer_size = _buffer_size
|
||||
|
||||
@classmethod
|
||||
def register(cls, module_path, class_name):
|
||||
def register(cls, s)
|
||||
module_name = s.split('.')[0]
|
||||
module_path = 'plugins.' + module_name
|
||||
class_name = s.split('.')[-1]
|
||||
|
||||
try:
|
||||
module = importlib.import_module(module_path)
|
||||
_class = getattr(module, class_name)
|
||||
cls.extensions.append(_class())
|
||||
except (ImportError, AttributeError) as e:
|
||||
raise ImportError(class_name + " in " + module_path)
|
||||
raise ImportError(class_name + " in the extension " + module_name)
|
||||
|
||||
@classmethod
|
||||
def get_filters(cls):
|
||||
|
|
Loading…
Reference in New Issue
Block a user