Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions injection/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ def __str__(self) -> str:
class Injectable(Protocol[_T]):
__slots__ = ()

def __init__(self, __factory: Callable[[], _T] = ..., /): ...
def __init__(self, __factory: Callable[[], _T] = None, /):
pass

@property
def is_locked(self) -> bool:
return False

def unlock(self): ...
def unlock(self):
pass

@abstractmethod
def get_instance(self) -> _T:
Expand Down Expand Up @@ -626,7 +628,8 @@ def update(self, module: Module):
return self

@singledispatchmethod
def on_event(self, event: Event, /): ...
def on_event(self, event: Event, /):
pass

@on_event.register
@contextmanager
Expand Down
8 changes: 4 additions & 4 deletions injection/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class InjectionError(Exception):
__slots__ = ()
pass


class NoInjectable(KeyError, InjectionError):
Expand All @@ -26,12 +26,12 @@ def cls(self) -> type:


class ModuleError(InjectionError):
__slots__ = ()
pass


class ModuleLockError(ModuleError):
__slots__ = ()
pass


class ModuleNotUsedError(KeyError, ModuleError):
__slots__ = ()
pass