-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add small bit of type hinting #1745
base: main
Are you sure you want to change the base?
Add small bit of type hinting #1745
Conversation
Signed-off-by: BryceGattis <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1745 +/- ##
==========================================
- Coverage 58.29% 57.93% -0.36%
==========================================
Files 126 126
Lines 17159 17162 +3
Branches 3505 3505
==========================================
- Hits 10002 9942 -60
- Misses 6493 6550 +57
- Partials 664 670 +6 ☔ View full report in Codecov by Sentry. |
Signed-off-by: BryceGattis <[email protected]>
Signed-off-by: BryceGattis <[email protected]>
Signed-off-by: BryceGattis <[email protected]>
src/rez/plugin_managers.py
Outdated
@@ -235,7 +239,7 @@ def config_schema(self): | |||
deep_update(d, d_) | |||
return dict_to_schema(d, required=True, modifier=expand_system_vars) | |||
|
|||
def create_instance(self, plugin, **instance_kwargs): | |||
def create_instance(self, plugin, **instance_kwargs) -> "RezPluginType": |
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.
This doesn't return a RezPluginType
instance. It will return something like rezplugins.build_system.cmake.CMakeBuildSystem
. I don't think we have an easy way today to get all the possible base classes for each plugin type. It should be possible, but it'll require changes to the plugin system, or some more thoughts to maybe use generics or whatever type magic we'll need to get this to work.
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.
@JeanChristopheMorinPerso Ah right good point. Would it be alright to type hint these just as object
instead for now? That at least gives us some kind of information.
Signed-off-by: BryceGattis <[email protected]>
Signed-off-by: BryceGattis <[email protected]>
Signed-off-by: BryceGattis <[email protected]>
@@ -802,7 +804,7 @@ def _get_new_session_popen_args(self): | |||
|
|||
class _PluginConfigs(object): | |||
"""Lazy config loading for plugins.""" | |||
def __init__(self, plugin_data): | |||
def __init__(self, plugin_data: typing.Dict[str, typing.Any]): | |||
self.__dict__['_data'] = plugin_data |
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.
I'm curious why we do this self.__dict__['_data']
accessing here. Perhaps there is a cleaner way to do this?
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.
I think it's to bypass __getattr__
.
Co-authored-by: Jean-Christophe Morin <[email protected]> Signed-off-by: Bryce Gattis <[email protected]>
Co-authored-by: Jean-Christophe Morin <[email protected]> Signed-off-by: Bryce Gattis <[email protected]>
No description provided.