Replies: 2 comments 2 replies
-
In your example you can define a constructor in MyHardwareBus with its dependencies, is that what you need ? If you want to instantiate dependencies after the hardware bus has been created, you can inject a Provider directly I will fix the mypy warning in the next release. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what the best solution is yet for my particular purpose, but your description of a custom scope in the docs has inspired me a bit. My biggest issue is that I need to make sure that the bus is able to close its resource hold regardless of what happens with the widgets. There may be an alternate approach using the device_provider you mentioned above, but I don't have a firm enough mental module opyoid framework to know how to structure it in a natural way. |
Beta Was this translation helpful? Give feedback.
-
Is there a good way to have a context manager with one or dependencies? I'm making a framework that includes physical hardware that needs to close resources even if errors are raised. If asked in a more generic sense, how do you call a function for a provider after instantiation?
As a sidebar, is it possible to import opyoid without using the type ignore comment? Without the comment, I get the following mypy error
Output
When run in Python 3.10
Beta Was this translation helpful? Give feedback.
All reactions