anentropic / python-waterloo

A cli tool to convert type annotations found in 'Google-style' docstrings into mypy py2 type comments (and from there into py3 type annotations).
2 stars 0 forks source link

maybe "cls" arg shouldn't automatically be treated as non-annotatable #50

Closed anentropic closed 3 years ago

anentropic commented 3 years ago

here cls does not require annotation

@classmethod
def method(cls, whatever)
    ...

but here it does:

def regular_function(cls, whatever)
    ...

waterloo currently just has a dumb special case for cls and self args in first position, without considering context

...meaning if you annotate the cls arg of a regular function waterloo will complain it "has arg names which are inconsistent with the function signature"

(if you use other names than self and cls for method/classmethod first arg it probably breaks currently too)