Add new api, new deps system

This commit is contained in:
hhh
2024-02-11 16:21:38 +02:00
parent 9cea034fc3
commit 4ee43ffd9b
5 changed files with 14 additions and 5 deletions

2
.gitignore vendored
View File

@@ -3,4 +3,4 @@
poetry.lock poetry.lock
*/__pycache__/ **/__pycache__/

View File

@@ -2,7 +2,8 @@ from .neko.interfaces import (
inject_module, inject_module,
inject_modules, inject_modules,
inject_object, inject_object,
get_injected_object get_injected_objects,
get_injected_object,
) )
@@ -10,5 +11,6 @@ __all__ = [
'inject_module', 'inject_module',
'inject_modules', 'inject_modules',
'inject_object', 'inject_object',
'get_injected_objects',
'get_injected_object' 'get_injected_object'
] ]

View File

@@ -17,10 +17,14 @@ def inject_object(*objects) -> None:
continue continue
def get_injected_object(*objects: Type[T]) -> Iterable[T]: def get_injected_objects(*objects: Type[T]) -> Iterable[T]:
return [apply_replace(obj) for obj in objects] return [apply_replace(obj) for obj in objects]
def get_injected_object(obj: Type[T]) -> T:
return apply_replace(obj)
def inject_module(mod: ModuleType) -> None: def inject_module(mod: ModuleType) -> None:
try: try:
inject_object(*getattr(mod, '__replacements__')) inject_object(*getattr(mod, '__replacements__'))

View File

@@ -2,6 +2,7 @@ from ..modules.variants import (
inject_module, inject_module,
inject_modules, inject_modules,
inject_object, inject_object,
get_injected_objects,
get_injected_object get_injected_object
) )
@@ -10,5 +11,6 @@ __all__ = [
'inject_module', 'inject_module',
'inject_modules', 'inject_modules',
'inject_object', 'inject_object',
'get_injected_objects',
'get_injected_object' 'get_injected_object'
] ]

View File

@@ -7,8 +7,9 @@ readme = "README.md"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.11" python = "^3.11"
neko-configparser = {git="https://github.com/nekomatad/neko-configparser"}
#neko-configparser = {path = "../neko-configparser", develop = true} [tool.poetry.group.neko.dependencies]
neko-configparser = {path = "../neko-configparser", develop = true}
[build-system] [build-system]