Skip to content

Conversation

@adehad
Copy link
Contributor

@adehad adehad commented Nov 6, 2021

ResultList typing was incomplete and resulted in the default Any typehint when the class was being used as a list.

For example the examples/basic_auth.py file could be edited like so (no additional imports required):

issues = cast(ResultList[Issue], jira.search_issues("assignee=admin")) i = issues[0] reveal_type(i) [reveal_type(i2) for i2 in issues] i3 = next(issues) reveal_type(i3) reveal_type(i3.fields)

If tox -e lint was run mypy would tell us the types to be Issue instead of Any. This can also be seen in the VSCode hover menu / Pylance.
image

I've also added typing_extensions so that we can typehint this to match the __getitem__ of the list class more closely.

@adehad adehad added the feature label Nov 6, 2021
@adehad adehad requested a review from studioj November 6, 2021 23:47
@adehad adehad merged commit 6ee9e34 into main Nov 28, 2021
@adehad adehad deleted the feature/improve_ResultList_types branch November 28, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants