-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Bug Fix && let
lazy
easilier to use
- Loading branch information
Showing
9 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "saleyo" | ||
version = "1.2.0" | ||
version = "1.2.1" | ||
description = "Saleyo is a lightwight scalable Python AOP framework, easy to use and integrate." | ||
authors = [{ name = "H2Sxxa", email = "[email protected]" }] | ||
dependencies = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
|
||
from .ancestor import Ancestor as Ancestor | ||
from .mixin import Mixin as Mixin | ||
from . import lazy as lazy |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from types import ModuleType | ||
from saleyo.base.import_broadcast import list_import_listeners | ||
from saleyo.decorator.mixin import Mixin | ||
from saleyo.operation.hook import Pre | ||
|
||
|
||
def locater(name: str, module: ModuleType): | ||
if name == "targetmod": | ||
if module.__dict__.__contains__("NeedLazyMixin"): | ||
return module.NeedLazyMixin | ||
return None | ||
|
||
|
||
@Mixin.lazy(locater) | ||
class MixinTarget: | ||
@Pre | ||
def hello(self): | ||
print("Pre Hook") | ||
|
||
|
||
print(list_import_listeners()) | ||
import targetmod as targetmod # noqa: E402 | ||
|
||
print(list_import_listeners()) | ||
|
||
targetmod.NeedLazyMixin().hello() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class NeedLazyMixin: | ||
def hello(self): | ||
print("hello world") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
|
||
def something(): | ||
import module as module | ||
import targetmod as targetmod | ||
|
||
|
||
something() |