Skip to content

Commit b3ef61f

Browse files
committed
Port to new versions of Django
1 parent 209ad44 commit b3ef61f

34 files changed

+211
-110
lines changed

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
default_language_version:
2+
python: python3.13
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-ast
9+
- id: check-merge-conflict
10+
- id: check-json
11+
- id: check-yaml
12+
- id: check-toml
13+
- id: debug-statements
14+
- id: end-of-file-fixer
15+
- id: mixed-line-ending
16+
- id: no-commit-to-branch
17+
- id: trailing-whitespace
18+
19+
- repo: https://github.com/astral-sh/ruff-pre-commit
20+
rev: v0.11.2
21+
hooks:
22+
- id: ruff
23+
types_or: [ python, pyi ]

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include LICENSE AUTHORS.rst README.rst
1+
include LICENSE AUTHORS.rst README.rst

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHELL := /bin/bash
22

33
PACKAGE_NAME=redis_cache
4-
DJANGO_VERSION?=>=1.11,<4.0
4+
DJANGO_VERSION?=>=1.11,<6.0
55

66
.PHONY: install_requirements
77
install_requirements: requirements*.txt
@@ -21,7 +21,7 @@ clean:
2121

2222
.PHONY: test
2323
test: install_requirements
24-
PYTHONPATH=$(PYTHONPATH): django-admin test --settings=tests.settings -s
24+
PYTHONPATH=$(PYTHONPATH): django-admin test --settings=tests.settings
2525

2626
.PHONY: shell
2727
shell:

docs/conf.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16-
import sys
17-
import os
18-
import shlex
19-
2016
# If extensions (or modules to document with autodoc) are in another directory,
2117
# add these directories to sys.path here. If the directory is relative to the
2218
# documentation root, use os.path.abspath to make it absolute, like shown here.

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ Indices and tables
2323
* :ref:`genindex`
2424
* :ref:`modindex`
2525
* :ref:`search`
26-

install_redis.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
: ${REDIS_VERSION:="4.0.11"}
3+
: ${REDIS_VERSION:="7.4.2"}
44

5-
test -d redis || git clone https://github.com/antirez/redis
5+
test -d redis || git clone https://github.com/redis/redis
66
git -C redis checkout $REDIS_VERSION
77
make -C redis

redis_cache/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
from redis_cache.backends.single import RedisCache
22
from redis_cache.backends.multiple import ShardedRedisCache
33
from redis_cache.backends.dummy import RedisDummyCache
4+
5+
__all__ = [
6+
RedisCache,
7+
ShardedRedisCache,
8+
RedisDummyCache,
9+
]

redis_cache/backends/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, server, params):
4040
"""
4141
Connect to Redis, and set up cache backend.
4242
"""
43-
super(BaseRedisCache, self).__init__(params)
43+
super().__init__(params)
4444
self.server = server
4545
self.servers = get_servers(server)
4646
self.params = params or {}

redis_cache/backends/multiple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ShardedRedisCache(BaseRedisCache):
1010

1111
def __init__(self, server, params):
12-
super(ShardedRedisCache, self).__init__(server, params)
12+
super().__init__(server, params)
1313
self.sharder = HashRing()
1414

1515
for server in self.servers:

redis_cache/backends/single.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
try:
22
import cPickle as pickle
33
except ImportError:
4-
import pickle
4+
import pickle # noqa
5+
56
import random
67

78
from django.core.cache.backends.base import DEFAULT_TIMEOUT
@@ -15,7 +16,7 @@ def __init__(self, server, params):
1516
"""
1617
Connect to Redis, and set up cache backend.
1718
"""
18-
super(RedisCache, self).__init__(server, params)
19+
super().__init__(server, params)
1920

2021
for server in self.servers:
2122
client = self.create_client(server)

0 commit comments

Comments
 (0)