{"action":"created","comment":{"url":"https://api.github.com/repos/shazow/urllib3/pulls/comments/64712533","id":64712533,"diff_hunk":"@@ -1,21 +1,56 @@\n from __future__ import absolute_import\n-from collections import Mapping, MutableMapping\n+\n+from collections import Mapping\n+\n+from .util.typing import (\n+    Generic, TypeVar, List, Union, Tuple, Any,\n+)\n+from .util.typing import Callable  # noqa: unused in this module\n+from .util.typing import Iterable  # noqa: unused in this module\n+from .util.typing import Iterator  # noqa: unused in this module\n+from .util.typing import MutableMapping  # noqa: unused in this module\n+from .util.typing import Optional  # noqa: unused in this module\n+from types import TracebackType  # noqa: unused in this module","path":"urllib3/_collections.py","position":14,"original_position":14,"commit_id":"93f8af6b409c905aa2767e5d94abcf668e89de4d","original_commit_id":"93f8af6b409c905aa2767e5d94abcf668e89de4d","user":{"login":"tharvik","id":5735566,"avatar_url":"https://avatars.githubusercontent.com/u/5735566?v=3","gravatar_id":"","url":"https://api.github.com/users/tharvik","html_url":"https://github.com/tharvik","followers_url":"https://api.github.com/users/tharvik/followers","following_url":"https://api.github.com/users/tharvik/following{/other_user}","gists_url":"https://api.github.com/users/tharvik/gists{/gist_id}","starred_url":"https://api.github.com/users/tharvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tharvik/subscriptions","organizations_url":"https://api.github.com/users/tharvik/orgs","repos_url":"https://api.github.com/users/tharvik/repos","events_url":"https://api.github.com/users/tharvik/events{/privacy}","received_events_url":"https://api.github.com/users/tharvik/received_events","type":"User","site_admin":false},"body":"flake8 not handling use in comments? did I missed something?","created_at":"2016-05-26T09:00:20Z","updated_at":"2016-05-26T09:00:20Z","html_url":"https://github.com/shazow/urllib3/pull/880#discussion_r64712533","pull_request_url":"https://api.github.com/repos/shazow/urllib3/pulls/880","_links":{"self":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/comments/64712533"},"html":{"href":"https://github.com/shazow/urllib3/pull/880#discussion_r64712533"},"pull_request":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/880"}}},"pull_request":{"url":"https://api.github.com/repos/shazow/urllib3/pulls/880","id":71521542,"html_url":"https://github.com/shazow/urllib3/pull/880","diff_url":"https://github.com/shazow/urllib3/pull/880.diff","patch_url":"https://github.com/shazow/urllib3/pull/880.patch","issue_url":"https://api.github.com/repos/shazow/urllib3/issues/880","number":880,"state":"open","locked":false,"title":"Add typing to __init__ and _collections","user":{"login":"tharvik","id":5735566,"avatar_url":"https://avatars.githubusercontent.com/u/5735566?v=3","gravatar_id":"","url":"https://api.github.com/users/tharvik","html_url":"https://github.com/tharvik","followers_url":"https://api.github.com/users/tharvik/followers","following_url":"https://api.github.com/users/tharvik/following{/other_user}","gists_url":"https://api.github.com/users/tharvik/gists{/gist_id}","starred_url":"https://api.github.com/users/tharvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tharvik/subscriptions","organizations_url":"https://api.github.com/users/tharvik/orgs","repos_url":"https://api.github.com/users/tharvik/repos","events_url":"https://api.github.com/users/tharvik/events{/privacy}","received_events_url":"https://api.github.com/users/tharvik/received_events","type":"User","site_admin":false},"body":"So, here is a first iteration of adding types checking, as discuted in #867.\r\n\r\nHaving stubs files was harder to make it works, and in general, it would be best to keep related code and typing. So we will use magic comment as proposed by @sigmavirus24.\r\n\r\nThere is a bunch of TODO in code, with the corresponding bug report (or general issue).\r\n\r\nI'll add some commit comments to explain choices made.\r\n\r\nWith the current state of mypy, there is a bunch of error, like\r\n```\r\nurllib3/_collections.py:22: error: Name 'OrderedDict' already defined\r\nurllib3/_collections.py:27: error: Name 'RLock' already defined\r\nurllib3/_collections.py:25: error: Name 'RLock' already defined\r\n```\r\nwhich are caused by mypy not handling conditionals, but, by avoiding theses paths while coding, we can have some type error remarks.\r\n\r\nOverview\r\n* add types to `urllib3/__init__.py` and `urllib3/_collections.py`\r\n* adding `urllib3.util.typing` module to allow handling both python2 and python3 with an easier interface. We will add some classes during next iterations\r\n* changing some import check based on `ImportError` to one using `sys.version_info`, as it is the recommanded way to do it in PEP 484","created_at":"2016-05-26T08:58:53Z","updated_at":"2016-05-26T09:00:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"105c45ef545f55bec3629ca6f78653c52f68b048","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shazow/urllib3/pulls/880/commits","review_comments_url":"https://api.github.com/repos/shazow/urllib3/pulls/880/comments","review_comment_url":"https://api.github.com/repos/shazow/urllib3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shazow/urllib3/issues/880/comments","statuses_url":"https://api.github.com/repos/shazow/urllib3/statuses/93f8af6b409c905aa2767e5d94abcf668e89de4d","head":{"label":"tharvik:add_types","ref":"add_types","sha":"93f8af6b409c905aa2767e5d94abcf668e89de4d","user":{"login":"tharvik","id":5735566,"avatar_url":"https://avatars.githubusercontent.com/u/5735566?v=3","gravatar_id":"","url":"https://api.github.com/users/tharvik","html_url":"https://github.com/tharvik","followers_url":"https://api.github.com/users/tharvik/followers","following_url":"https://api.github.com/users/tharvik/following{/other_user}","gists_url":"https://api.github.com/users/tharvik/gists{/gist_id}","starred_url":"https://api.github.com/users/tharvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tharvik/subscriptions","organizations_url":"https://api.github.com/users/tharvik/orgs","repos_url":"https://api.github.com/users/tharvik/repos","events_url":"https://api.github.com/users/tharvik/events{/privacy}","received_events_url":"https://api.github.com/users/tharvik/received_events","type":"User","site_admin":false},"repo":{"id":59207578,"name":"urllib3","full_name":"tharvik/urllib3","owner":{"login":"tharvik","id":5735566,"avatar_url":"https://avatars.githubusercontent.com/u/5735566?v=3","gravatar_id":"","url":"https://api.github.com/users/tharvik","html_url":"https://github.com/tharvik","followers_url":"https://api.github.com/users/tharvik/followers","following_url":"https://api.github.com/users/tharvik/following{/other_user}","gists_url":"https://api.github.com/users/tharvik/gists{/gist_id}","starred_url":"https://api.github.com/users/tharvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tharvik/subscriptions","organizations_url":"https://api.github.com/users/tharvik/orgs","repos_url":"https://api.github.com/users/tharvik/repos","events_url":"https://api.github.com/users/tharvik/events{/privacy}","received_events_url":"https://api.github.com/users/tharvik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tharvik/urllib3","description":"Python HTTP library with thread-safe connection pooling, file post support, sanity friendly, and more.","fork":true,"url":"https://api.github.com/repos/tharvik/urllib3","forks_url":"https://api.github.com/repos/tharvik/urllib3/forks","keys_url":"https://api.github.com/repos/tharvik/urllib3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tharvik/urllib3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tharvik/urllib3/teams","hooks_url":"https://api.github.com/repos/tharvik/urllib3/hooks","issue_events_url":"https://api.github.com/repos/tharvik/urllib3/issues/events{/number}","events_url":"https://api.github.com/repos/tharvik/urllib3/events","assignees_url":"https://api.github.com/repos/tharvik/urllib3/assignees{/user}","branches_url":"https://api.github.com/repos/tharvik/urllib3/branches{/branch}","tags_url":"https://api.github.com/repos/tharvik/urllib3/tags","blobs_url":"https://api.github.com/repos/tharvik/urllib3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tharvik/urllib3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tharvik/urllib3/git/refs{/sha}","trees_url":"https://api.github.com/repos/tharvik/urllib3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tharvik/urllib3/statuses/{sha}","languages_url":"https://api.github.com/repos/tharvik/urllib3/languages","stargazers_url":"https://api.github.com/repos/tharvik/urllib3/stargazers","contributors_url":"https://api.github.com/repos/tharvik/urllib3/contributors","subscribers_url":"https://api.github.com/repos/tharvik/urllib3/subscribers","subscription_url":"https://api.github.com/repos/tharvik/urllib3/subscription","commits_url":"https://api.github.com/repos/tharvik/urllib3/commits{/sha}","git_commits_url":"https://api.github.com/repos/tharvik/urllib3/git/commits{/sha}","comments_url":"https://api.github.com/repos/tharvik/urllib3/comments{/number}","issue_comment_url":"https://api.github.com/repos/tharvik/urllib3/issues/comments{/number}","contents_url":"https://api.github.com/repos/tharvik/urllib3/contents/{+path}","compare_url":"https://api.github.com/repos/tharvik/urllib3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tharvik/urllib3/merges","archive_url":"https://api.github.com/repos/tharvik/urllib3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tharvik/urllib3/downloads","issues_url":"https://api.github.com/repos/tharvik/urllib3/issues{/number}","pulls_url":"https://api.github.com/repos/tharvik/urllib3/pulls{/number}","milestones_url":"https://api.github.com/repos/tharvik/urllib3/milestones{/number}","notifications_url":"https://api.github.com/repos/tharvik/urllib3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tharvik/urllib3/labels{/name}","releases_url":"https://api.github.com/repos/tharvik/urllib3/releases{/id}","deployments_url":"https://api.github.com/repos/tharvik/urllib3/deployments","created_at":"2016-05-19T13:11:52Z","updated_at":"2016-05-19T13:11:53Z","pushed_at":"2016-05-26T08:21:35Z","git_url":"git://github.com/tharvik/urllib3.git","ssh_url":"git@github.com:tharvik/urllib3.git","clone_url":"https://github.com/tharvik/urllib3.git","svn_url":"https://github.com/tharvik/urllib3","homepage":"http://urllib3.readthedocs.org/","size":2798,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"shazow:master","ref":"master","sha":"29491230603c7b55fc4fc8a3fbfcbbd179b7a8b6","user":{"login":"shazow","id":6292,"avatar_url":"https://avatars.githubusercontent.com/u/6292?v=3","gravatar_id":"","url":"https://api.github.com/users/shazow","html_url":"https://github.com/shazow","followers_url":"https://api.github.com/users/shazow/followers","following_url":"https://api.github.com/users/shazow/following{/other_user}","gists_url":"https://api.github.com/users/shazow/gists{/gist_id}","starred_url":"https://api.github.com/users/shazow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shazow/subscriptions","organizations_url":"https://api.github.com/users/shazow/orgs","repos_url":"https://api.github.com/users/shazow/repos","events_url":"https://api.github.com/users/shazow/events{/privacy}","received_events_url":"https://api.github.com/users/shazow/received_events","type":"User","site_admin":false},"repo":{"id":2410676,"name":"urllib3","full_name":"shazow/urllib3","owner":{"login":"shazow","id":6292,"avatar_url":"https://avatars.githubusercontent.com/u/6292?v=3","gravatar_id":"","url":"https://api.github.com/users/shazow","html_url":"https://github.com/shazow","followers_url":"https://api.github.com/users/shazow/followers","following_url":"https://api.github.com/users/shazow/following{/other_user}","gists_url":"https://api.github.com/users/shazow/gists{/gist_id}","starred_url":"https://api.github.com/users/shazow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shazow/subscriptions","organizations_url":"https://api.github.com/users/shazow/orgs","repos_url":"https://api.github.com/users/shazow/repos","events_url":"https://api.github.com/users/shazow/events{/privacy}","received_events_url":"https://api.github.com/users/shazow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shazow/urllib3","description":"Python HTTP library with thread-safe connection pooling, file post support, sanity friendly, and more.","fork":false,"url":"https://api.github.com/repos/shazow/urllib3","forks_url":"https://api.github.com/repos/shazow/urllib3/forks","keys_url":"https://api.github.com/repos/shazow/urllib3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shazow/urllib3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shazow/urllib3/teams","hooks_url":"https://api.github.com/repos/shazow/urllib3/hooks","issue_events_url":"https://api.github.com/repos/shazow/urllib3/issues/events{/number}","events_url":"https://api.github.com/repos/shazow/urllib3/events","assignees_url":"https://api.github.com/repos/shazow/urllib3/assignees{/user}","branches_url":"https://api.github.com/repos/shazow/urllib3/branches{/branch}","tags_url":"https://api.github.com/repos/shazow/urllib3/tags","blobs_url":"https://api.github.com/repos/shazow/urllib3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shazow/urllib3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shazow/urllib3/git/refs{/sha}","trees_url":"https://api.github.com/repos/shazow/urllib3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shazow/urllib3/statuses/{sha}","languages_url":"https://api.github.com/repos/shazow/urllib3/languages","stargazers_url":"https://api.github.com/repos/shazow/urllib3/stargazers","contributors_url":"https://api.github.com/repos/shazow/urllib3/contributors","subscribers_url":"https://api.github.com/repos/shazow/urllib3/subscribers","subscription_url":"https://api.github.com/repos/shazow/urllib3/subscription","commits_url":"https://api.github.com/repos/shazow/urllib3/commits{/sha}","git_commits_url":"https://api.github.com/repos/shazow/urllib3/git/commits{/sha}","comments_url":"https://api.github.com/repos/shazow/urllib3/comments{/number}","issue_comment_url":"https://api.github.com/repos/shazow/urllib3/issues/comments{/number}","contents_url":"https://api.github.com/repos/shazow/urllib3/contents/{+path}","compare_url":"https://api.github.com/repos/shazow/urllib3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shazow/urllib3/merges","archive_url":"https://api.github.com/repos/shazow/urllib3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shazow/urllib3/downloads","issues_url":"https://api.github.com/repos/shazow/urllib3/issues{/number}","pulls_url":"https://api.github.com/repos/shazow/urllib3/pulls{/number}","milestones_url":"https://api.github.com/repos/shazow/urllib3/milestones{/number}","notifications_url":"https://api.github.com/repos/shazow/urllib3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shazow/urllib3/labels{/name}","releases_url":"https://api.github.com/repos/shazow/urllib3/releases{/id}","deployments_url":"https://api.github.com/repos/shazow/urllib3/deployments","created_at":"2011-09-18T18:08:28Z","updated_at":"2016-05-26T02:37:15Z","pushed_at":"2016-05-26T08:58:53Z","git_url":"git://github.com/shazow/urllib3.git","ssh_url":"git@github.com:shazow/urllib3.git","clone_url":"https://github.com/shazow/urllib3.git","svn_url":"https://github.com/shazow/urllib3","homepage":"http://urllib3.readthedocs.org/","size":4910,"stargazers_count":1045,"watchers_count":1045,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":344,"mirror_url":null,"open_issues_count":109,"forks":344,"open_issues":109,"watchers":1045,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/880"},"html":{"href":"https://github.com/shazow/urllib3/pull/880"},"issue":{"href":"https://api.github.com/repos/shazow/urllib3/issues/880"},"comments":{"href":"https://api.github.com/repos/shazow/urllib3/issues/880/comments"},"review_comments":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/880/comments"},"review_comment":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shazow/urllib3/pulls/880/commits"},"statuses":{"href":"https://api.github.com/repos/shazow/urllib3/statuses/93f8af6b409c905aa2767e5d94abcf668e89de4d"}}}}
{"actor":{"display_login":"tharvik"}}