Skip to content

Commit 1450596

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2621bbf commit 1450596

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Diff for: django_redis/client/default.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ def sscan(
10011001

10021002
cursor, result = client.sscan(
10031003
key,
1004-
match=cast(PatternT, self.encode(match)) if match else None,
1004+
match=cast("PatternT", self.encode(match)) if match else None,
10051005
count=count,
10061006
)
10071007
return {self.decode(value) for value in result}
@@ -1024,7 +1024,7 @@ def sscan_iter(
10241024
key = self.make_key(key, version=version)
10251025
for value in client.sscan_iter(
10261026
key,
1027-
match=cast(PatternT, self.encode(match)) if match else None,
1027+
match=cast("PatternT", self.encode(match)) if match else None,
10281028
count=count,
10291029
):
10301030
yield self.decode(value)

Diff for: tests/test_backend.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_delete_many_generator(self, cache: RedisCache):
300300
assert bool(res) is False
301301

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

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

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

764-
cache = cast(RedisCache, caches["sample"])
764+
cache = cast("RedisCache", caches["sample"])
765765
client = cache.client
766766
client._server = ["foo", "bar"]
767767
client._clients = ["Foo", "Bar"]

Diff for: tests/test_cache_options.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def ignore_exceptions_cache(settings) -> RedisCache:
2626
settings.CACHES = caches_setting
2727
settings.DJANGO_REDIS_IGNORE_EXCEPTIONS = True
2828
settings.DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS = True
29-
return cast(RedisCache, caches["doesnotexist"])
29+
return cast("RedisCache", caches["doesnotexist"])
3030

3131

3232
def test_get_django_omit_exceptions_many_returns_default_arg(
@@ -58,7 +58,7 @@ def test_get_django_omit_exceptions_priority_1(settings):
5858
caches_setting["doesnotexist"]["OPTIONS"]["IGNORE_EXCEPTIONS"] = True
5959
settings.CACHES = caches_setting
6060
settings.DJANGO_REDIS_IGNORE_EXCEPTIONS = False
61-
cache = cast(RedisCache, caches["doesnotexist"])
61+
cache = cast("RedisCache", caches["doesnotexist"])
6262
assert cache._ignore_exceptions is True
6363
assert cache.get("key") is None
6464

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

8585
@pytest.fixture
8686
def with_prefix_cache() -> Iterable[RedisCache]:
87-
with_prefix = cast(RedisCache, caches["with_prefix"])
87+
with_prefix = cast("RedisCache", caches["with_prefix"])
8888
yield with_prefix
8989
with_prefix.clear()
9090

0 commit comments

Comments
 (0)