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

[pre-commit.ci] pre-commit autoupdate #763

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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ repos:
# from readme - ruff with autofix must run before
# other formatters, such as black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
rev: v0.11.4
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix , --show-fixes]

- repo: https://github.com/psf/black
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black
4 changes: 2 additions & 2 deletions django_redis/client/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ def sscan(

cursor, result = client.sscan(
key,
match=cast(PatternT, self.encode(match)) if match else None,
match=cast("PatternT", self.encode(match)) if match else None,
count=count,
)
return {self.decode(value) for value in result}
Expand All @@ -1024,7 +1024,7 @@ def sscan_iter(
key = self.make_key(key, version=version)
for value in client.sscan_iter(
key,
match=cast(PatternT, self.encode(match)) if match else None,
match=cast("PatternT", self.encode(match)) if match else None,
count=count,
):
yield self.decode(value)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def test_delete_many_generator(self, cache: RedisCache):
assert bool(res) is False

def test_delete_many_empty_generator(self, cache: RedisCache):
res = cache.delete_many(key for key in cast(List[str], []))
res = cache.delete_many(key for key in cast("List[str]", []))
assert bool(res) is False

def test_incr(self, cache: RedisCache):
Expand Down Expand Up @@ -749,7 +749,7 @@ def test_primary_replica_switching(self, cache: RedisCache):
if isinstance(cache.client, ShardClient):
pytest.skip("ShardClient doesn't support get_client")

cache = cast(RedisCache, caches["sample"])
cache = cast("RedisCache", caches["sample"])
client = cache.client
client._server = ["foo", "bar"]
client._clients = ["Foo", "Bar"]
Expand All @@ -761,7 +761,7 @@ def test_primary_replica_switching_with_index(self, cache: RedisCache):
if isinstance(cache.client, ShardClient):
pytest.skip("ShardClient doesn't support get_client")

cache = cast(RedisCache, caches["sample"])
cache = cast("RedisCache", caches["sample"])
client = cache.client
client._server = ["foo", "bar"]
client._clients = ["Foo", "Bar"]
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cache_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def ignore_exceptions_cache(settings) -> RedisCache:
settings.CACHES = caches_setting
settings.DJANGO_REDIS_IGNORE_EXCEPTIONS = True
settings.DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS = True
return cast(RedisCache, caches["doesnotexist"])
return cast("RedisCache", caches["doesnotexist"])


def test_get_django_omit_exceptions_many_returns_default_arg(
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_get_django_omit_exceptions_priority_1(settings):
caches_setting["doesnotexist"]["OPTIONS"]["IGNORE_EXCEPTIONS"] = True
settings.CACHES = caches_setting
settings.DJANGO_REDIS_IGNORE_EXCEPTIONS = False
cache = cast(RedisCache, caches["doesnotexist"])
cache = cast("RedisCache", caches["doesnotexist"])
assert cache._ignore_exceptions is True
assert cache.get("key") is None

Expand All @@ -68,7 +68,7 @@ def test_get_django_omit_exceptions_priority_2(settings):
caches_setting["doesnotexist"]["OPTIONS"]["IGNORE_EXCEPTIONS"] = False
settings.CACHES = caches_setting
settings.DJANGO_REDIS_IGNORE_EXCEPTIONS = True
cache = cast(RedisCache, caches["doesnotexist"])
cache = cast("RedisCache", caches["doesnotexist"])
assert cache._ignore_exceptions is False
with pytest.raises(ConnectionError):
cache.get("key")
Expand All @@ -84,7 +84,7 @@ def key_prefix_cache(cache: RedisCache, settings) -> Iterable[RedisCache]:

@pytest.fixture
def with_prefix_cache() -> Iterable[RedisCache]:
with_prefix = cast(RedisCache, caches["with_prefix"])
with_prefix = cast("RedisCache", caches["with_prefix"])
yield with_prefix
with_prefix.clear()

Expand Down
Loading