Skip to content

cachetools.func doesn't work #5617

Closed

Description

@Akuli

Works at runtime, two mypy errors:

from cachetools.func import ttl_cache
@ttl_cache(ttl=0.100, maxsize=10)  # Argument 1 has incompatible type "Callable[[str], int]"; expected <nothing>
def foo(lol: str) -> int:
    return int(lol)

print(foo("123"))  # <nothing> not callable

But it works if I change the first lines to this:

from cachetools import cached, TTLCache
@cached(TTLCache(ttl=0.100, maxsize=10))

Activity

  1. srittau commented on Jun 11, 2021

    @srittau
    Collaborator

    We should try using Callable[[_F], _F] directly, instead of using _RET[_F].

  2. hauntsaninja commented on Jun 11, 2021

    @hauntsaninja
    Collaborator

    Same deal as #5482 (and broken by the same change)

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions