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
Add type to OrderedDict #1954
Add type to OrderedDict #1954
Conversation
OrderedDict needs to be typed just like Dict needs to be typed. The OrderedDict "input" variable key and value are used to append to a string without any processing, so it seems unlikely that something other than a string would be valid.
Codecov Report
@@ Coverage Diff @@
## master #1954 +/- ##
=======================================
Coverage 98.85% 98.85%
=======================================
Files 108 108
Lines 11064 11064
=======================================
Hits 10937 10937
Misses 127 127 Continue to review full report at Codecov.
|
I'm not certain here, but I think input's value can also be bytes. key should always be string. I hope. |
Wouldn't that be a TypeError? >>> a = "str"
>>> a += b"bytes"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "bytes") to str
>>> |
Not that input's values can be string and bytes -- but I was right, you need to check more closely, a quick grep showed me at least one call site where the value is also a boolean. |
How does that work? Python throws a TypeError Exception for __request_encode does not do any processing to input, and that calls the encode function defined inside requestMultipart, it doesn't do any pre-processing on input either.
|
Where? I don't see that use.
The only use of it I see, including grepping the tests, is in Repository.py, and that is gated with (runtime) asserts that ensure everything used to create post_parameters are str. |
These request methods all look the damned same, I swear .... |
OrderedDict needs to be typed just like Dict needs to be typed. The
OrderedDict "input" variable key and value are used to append to a
string without any processing, so it seems unlikely that something other
than a string would be valid.