Update hints for latest dogpile.cache
Change-Id: I1557db4576a0aa20bb744f3ab314e72987d7b106 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -29,7 +29,7 @@ repos:
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies: [
|
||||
'dogpile.cache',
|
||||
'dogpile.cache>=1.5.0',
|
||||
]
|
||||
# keep this in-sync with '[tool.mypy] exclude' in 'pyproject.toml'
|
||||
exclude: |
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
"""dogpile.cache backend that uses dictionary for storage"""
|
||||
|
||||
from collections.abc import Sequence, Mapping
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from typing import Any
|
||||
|
||||
from dogpile.cache import api
|
||||
@@ -57,7 +57,7 @@ class DictCacheBackend(api.CacheBackend):
|
||||
return value
|
||||
|
||||
def get_multi(
|
||||
self, keys: Sequence[api.KeyType]
|
||||
self, keys: Iterable[api.KeyType]
|
||||
) -> Sequence[api.BackendFormatted]:
|
||||
"""Retrieves the value for a list of keys."""
|
||||
return [self.get(key) for key in keys]
|
||||
@@ -94,7 +94,7 @@ class DictCacheBackend(api.CacheBackend):
|
||||
"""
|
||||
self.cache.pop(key, None)
|
||||
|
||||
def delete_multi(self, keys: Sequence[api.KeyType]) -> None:
|
||||
def delete_multi(self, keys: Iterable[api.KeyType]) -> None:
|
||||
"""Deletes the value associated with each key in list if it exists.
|
||||
|
||||
:param keys: list of dictionary keys
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
"""dogpile.cache backend that uses etcd 3.x for storage"""
|
||||
|
||||
from collections.abc import Sequence, Mapping
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from typing import Any
|
||||
|
||||
from dogpile.cache import api
|
||||
@@ -56,7 +56,7 @@ class Etcd3gwCacheBackend(api.CacheBackend):
|
||||
return api.CachedValue(value, metadata)
|
||||
|
||||
def get_multi(
|
||||
self, keys: Sequence[api.KeyType]
|
||||
self, keys: Iterable[api.KeyType]
|
||||
) -> Sequence[api.BackendFormatted]:
|
||||
"""Retrieves the value for a list of keys."""
|
||||
return [self.get(key) for key in keys]
|
||||
@@ -76,6 +76,6 @@ class Etcd3gwCacheBackend(api.CacheBackend):
|
||||
def delete(self, key: api.KeyType) -> None:
|
||||
self._client.delete(key)
|
||||
|
||||
def delete_multi(self, keys: Sequence[api.KeyType]) -> None:
|
||||
def delete_multi(self, keys: Iterable[api.KeyType]) -> None:
|
||||
for key in keys:
|
||||
self._client.delete(key)
|
||||
|
||||
@@ -36,7 +36,7 @@ The library has special public value for nonexistent or expired keys called
|
||||
NO_VALUE = core.NO_VALUE
|
||||
"""
|
||||
|
||||
from collections.abc import Callable, Mapping, Sequence
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
import socket
|
||||
import ssl
|
||||
from typing import Any
|
||||
@@ -89,7 +89,7 @@ class _DebugProxy(proxy.ProxyBackend):
|
||||
return value
|
||||
|
||||
def get_multi(
|
||||
self, keys: Sequence[api.KeyType]
|
||||
self, keys: Iterable[api.KeyType]
|
||||
) -> Sequence[api.BackendFormatted]:
|
||||
values = self.proxied.get_multi(keys)
|
||||
_LOG.debug(
|
||||
@@ -115,7 +115,7 @@ class _DebugProxy(proxy.ProxyBackend):
|
||||
self.proxied.delete(key)
|
||||
_LOG.debug('CACHE_DELETE: "%r"', key)
|
||||
|
||||
def delete_multi(self, keys: Sequence[api.KeyType]) -> None:
|
||||
def delete_multi(self, keys: Iterable[api.KeyType]) -> None:
|
||||
_LOG.debug('CACHE_DELETE_MULTI: "%r"', keys)
|
||||
self.proxied.delete_multi(keys)
|
||||
|
||||
@@ -464,7 +464,7 @@ def _key_generate_to_str(s: Any) -> str:
|
||||
|
||||
|
||||
def function_key_generator(
|
||||
namespace: str | None,
|
||||
namespace: str,
|
||||
fn: Callable[..., Any],
|
||||
to_str: Callable[[Any], str] = _key_generate_to_str,
|
||||
) -> Callable[..., str]:
|
||||
|
||||
Reference in New Issue
Block a user