diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0e996f00..184baa47 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -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.6
   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
diff --git a/django_redis/client/default.py b/django_redis/client/default.py
index 940e1a0e..07ee7250 100644
--- a/django_redis/client/default.py
+++ b/django_redis/client/default.py
@@ -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}
@@ -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)
diff --git a/tests/test_backend.py b/tests/test_backend.py
index 193d6b23..65d97fed 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -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):
@@ -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"]
@@ -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"]
diff --git a/tests/test_cache_options.py b/tests/test_cache_options.py
index 6f16376b..cdd7c819 100644
--- a/tests/test_cache_options.py
+++ b/tests/test_cache_options.py
@@ -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(
@@ -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
 
@@ -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")
@@ -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()