-
Notifications
You must be signed in to change notification settings - Fork 6
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
Showing
11 changed files
with
53 additions
and
30 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
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 |
---|---|---|
@@ -1,9 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, print_function, unicode_literals | ||
import sys | ||
import types | ||
|
||
|
||
if True: # skipping importanize, imports need to be in this order for py2 | ||
from .column import * # noqa | ||
from .model import * # noqa | ||
from .composite import * # noqa | ||
from .relations import * # noqa | ||
class lazy_module(types.ModuleType): | ||
def __init__(self, name, old_module, origins): | ||
super(lazy_module, self).__init__(name) | ||
self.origins = origins or {} | ||
self.__dict__.update( | ||
{ | ||
"__file__": old_module.__file__, | ||
"__package__": old_module.__package__, | ||
"__path__": old_module.__path__, | ||
"__doc__": old_module.__doc__, | ||
} | ||
) | ||
|
||
def __getattr__(self, name): | ||
if name in self.origins: | ||
module = __import__(self.__name__ + "." + self.origins[name], None, None, [name]) | ||
return getattr(module, name) | ||
return types.ModuleType.__getattribute__(self, name) | ||
|
||
|
||
old_module = sys.modules[__name__] | ||
sys.modules[__name__] = lazy_module( | ||
__name__, | ||
old_module, | ||
{"model_info": "model", "Identity": "model", "relation_info": "relations", "column_info": "column"}, | ||
) |
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
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
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, print_function, unicode_literals | ||
|
||
|
||
if True: | ||
from .runner import ValidationRunner # noqa | ||
from .base import * # noqa | ||
from .base import * # noqa | ||
from .runner import ValidationRunner # noqa |
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