diff --git a/ext/dogpile/__init__.py b/ext/dogpile/__init__.py index bcad4612a61..e4b57bf4614 100644 --- a/ext/dogpile/__init__.py +++ b/ext/dogpile/__init__.py @@ -1,4 +1,4 @@ -__version__ = "1.2.1" +__version__ = "1.2.2" from .lock import Lock # noqa from .lock import NeedRegenerationException # noqa diff --git a/ext/dogpile/cache/api.py b/ext/dogpile/cache/api.py index c773463b29a..d8436ca4c14 100644 --- a/ext/dogpile/cache/api.py +++ b/ext/dogpile/cache/api.py @@ -9,6 +9,8 @@ from typing import Sequence from typing import Union +from ..util.typing import Self + class NoValue: """Describe a missing cache value. @@ -18,7 +20,7 @@ class NoValue: """ @property - def payload(self): + def payload(self) -> Self: return self def __repr__(self): @@ -190,7 +192,9 @@ def __init__(self, arguments: BackendArguments): # pragma NO COVERAGE raise NotImplementedError() @classmethod - def from_config_dict(cls, config_dict, prefix): + def from_config_dict( + cls, config_dict: Mapping[str, Any], prefix: str + ) -> Self: prefix_len = len(prefix) return cls( dict( diff --git a/ext/dogpile/cache/proxy.py b/ext/dogpile/cache/proxy.py index bf6e296b4cb..cd6120b9a94 100644 --- a/ext/dogpile/cache/proxy.py +++ b/ext/dogpile/cache/proxy.py @@ -9,7 +9,6 @@ .. versionadded:: 0.5.0 Added support for the :class:`.ProxyBackend` class. """ - from typing import Mapping from typing import Optional from typing import Sequence @@ -20,6 +19,7 @@ from .api import CacheMutex from .api import KeyType from .api import SerializedReturnType +from ..util.typing import Self class ProxyBackend(CacheBackend): @@ -67,7 +67,7 @@ def get(self, key): def __init__(self, *arg, **kw): pass - def wrap(self, backend: CacheBackend) -> "ProxyBackend": + def wrap(self, backend: CacheBackend) -> Self: """Take a backend as an argument and setup the self.proxied property. Return an object that be used as a backend by a :class:`.CacheRegion` object. diff --git a/ext/dogpile/cache/region.py b/ext/dogpile/cache/region.py index 79f7eaab1c7..7952157a580 100644 --- a/ext/dogpile/cache/region.py +++ b/ext/dogpile/cache/region.py @@ -46,6 +46,7 @@ from ..util import memoized_property from ..util import NameRegistry from ..util import PluginLoader +from ..util.typing import Self value_version = 2 """An integer placed in the :class:`.CachedValue` @@ -426,7 +427,7 @@ def configure( wrap: Sequence[Union[ProxyBackend, Type[ProxyBackend]]] = (), replace_existing_backend: bool = False, region_invalidator: Optional[RegionInvalidationStrategy] = None, - ) -> "CacheRegion": + ) -> Self: """Configure a :class:`.CacheRegion`. The :class:`.CacheRegion` itself diff --git a/ext/dogpile/util/typing.py b/ext/dogpile/util/typing.py new file mode 100644 index 00000000000..218c42945a5 --- /dev/null +++ b/ext/dogpile/util/typing.py @@ -0,0 +1,6 @@ +import sys + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # noqa: F401 diff --git a/ext/readme.md b/ext/readme.md index a0a1aa80aed..1f62d5216d5 100644 --- a/ext/readme.md +++ b/ext/readme.md @@ -18,7 +18,7 @@ ext | `decorator` | [4.4.0](https://pypi.org/project/decorator/4.4.0/) | `valida ext | `deluge-client` | [1.9.0](https://pypi.org/project/deluge-client/1.9.0/) | **`medusa`** | Module: `deluge_client` ext | **`deprecated`** | [1.2.3](https://pypi.org/project/deprecated/1.2.3/) | `PyGithub` | - ext | **`diskcache`** | [5.2.1](https://pypi.org/project/diskcache/5.2.1/) | `imdbpie` | - -ext | `dogpile.cache` | [1.2.1](https://pypi.org/project/dogpile.cache/1.2.1/) | **`medusa`**, `subliminal` | Module: `dogpile` +ext | `dogpile.cache` | [1.2.2](https://pypi.org/project/dogpile.cache/1.2.2/) | **`medusa`**, `subliminal` | Module: `dogpile` ext | **`enzyme`** | pymedusa/[665cf69](https://github.com/pymedusa/enzyme/tree/665cf6948aab1c249dcc99bd9624a81d17b3302a) | `knowit`, `subliminal` | - ext | **`feedparser`** | [6.0.10](https://pypi.org/project/feedparser/6.0.10/) | **`medusa`** | Requires `sgmllib3k` on Python 3 ext | **`gntp`** | [1.0.3](https://pypi.org/project/gntp/1.0.3/) | **`medusa`** | -