Skip to content

stubs/requests: expand types for files - #7999

Merged
Akuli merged 6 commits into
python:masterfrom
tommilligan:requests-files-tuples
Jun 1, 2022
Merged

Akuli merged 6 commits into
python:masterfrom
tommilligan:requests-files-tuples

Conversation

@tommilligan

Copy link
Copy Markdown
Contributor

Relates to #7724
Closes #7998

This PR allows passing a sequence of tuple for the files argument, where applicable in the requests library.

Existing types have been aliased for readability, and to document that all type of file specification are supported in either the Mapping or Sequence[tuple] form.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread stubs/requests/requests/sessions.pyi Outdated

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I dug around in the source code and tried out your repro, all looks good. Just one comment about how we can simplify the code a little, and also make the stub a little more permissive.

Comment thread stubs/requests/requests/sessions.pyi Outdated
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but given the number of issues we've had with requests stubs recently, I'd like a second opinion before merging :)

@AlexWaygood
AlexWaygood requested a review from Akuli May 31, 2022 11:44
@github-actions

This comment has been minimized.

@Akuli Akuli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm mostly concerned about using _TextMapping. The rest are small nits.

Comment thread stubs/requests/requests/sessions.pyi Outdated
Comment thread stubs/requests/requests/sessions.pyi Outdated
Comment thread stubs/requests/requests/sessions.pyi Outdated
Comment thread stubs/requests/requests/sessions.pyi Outdated
@github-actions

This comment has been minimized.

@tommilligan
tommilligan requested a review from Akuli May 31, 2022 16:31
@github-actions

github-actions Bot commented Jun 1, 2022

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Akuli Akuli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Akuli
Akuli merged commit 51f97dd into python:master Jun 1, 2022
@isFakeAccount

Copy link
Copy Markdown

Which version will reflect these changes?

@tommilligan

Copy link
Copy Markdown
Contributor Author

@isFakeAccount I can confirm these changes were released as of at least types-requests 2.27.30

pip install types-requests==2.27.30 -U 

@tommilligan
tommilligan deleted the requests-files-tuples branch June 28, 2022 06:21
@isFakeAccount

Copy link
Copy Markdown

Thanks for the quick response @tommilligan

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

requests: allow passing a list of tuples for files

4 participants