Skip to content
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

Drop wrong key parametrization for concrete classes #682

Merged
merged 4 commits into from Jan 23, 2022
Merged

Conversation

asvetlov
Copy link
Member

#677 added generic parameters for keys in accepted mappings and abstract multimapping classes. This is correct.
But the pep also incorrectly added generic key param for concrete classes, e.g. MultiDict. This is wrong, the key type of MultiDict is always str by definition (while the container can accept any str-like keys in its methods, including istr).
The same is true for CIMultiDict, the key type is always istr while any str-like key is accepted and converted internally.

@codecov
Copy link

codecov bot commented Jan 23, 2022

Codecov Report

Merging #682 (1af05d4) into master (c7138ca) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #682   +/-   ##
=======================================
  Coverage   93.65%   93.65%           
=======================================
  Files           5        5           
  Lines         504      504           
=======================================
  Hits          472      472           
  Misses         32       32           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7138ca...1af05d4. Read the comment docs.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jan 23, 2022
@asvetlov asvetlov merged commit 19c4ef3 into master Jan 23, 2022
@asvetlov asvetlov deleted the fix-types branch January 23, 2022 10:03
@@ -63,9 +63,9 @@ class MutableMultiMapping(
@abc.abstractmethod
def popall(self, key: _S, default: _D) -> Union[List[_T], _D]: ...

class MultiDict(MutableMultiMapping[_S, _T], Generic[_S, _T]):
class MultiDict(MutableMultiMapping[str, _T]):
def __init__(self, arg: _Arg[_S, _T] = ..., **kwargs: _T) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

I think this fails due to the _S. mypy now expects only 1 type in the annotation, but also wants 2 types to be defined (_S, _T), which appears to be impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants