mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 18:01:07 +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>
|
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||||
# https://github.com/gnh1201/caterpillar
|
# https://github.com/gnh1201/caterpillar
|
||||||
# Created at: 2024-05-20
|
# Created at: 2024-05-20
|
||||||
# Updated at: 2024-07-06
|
# Updated at: 2024-07-09
|
||||||
#
|
#
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -72,13 +72,17 @@ class Extension():
|
||||||
cls.buffer_size = _buffer_size
|
cls.buffer_size = _buffer_size
|
||||||
|
|
||||||
@classmethod
|
@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:
|
try:
|
||||||
module = importlib.import_module(module_path)
|
module = importlib.import_module(module_path)
|
||||||
_class = getattr(module, class_name)
|
_class = getattr(module, class_name)
|
||||||
cls.extensions.append(_class())
|
cls.extensions.append(_class())
|
||||||
except (ImportError, AttributeError) as e:
|
except (ImportError, AttributeError) as e:
|
||||||
raise ImportError(class_name + " in " + module_path)
|
raise ImportError(class_name + " in the extension " + module_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_filters(cls):
|
def get_filters(cls):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user