Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support type hints for Python 2.7 and straddling code #24

Closed
hackerkid opened this issue Aug 15, 2017 · 3 comments
Closed

Support type hints for Python 2.7 and straddling code #24

hackerkid opened this issue Aug 15, 2017 · 3 comments

Comments

@hackerkid
Copy link

from typing import List

def hello(): # type: () -> None
    print 'hello'

class Example:
    def method(self, lst, opt=0, *args, **kwargs):
        # type: (List[str], int, *str, **bool) -> int
        print("Do stuff")

Running autoflake --remove-all-unused-imports would remove from typing import List. This should not be the case as List import is used for defining the type.

@myint
Copy link
Member

myint commented Aug 16, 2017

autoflake is just removing what pyflakes reports, so it might be good to report it there.

@jaens
Copy link

jaens commented Aug 22, 2017

Looks like there's already an issue about type comments for pyflakes: PyCQA/pyflakes#247

@asottile
Copy link
Member

asottile commented Jul 7, 2019

this should just work now with the latest pyflakes 2.x after my patch here: PyCQA/pyflakes#400

@myint myint closed this as completed Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants