Skip to content

type signature preservation does not support class arguments #18

Description

@bmc-msft

Example source:

from memoization import cached
import inspect

class A:
    @cached(ttl=1)
    def b(self, name: str) -> int:
        return len(name) * 2

    def a(self) -> bool:
        return self.b('hello') == 10

Using mypy for the above example gives the error:

/tmp/as-class.py:10: error: Too few arguments for "b" of "A"
/tmp/as-class.py:10: error: Argument 1 to "b" of "A" has incompatible type "str"; expected "A"

If you comment out the @cached line, mypy gives the response:

Success: no issues found in 1 source file

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-0-highThis issue has a high priority

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions