Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add py.typed marker and stub for decorator type #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added memoize/py.typed
Empty file.
17 changes: 17 additions & 0 deletions memoize/wrapper.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Callable, TypeVar, overload

from memoize.configuration import CacheConfiguration
from memoize.invalidation import InvalidationSupport

FN = TypeVar('FN', bound=Callable)


@overload
def memoize(*, configuration: CacheConfiguration = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configuration and invalidation are optional and should be marked accordingly (Optional from typing).

invalidation: InvalidationSupport = None) -> Callable[[FN], FN]: ...


@overload
def memoize(method: FN,
configuration: CacheConfiguration = None,
invalidation: InvalidationSupport = None) -> FN: ...
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def prepare_description():
url='https://github.com/DreamLab/memoize',
maintainer='DreamLab',
packages=['memoize'],
package_data={'memoize': ['py.typed']},
test_suite='tests',
license='Apache License 2.0',
description=('Caching library for asynchronous Python applications (both based on asyncio and Tornado) '
Expand Down