-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18e9ed9
commit 1bfa3ff
Showing
5 changed files
with
98 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
dir1a_str = "base_a_1" | ||
dir1a_dict = {"a": 1, "b": 2} |
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,10 @@ | ||
from vformer.config import LazyConfig | ||
|
||
# equivalent to relative import | ||
dir1a_str, dir1a_dict = LazyConfig.load_rel("dir1_a.py", ("dir1a_str", "dir1a_dict")) | ||
|
||
dir1b_str = dir1a_str + "_from_b" | ||
dir1b_dict = dir1a_dict | ||
|
||
# Every import is a reload: not modified by other config files | ||
assert dir1a_dict.a == 1 |
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,13 @@ | ||
from itertools import count | ||
|
||
from vformer.config import LazyCall as L | ||
|
||
from .dir1.dir1_a import dir1a_dict, dir1a_str | ||
|
||
dir1a_dict.a = "modified" | ||
|
||
# modification above won't affect future imports | ||
from .dir1.dir1_b import dir1b_dict, dir1b_str | ||
|
||
|
||
lazyobj = L(count)(x=dir1a_str, y=dir1b_str) |
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