Closed stdedos closed 2 months ago
I'm getting a different error in Python 3.11 that I think is caused by the same thing.
If I try to access anything that ResultList
has but Dict[str, Any]
doesn't, Pylance gets angry.
Cannot access member "total" for type "Dict[str, Any]"
Member "total" is unknown
Argument of type "Literal[0]" cannot be assigned to parameter "__key" of type "str" in function "__getitem__"
"Literal[0]" is incompatible with "str"
And if I try say that the return from search_issues is explicitly ResultList
during variable assignment, I get this:
Expression of type "Dict[str, Any] | ResultList[Issue]" cannot be assigned to declared type "ResultList[Unknown]"
Type "Dict[str, Any] | ResultList[Issue]" cannot be assigned to type "ResultList[Unknown]"
"Dict[str, Any]" is incompatible with "ResultList[Unknown]"
or for ResultList[Issue]
:
Expression of type "Dict[str, Any] | ResultList[Issue]" cannot be assigned to declared type "ResultList[Issue]"
Type "Dict[str, Any] | ResultList[Issue]" cannot be assigned to type "ResultList[Issue]"
"Dict[str, Any]" is incompatible with "ResultList[Issue]"
So in order to quiet the errors I have to explicitly say:
assert isinstance(issues, jira.client.ResultList)
@stdedos @GPHemsley-RELX: #1861 should resolve this.
Bug summary
Using
Gives the aforementioned result:
The culprit seems to be:
which should be quickly solveable with a little bit of https://mypy.readthedocs.io/en/stable/more_types.html#function-overloading
Is there an existing issue for this?
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
No response
jira-python version
3.4.1
Python Interpreter version
3.9
Which operating systems have you used?
Reproduction steps
Stack trace
Expected behaviour
No typing issues
Additional Context
No response