-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix res import errors #2502
Fix res import errors #2502
Conversation
8e53b29
to
7e39367
Compare
4180273
to
be04ee3
Compare
Codecov Report
@@ Coverage Diff @@
## main #2502 +/- ##
==========================================
+ Coverage 63.74% 63.76% +0.02%
==========================================
Files 658 658
Lines 54900 54954 +54
Branches 4393 4393
==========================================
+ Hits 34994 35041 +47
- Misses 18582 18588 +6
- Partials 1324 1325 +1
Continue to review full report at Codecov.
|
be04ee3
to
331dd9b
Compare
res/sched/history.py
Outdated
@@ -31,7 +34,7 @@ class History(BaseCClass): | |||
) | |||
_free = ResPrototype("void history_free( history )") | |||
|
|||
def __init__(self, refcase=None, use_history=False, sched_file=None): | |||
def __init__(self, refcase=Optional[EclSum], use_history=False, sched_file=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, refcase=Optional[EclSum], use_history=False, sched_file=None): | |
def __init__(self, refcase: Optional[EclSum] = None, use_history=False, sched_file=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups, nice catch. Fixed
@@ -54,7 +56,7 @@ def __init__(self, ensemble_config_node, file_system, input_mask=None): | |||
|
|||
self.__load(file_system, input_mask) | |||
|
|||
def __load(self, file_system, input_mask=None): | |||
def __load(self, file_system: EnkfFs, input_mask: BoolVector = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __load(self, file_system: EnkfFs, input_mask: BoolVector = None): | |
def __load(self, file_system: EnkfFs, input_mask: Optional[BoolVector] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now
res/enkf/enkf_state.py
Outdated
self, fs, param_list=None, init_mode=EnkfInitModeEnum.INIT_CONDITIONAL | ||
self, | ||
fs: EnkfFs, | ||
param_list: StringList = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
param_list: StringList = None, | |
param_list: Optional[StringList] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now
res/enkf/analysis_config.py
Outdated
def __init__( | ||
self, | ||
user_config_file=None, | ||
config_content: ConfigContent = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config_content: ConfigContent = None, | |
config_content: Optional[ConfigContent] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now
331dd9b
to
df891d1
Compare
df891d1
to
2f87284
Compare
* Adds __all__ to __init__ * Use typing to enforce use of silent dependencies * Remove base dependencies that are unused Several files would rely on importing from the __init__.py of its module. This is quite fragile as the order of imports in the __init__.py must facilitate a partial instantiation in order to avoid circular imports. As more imports are added to resolve the above issue, its no longer possible to continue with that scheme. Therefore imports such as from . import EnkFMain is changed to from .enkf_main import EnkFMain for any file in res/enkf while files outside res/enkf can use from res.enkf import EnkFMain.
2f87284
to
bea3bb7
Compare
Issue
#2503
Approach
__all__
to__init__
Several files would rely on importing from the
__init__.py
of its module. This is quite fragile as the order of imports in the__init__.py
must facilitate a partial instantiation in order to avoid circular imports. As more imports are added to resolve the above issue, it becomes very difficult to continue with that scheme. Therefore imports such asfrom . import EnkFMain
is changed tofrom .enkf_main import EnkFMain
for any file insideres/enkf
while files outsideres/enkf
can usefrom res.enkf import EnkFMain
.