dropbox / pyannotate

Auto-generate PEP-484 annotations
Apache License 2.0
1.42k stars 59 forks source link

NameError: name 'method' is not defined #29

Closed kura closed 6 years ago

kura commented 6 years ago

When using pyannonate to generate and apply annotations, one of the the return values I have is a method. Pyannotate generates the following return value:

# ... -> method

When using this return value, I get the following error:

NameError: name 'method' is not defined

I'm not sure exactly what this return type should be changed to. I can't point it at a specific method using single quotes, i.e.

# ... -> 'some_method'

Because it can return one of a number of methods.

So what would the correct value actually be?

JukkaL commented 6 years ago

The best we can easily do is to generate Callable (or Callable[..., Any]) as the type instead of method. We already do that transformation for some other types, so the implementation will be trivial (just add a line around https://github.com/dropbox/pyannotate/blob/master/pyannotate_tools/annotations/parse.py#L49).

kura commented 6 years ago

@JukkaL thanks. So just like https://github.com/dropbox/pyannotate/issues/19 basically.