Skip to content

Incorrect types in for Invocation.action #403

Description

@julianstirling

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions