Change http.cookie.Morsel to Dict[str, any]#3060
Conversation
stdlib/3/http/cookies.pyi
Outdated
| class CookieError(Exception): ... | ||
|
|
||
| class Morsel(Dict[str, str], Generic[_T]): | ||
| class Morsel(Dict[str, any], Generic[_T]): |
There was a problem hiding this comment.
fixed, thanks.
There was a problem hiding this comment.
also rebased to current master.
Morsel does cast any value to string and therfor any is the correct typehint. For some keys other types then strings are more appropiate anyway, max-age can take an integer (unix time) and http-only a boolean. Closes python#3059
|
@JelleZijlstra could I ask why |
|
Mostly because that wasn't the PR I received, and what was already here seemed like an improvement. Also, there are no current usages of TypedDict in typeshed, and as long as it lives in mypy_extensions we can't expect it to work in other type checkers. It's going to be moved into typing very soon though. |
|
So if I create a PR that uses |
|
If it works with typecheckers and passes CI, sure. I think python/mypy#7028 will have to be fixed first though. |
|
Aha, I see. Thanks! |
Morsel does cast any value to string and therfor any is the correct
typehint. For some keys other types then strings are more
appropiate anyway, max-age can take an integer (unix time) and http-only
a boolean.
Closes #3059