Method that Defines and Returns Class Instance #1249
Unanswered
adam-grant-hendry
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You could declare it as |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using a third-party library that defines a method like so:
The function, class, and class methods are all not type-hinted, so the above is an accurate representation. My problem is when using this method:
mypy
rightly is unable to determine thatwrapped
has any attributes defined byA
and gives anattr-defined
error. I cannot use something likeassert isinstance(wrapped, A)
becauseA
is not exposed insome_module.py
.Being that this is a third-party library that I cannot change, is my only option at this point to use
# typing: ignore
to disable the warning message?Beta Was this translation helpful? Give feedback.
All reactions