-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Change http.cookie.Morsel to Dict[str, any] #3060
Conversation
stdlib/3/http/cookies.pyi
Outdated
@@ -7,7 +7,7 @@ _T = TypeVar('_T') | |||
|
|||
class CookieError(Exception): ... | |||
|
|||
class Morsel(Dict[str, str], Generic[_T]): | |||
class Morsel(Dict[str, any], Generic[_T]): |
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.
Any, not any
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.
fixed, thanks.
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.
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