Describe the bug
In the OpenFlexure microscope server we use the ActionManager of the server to determine the calling action for an invocation when recording log information. We get the invocation with get_invocation(). Using this Invocation object we can do invocation.action.name to get the action name. But MyPy throws and error unless you call invocation.action().name; this makes MyPy happy but throws an error at runtime. The issues seems to be because the action is a descriptor.
To get around this we directly invocation.action_ref().name which even though there is no leading underscore feels like accessing an internal.
To Reproduce
- On an
Invocation object add the line invocation.action.name
- Run MyPy
Expected behaviour
MyPy passes as the code is fine
Actual behaviour
MyPy throws and error unless you do invocation.action().name. This errors at runtime.
System:
- OS: Kuuntu 24.04 (verified also on docker image python:3.11)
- Python version: 3.11
- Version: 0.3.0
Describe the bug
In the OpenFlexure microscope server we use the ActionManager of the server to determine the calling action for an invocation when recording log information. We get the invocation with
get_invocation(). Using thisInvocation objectwe can doinvocation.action.nameto get the action name. But MyPy throws and error unless you callinvocation.action().name; this makes MyPy happy but throws an error at runtime. The issues seems to be because the action is a descriptor.To get around this we directly invocation.action_ref().name which even though there is no leading underscore feels like accessing an internal.
To Reproduce
Invocationobject add the lineinvocation.action.nameExpected behaviour
MyPy passes as the code is fine
Actual behaviour
MyPy throws and error unless you do
invocation.action().name. This errors at runtime.System: