grantjenks / python-diskcache

Python disk-backed cache (Django-compatible). Faster than Redis and Memcached. Pure-Python.

Home Page:http://www.grantjenks.com/docs/diskcache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memoize decorate will remove the type hint of the original function

MacHu-GWU opened this issue · comments

If you put Cache.memoize on a custom function, you will lose the type hint when using that function

from diskcache import Cache

cache = Cache(directory=...)

@cache.memorize
def hello(name: str):
    return f"hello {name}"

hello(...) # when you type this, you won't see name as argument in VSCode PyCharm etc ...

@grantjenks thank you for the great work!

I found an issue and also send a PR to fix it. Wish I could contribute a little

#277

Let’s discuss in the PR.