Closed davidism closed 3 weeks ago
Going to roll back accepting Collection
for iter_multi_items
and __init__
, back to (list, tuple)
instead. It was also matching str
, bytes
, and other types that should be treated as single values. See #2994
Removed the stub files, and redid the annotations inline. Addressed some mypy findings this affected in other places. As I was going through everything I did a bit of refactoring and took some notes as well:
super().method(...)
instead ofBaseClass.method(self, ...)
. There are some places where the non-super pattern is still needed.super().__init__()
in some subclasses that were missing it.iter_multi_items
and__ini__
/update
/etc methods acceptMapping
,Collection
, andIterable
instead of more specific types likedict
,list
, andtuple
.keys()
/values()
/items()
returnIterable
instead ofKeysView
/etc, which doesn't match theMapping
interface. I couldn't think of a general way to efficiently implement these for the structures, and no one has ever brought it up, so I'm leaving it.Headers
inherits fromMutableMapping
instead of nothing. This was true in the stubs, but wasn't actually reflected in the code.FileMultiDict.add_file
accepts anos.PathLike
path as the first argument (instead of only astr
path).__getitem__
/get
/pop
/etc only specify overrides for parameters that make sense. I couldn't figure out how to specify a complete set of overrides, and it didn't seem necessary anyway.Headers.getlist
was be refactored to not checktype is not None
every iteration.Mapping.update(arg, /, **kwargs)
andHeaders.set(key, value, /, **kwargs)
rather than taking and checking*args
._get_mode
parameter fromHeaders.__getitem__
, refactor various methods that usedself[key]
to work without needing that weird implementation.CombinedMultiDict.to_dict
was an exact copy of thesuper
implementation.fixes #2970