{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/6131","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/6131/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/6131/comments","events_url":"https://api.github.com/repos/python/mypy/issues/6131/events","html_url":"https://github.com/python/mypy/issues/6131","id":395444097,"node_id":"MDU6SXNzdWUzOTU0NDQwOTc=","number":6131,"title":"Support for default types in TypedDict","user":{"login":"rra","id":302330,"node_id":"MDQ6VXNlcjMwMjMzMA==","avatar_url":"https://avatars2.githubusercontent.com/u/302330?v=4","gravatar_id":"","url":"https://api.github.com/users/rra","html_url":"https://github.com/rra","followers_url":"https://api.github.com/users/rra/followers","following_url":"https://api.github.com/users/rra/following{/other_user}","gists_url":"https://api.github.com/users/rra/gists{/gist_id}","starred_url":"https://api.github.com/users/rra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rra/subscriptions","organizations_url":"https://api.github.com/users/rra/orgs","repos_url":"https://api.github.com/users/rra/repos","events_url":"https://api.github.com/users/rra/events{/privacy}","received_events_url":"https://api.github.com/users/rra/received_events","type":"User","site_admin":false},"labels":[{"id":21488358,"node_id":"MDU6TGFiZWwyMTQ4ODM1OA==","url":"https://api.github.com/repos/python/mypy/labels/feature","name":"feature","color":"84b6eb","default":false},{"id":513232568,"node_id":"MDU6TGFiZWw1MTMyMzI1Njg=","url":"https://api.github.com/repos/python/mypy/labels/priority-2-low","name":"priority-2-low","color":"fffff8","default":false},{"id":488169816,"node_id":"MDU6TGFiZWw0ODgxNjk4MTY=","url":"https://api.github.com/repos/python/mypy/labels/topic-typed-dict","name":"topic-typed-dict","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-01-03T03:02:36Z","updated_at":"2019-01-03T13:12:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This problem arose from trying to type the [`environ` argument for a WSGI application](https://www.python.org/dev/peps/pep-3333/#environ-variables). There are specific keys of the `environ` dict that have non-`str` types, and then all the other keys are `HTTP_` variables (or server-defined variables, which can be ignored for this purpose) with type `str` (or `Text`, depending on the version of Python).\r\n\r\nI would like to get stronger typing on `environ` than `Dict[str, Any]`, but there isn't a way to do that with `TypedDict` currently because the set of possible keys is unbounded (the client can send any HTTP header).\r\n\r\nIdeally, I'd like to be able to do something like:\r\n```\r\nEnvironDict = TypedDict(\"EnvironDict\", {\r\n    \"wsgi.version\": Tuple[int, int],\r\n    \"wsgi.input\": IO[str],\r\n# ...\r\n}, default_type=str, total=False)\r\n```\r\nand have this mean that any key is allowed in the dictionary and all unknown keys get a value type of `str`."},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/451138895","html_url":"https://github.com/python/mypy/issues/6131#issuecomment-451138895","issue_url":"https://api.github.com/repos/python/mypy/issues/6131","id":451138895,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTEzODg5NQ==","user":{"login":"JukkaL","id":1107911,"node_id":"MDQ6VXNlcjExMDc5MTE=","avatar_url":"https://avatars2.githubusercontent.com/u/1107911?v=4","gravatar_id":"","url":"https://api.github.com/users/JukkaL","html_url":"https://github.com/JukkaL","followers_url":"https://api.github.com/users/JukkaL/followers","following_url":"https://api.github.com/users/JukkaL/following{/other_user}","gists_url":"https://api.github.com/users/JukkaL/gists{/gist_id}","starred_url":"https://api.github.com/users/JukkaL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JukkaL/subscriptions","organizations_url":"https://api.github.com/users/JukkaL/orgs","repos_url":"https://api.github.com/users/JukkaL/repos","events_url":"https://api.github.com/users/JukkaL/events{/privacy}","received_events_url":"https://api.github.com/users/JukkaL/received_events","type":"User","site_admin":false},"created_at":"2019-01-03T13:12:14Z","updated_at":"2019-01-03T13:12:14Z","author_association":"COLLABORATOR","body":"We'd need a way to represent this using the class-based syntax as well."}}
{"actor":{"display_login":"JukkaL"}}