-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Improve typings for multipart #3905
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asvetlov I tried my best to make it small but changes required in web_request
did what they did to diff.
I left some comments though proposing further changes if you wish to.
Also...I can't tell if CI passes this time because locally:
- mypy passed (and I hope it will here as well)
- flake behaves strangely for me in a way that it constantly fails...don't know why exactly is that but it shows a lot of issues with the codebase while where checking other builds I see it passing)
@@ -195,21 +194,26 @@ def content_disposition_filename(params: Mapping[str, str], | |||
|
|||
|
|||
class MultipartResponseWrapper: | |||
"""Wrapper around the MultipartBodyReader. | |||
"""Wrapper around the MultipartReader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such of thing as MultipartBodyReader
so decided to go with MultipartReader
as the only thing that matched the interface. I will give it another look, but for now that was the thing that matched.
if field_ct is None or \ | ||
field_ct.startswith('text/'): | ||
charset = field.get_charset(default='utf-8') | ||
out.add(field.name, value.decode(charset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that accounts for producing str
from post
charset = field.get_charset(default='utf-8') | ||
out.add(field.name, value.decode(charset)) | ||
else: | ||
out.add(field.name, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is for bytes
max_size=max_size, | ||
actual_size=size | ||
) | ||
raise ValueError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the documentation, I assume that behavior here is correct and decoding nested multipart is a custom job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@asvetlov if that's approved and by default will be merged soon, may I ask if you would prefer another issue for |
|
@webknjaz I see the yellow status for Timeline protection checker. |
(cherry picked from commit d7b08ad) Co-authored-by: Tomasz Trębski <tomasz.trebski@ts.fujitsu.com>
@asvetlov thanks for the hint. It's probably better to create issues @ https://github.com/sanitizers/chronographer-github-app/issues/new for better visibility. I've almost missed this one :) |
What do these changes do?
Removes usage of
Any
type frommultipart.py
and wherever those changes introducedmypy
errors.Are there changes in behavior for the user?
No, there should not be any changes for use.
Related issue number
#3621
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.