{"action":"created","issue":{"url":"https://api.github.com/repos/python/typeshed/issues/236","repository_url":"https://api.github.com/repos/python/typeshed","labels_url":"https://api.github.com/repos/python/typeshed/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/python/typeshed/issues/236/comments","events_url":"https://api.github.com/repos/python/typeshed/issues/236/events","html_url":"https://github.com/python/typeshed/issues/236","id":157893559,"number":236,"title":"[2.7] urlparse.urlparse should use AnyStr, but can't due to NamedTuple","user":{"login":"mr-c","id":1330696,"avatar_url":"https://avatars.githubusercontent.com/u/1330696?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-c","html_url":"https://github.com/mr-c","followers_url":"https://api.github.com/users/mr-c/followers","following_url":"https://api.github.com/users/mr-c/following{/other_user}","gists_url":"https://api.github.com/users/mr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-c/subscriptions","organizations_url":"https://api.github.com/users/mr-c/orgs","repos_url":"https://api.github.com/users/mr-c/repos","events_url":"https://api.github.com/users/mr-c/events{/privacy}","received_events_url":"https://api.github.com/users/mr-c/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-01T12:23:45Z","updated_at":"2016-06-03T21:05:52Z","closed_at":null,"body":"Fair chance I'm doing something wrong here, any pointers?\r\n\r\n``` shell\r\n(env3) michael@dan:~/schema_salad$ make mypy\r\nMYPYPATH=typeshed/2.7 mypy --py2 --disallow-untyped-calls schema_salad\r\nTraceback (most recent call last):\r\n  File \"/home/michael/src/mypy/env3/bin/mypy\", line 6, in <module>\r\n    main(__file__)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/main.py\", line 54, in main\r\n    res = type_check_only(sources, bin_dir, options)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/main.py\", line 102, in type_check_only\r\n    python_path=options.python_path)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/build.py\", line 209, in build\r\n    dispatch(sources, manager)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/build.py\", line 1325, in dispatch\r\n    process_graph(graph, manager)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/build.py\", line 1456, in process_graph\r\n    process_stale_scc(graph, scc)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/build.py\", line 1482, in process_stale_scc\r\n    graph[id].semantic_analysis()\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/build.py\", line 1292, in semantic_analysis\r\n    self.manager.semantic_analyzer.visit_file(self.tree, self.xpath)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 246, in visit_file\r\n    self.accept(d)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 2251, in accept\r\n    node.accept(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/nodes.py\", line 650, in accept\r\n    return visitor.visit_class_def(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 561, in visit_class_def\r\n    defn.defs.accept(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/nodes.py\", line 715, in accept\r\n    return visitor.visit_block(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 1012, in visit_block\r\n    self.accept(s)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 2251, in accept\r\n    node.accept(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/nodes.py\", line 462, in accept\r\n    return visitor.visit_func_def(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 316, in visit_func_def\r\n    self.analyze_function(defn)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 468, in analyze_function\r\n    defn.type = self.anal_type(defn.type)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/semanal.py\", line 1037, in anal_type\r\n    return t.accept(a)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/types.py\", line 496, in accept\r\n    return visitor.visit_callable_type(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/typeanal.py\", line 180, in visit_callable_type\r\n    return t.copy_modified(arg_types=self.anal_array(t.arg_types),\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/typeanal.py\", line 247, in anal_array\r\n    res.append(t.accept(self))\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/types.py\", line 637, in accept\r\n    return visitor.visit_tuple_type(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/typeanal.py\", line 194, in visit_tuple_type\r\n    return TupleType(self.anal_array(t.items), fallback, t.line)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/typeanal.py\", line 247, in anal_array\r\n    res.append(t.accept(self))\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/types.py\", line 340, in accept\r\n    return visitor.visit_type_var(self)\r\n  File \"/home/michael/src/mypy/env3/lib/python3.5/site-packages/mypy/typeanal.py\", line 177, in visit_type_var\r\n    raise RuntimeError('TypeVarType is already analyzed')\r\nRuntimeError: TypeVarType is already analyzed\r\n```\r\n``` diff\r\ndiff --git a/typeshed/2.7/urlparse.pyi b/typeshed/2.7/urlparse.pyi\r\nindex ee2e4c2..b7862c7 100644\r\n--- a/typeshed/2.7/urlparse.pyi\r\n+++ b/typeshed/2.7/urlparse.pyi\r\n@@ -1,6 +1,6 @@\r\n # Stubs for urlparse (Python 2)\r\n \r\n-from typing import Dict, List, NamedTuple, Tuple, Sequence, Union, overload\r\n+from typing import AnyStr, Dict, Generic, List, NamedTuple, Tuple, Sequence, Union, overload\r\n \r\n uses_relative = []  # type: List[str]\r\n uses_netloc = []  # type: List[str]\r\n@@ -24,9 +24,9 @@ class ResultMixin(object):\r\n     def port(self) -> int: ...\r\n \r\n class SplitResult(NamedTuple('SplitResult', [\r\n-        ('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)\r\n-    ]), ResultMixin):\r\n-    def geturl(self) -> str: ...\r\n+        ('scheme', AnyStr), ('netloc', AnyStr), ('path', AnyStr), ('query', AnyStr), ('fragment', AnyStr)\r\n+    ]), ResultMixin, Generic[AnyStr]):\r\n+    def geturl(self) -> AnyStr: ...\r\n \r\n class ParseResult(NamedTuple('ParseResult', [\r\n         ('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),\r\n@@ -35,7 +35,7 @@ class ParseResult(NamedTuple('ParseResult', [\r\n     def geturl(self) -> str: ...\r\n \r\n def urlparse(url: Union[str, unicode], scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ...\r\n-def urlsplit(url: Union[str, unicode], scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ...\r\n+def urlsplit(url: AnyStr, scheme: str = ..., allow_fragments: bool = ...) -> SplitResult[AnyStr]: ...\r\n @overload\r\n def urlunparse(data: Tuple[str, str, str, str, str, str]) -> str: ...\r\n @overload\r\n```"},"comment":{"url":"https://api.github.com/repos/python/typeshed/issues/comments/223694440","html_url":"https://github.com/python/typeshed/issues/236#issuecomment-223694440","issue_url":"https://api.github.com/repos/python/typeshed/issues/236","id":223694440,"user":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T21:05:52Z","updated_at":"2016-06-03T21:05:52Z","body":"Not sure exactly what you are doing or what you are trying. Are you trying to fix something in the urlparse stubs? What exactly is the typeshed/2.7 directory? (I don't have one like that.)"}}
{"actor":{"display_login":"gvanrossum"}}