{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/797","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/797/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/797/comments","events_url":"https://api.github.com/repos/python/mypy/issues/797/events","html_url":"https://github.com/python/mypy/issues/797","id":101718228,"number":797,"title":"Classes with __call__ defined should be a subtype of Callable","user":{"login":"zhangwen0411","id":11740593,"avatar_url":"https://avatars.githubusercontent.com/u/11740593?v=3","gravatar_id":"","url":"https://api.github.com/users/zhangwen0411","html_url":"https://github.com/zhangwen0411","followers_url":"https://api.github.com/users/zhangwen0411/followers","following_url":"https://api.github.com/users/zhangwen0411/following{/other_user}","gists_url":"https://api.github.com/users/zhangwen0411/gists{/gist_id}","starred_url":"https://api.github.com/users/zhangwen0411/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhangwen0411/subscriptions","organizations_url":"https://api.github.com/users/zhangwen0411/orgs","repos_url":"https://api.github.com/users/zhangwen0411/repos","events_url":"https://api.github.com/users/zhangwen0411/events{/privacy}","received_events_url":"https://api.github.com/users/zhangwen0411/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/python/mypy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/python/mypy/milestones/6","html_url":"https://github.com/python/mypy/milestones/0.5","labels_url":"https://api.github.com/repos/python/mypy/milestones/6/labels","id":1616659,"number":6,"title":"0.5","description":"","creator":{"login":"ddfisher","id":245905,"avatar_url":"https://avatars.githubusercontent.com/u/245905?v=3","gravatar_id":"","url":"https://api.github.com/users/ddfisher","html_url":"https://github.com/ddfisher","followers_url":"https://api.github.com/users/ddfisher/followers","following_url":"https://api.github.com/users/ddfisher/following{/other_user}","gists_url":"https://api.github.com/users/ddfisher/gists{/gist_id}","starred_url":"https://api.github.com/users/ddfisher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddfisher/subscriptions","organizations_url":"https://api.github.com/users/ddfisher/orgs","repos_url":"https://api.github.com/users/ddfisher/repos","events_url":"https://api.github.com/users/ddfisher/events{/privacy}","received_events_url":"https://api.github.com/users/ddfisher/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":3,"state":"open","created_at":"2016-03-01T23:42:18Z","updated_at":"2016-06-02T23:44:40Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-08-18T18:17:51Z","updated_at":"2016-06-04T02:33:29Z","closed_at":null,"body":"```\r\ndef apply(f: Callable[[int], int], x: int) -> int:\r\n  return f(x)\r\n\r\nclass Add5(object):\r\n  def __call__(self, x: int) -> int:\r\n    return x + 5\r\n\r\napply(Add5(), 5)\r\n```\r\nThis code snippet doesn't type check because Mypy doesn't treat Add5() as a Callable[[int], int]"},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/223731348","html_url":"https://github.com/python/mypy/issues/797#issuecomment-223731348","issue_url":"https://api.github.com/repos/python/mypy/issues/797","id":223731348,"user":{"login":"margaret","id":1811496,"avatar_url":"https://avatars.githubusercontent.com/u/1811496?v=3","gravatar_id":"","url":"https://api.github.com/users/margaret","html_url":"https://github.com/margaret","followers_url":"https://api.github.com/users/margaret/followers","following_url":"https://api.github.com/users/margaret/following{/other_user}","gists_url":"https://api.github.com/users/margaret/gists{/gist_id}","starred_url":"https://api.github.com/users/margaret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/margaret/subscriptions","organizations_url":"https://api.github.com/users/margaret/orgs","repos_url":"https://api.github.com/users/margaret/repos","events_url":"https://api.github.com/users/margaret/events{/privacy}","received_events_url":"https://api.github.com/users/margaret/received_events","type":"User","site_admin":false},"created_at":"2016-06-04T02:33:29Z","updated_at":"2016-06-04T02:33:29Z","body":"WIP at https://github.com/margaret/mypy/tree/user_defined_callable\r\nCurrently debugging broken tests, specifically \r\n```\r\nclass A(type):\r\n    def __init__(self) -> None: pass\r\ndef f(x: type): pass\r\nf(A())\r\n```\r\nDoes not work and returns\r\n`error: Argument 1 to \"f\" has incompatible type Callable[[Any, Any], Any]; expected \"type\"`"}}
{"actor":{"display_login":"margaret"}}