-
Notifications
You must be signed in to change notification settings - Fork 4
some screenpy module Questions aren't recognized by mypy as type 'Answerable' #19
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
Comments
Thanks @langgaibo for reporting this! The problem lies with aliasing the classmethods, as you can see in MyPy#6700. The solution would be to redefine all of the aliases as separate classmethods, which might actually help for documentation. Right now, the ReadTheDocs autogenerated documentation shows all the aliases as just copies of the original, which can be kind of annoying. It would be nice to just mention the aliases in the docstring of the original and have Sphinx skip the documentation for the aliases. |
Would the newly created classmethods look like this? @classmethod
def of_the(cls, question: Union[Answerable, Any]) -> "MakeNote":
return cls.of(question) or just legit copies? @classmethod
def of_the(cls, question: Union[Answerable, Any]) -> "MakeNote":
return cls(question) |
The former, i'll have a PR up momentarily! |
After refactoring our codebase to use Screenpy 4.0 and various screenpy modules, we have a few mypy complaints related to typing issues in interactions between modules, specifically with base screenpy's
MakeNote
action.First and most straightforward, we have the
screenpy_requests
Cookies
question. Here's a simplified example Task from our code:And mypy's complaint:
Secondly, and this may just be something we need to address in our own code with better type declaration, we have an interaction with a custom question and
MakeNote
.Here's a simplified version of a custom question of ours:
And a simplified version of the task that calls it:
and mypy's complaint:
We are using
MakeNote
against several Questions from the various screenpy modules as well as several of our own custom questions, but for the purposes of this issue, these are the only two Questions that are tripping mypy.I looked at other Questions being used by
MakeNote
and can't see a meaningful difference in how they're declaring their types: we have many that returnstr
as doesAppointmentTime
above.The text was updated successfully, but these errors were encountered: