{"action":"created","issue":{"url":"https://api.github.com/repos/python/mypy/issues/2151","repository_url":"https://api.github.com/repos/python/mypy","labels_url":"https://api.github.com/repos/python/mypy/issues/2151/labels{/name}","comments_url":"https://api.github.com/repos/python/mypy/issues/2151/comments","events_url":"https://api.github.com/repos/python/mypy/issues/2151/events","html_url":"https://github.com/python/mypy/issues/2151","id":177603479,"number":2151,"title":"\"Invalid method type\" when referencing a class","user":{"login":"samuelcolvin","id":4039449,"avatar_url":"https://avatars.githubusercontent.com/u/4039449?v=3","gravatar_id":"","url":"https://api.github.com/users/samuelcolvin","html_url":"https://github.com/samuelcolvin","followers_url":"https://api.github.com/users/samuelcolvin/followers","following_url":"https://api.github.com/users/samuelcolvin/following{/other_user}","gists_url":"https://api.github.com/users/samuelcolvin/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelcolvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelcolvin/subscriptions","organizations_url":"https://api.github.com/users/samuelcolvin/orgs","repos_url":"https://api.github.com/users/samuelcolvin/repos","events_url":"https://api.github.com/users/samuelcolvin/events{/privacy}","received_events_url":"https://api.github.com/users/samuelcolvin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-17T19:43:48Z","updated_at":"2016-09-20T15:58:31Z","closed_at":"2016-09-20T15:58:31Z","body":"Best demonstrated with an example:\r\n\r\n```python\r\nclass Foo:\r\n    @classmethod\r\n    def sumstr(cls, i: str) -> int:\r\n        return sum(map(ord, i))\r\n\r\nclass Bar:\r\n    foo_class = Foo\r\n    def run(self) -> int:\r\n        return self.foo_class.sumstr('hello')\r\n        # return Foo.sumstr('hello')  # works fine\r\n\r\nbar = Bar()\r\nv = bar.run()\r\nprint(v)\r\n```\r\n\r\ngives:\r\n```\r\n> mypy foobar.py \r\nfoobar.py: note: In member \"run\" of class \"Bar\":\r\nfoobar.py:9: error: Invalid method type\r\n```\r\n\r\nIf you uncomment `return Foo.sumstr('hello')` and comment out (the equivalent) line above mypy works correctly.\r\n\r\nThe same problem occurs if you initialise the class eg. `return self.foo_class().sumstr('hello')`"},"comment":{"url":"https://api.github.com/repos/python/mypy/issues/comments/248346463","html_url":"https://github.com/python/mypy/issues/2151#issuecomment-248346463","issue_url":"https://api.github.com/repos/python/mypy/issues/2151","id":248346463,"user":{"login":"samuelcolvin","id":4039449,"avatar_url":"https://avatars.githubusercontent.com/u/4039449?v=3","gravatar_id":"","url":"https://api.github.com/users/samuelcolvin","html_url":"https://github.com/samuelcolvin","followers_url":"https://api.github.com/users/samuelcolvin/followers","following_url":"https://api.github.com/users/samuelcolvin/following{/other_user}","gists_url":"https://api.github.com/users/samuelcolvin/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelcolvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelcolvin/subscriptions","organizations_url":"https://api.github.com/users/samuelcolvin/orgs","repos_url":"https://api.github.com/users/samuelcolvin/repos","events_url":"https://api.github.com/users/samuelcolvin/events{/privacy}","received_events_url":"https://api.github.com/users/samuelcolvin/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T15:58:31Z","updated_at":"2016-09-20T15:58:31Z","body":"great, thanks"}}
{"actor":{"display_login":"samuelcolvin"}}