Skip to content

Commit 3263217

Browse files
Rob Hudsonrobhudson
authored andcommitted
Update project details
This mainly updates the tox matrix to drop Python < 3.12 for Django main branch which shifted to Django 6.0 development.
1 parent 948a07b commit 3263217

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88
repos:
99
# Note: hooks that add content must run before ones which check formatting, lint, etc
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.6.0
11+
rev: v5.0.0
1212
hooks:
1313
- id: check-yaml
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.6.4
17+
rev: v0.9.2
1818
hooks:
1919
# Run the linter
2020
- id: ruff
2121
args: [--fix, --exit-non-zero-on-fix]
2222
# Run the formatter
2323
- id: ruff-format
2424
- repo: https://github.com/tox-dev/pyproject-fmt
25-
rev: 2.2.3
25+
rev: v2.5.0
2626
hooks:
2727
- id: pyproject-fmt
2828
- repo: https://github.com/adamchainz/blacken-docs
29-
rev: 1.18.0
29+
rev: 1.19.1
3030
hooks:
3131
- id: blacken-docs
3232
additional_dependencies:

csp/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Type
1+
from typing import Any
22

33
HEADER = "Content-Security-Policy"
44
HEADER_REPORT_ONLY = "Content-Security-Policy-Report-Only"
@@ -17,7 +17,7 @@
1717
class Nonce:
1818
_instance = None
1919

20-
def __new__(cls: Type["Nonce"], *args: Any, **kwargs: Any) -> "Nonce":
20+
def __new__(cls: type["Nonce"], *args: Any, **kwargs: Any) -> "Nonce":
2121
if cls._instance is None:
2222
cls._instance = super().__new__(cls)
2323
return cls._instance

csp/utils.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import copy
44
import re
5-
from collections import OrderedDict
65
from itertools import chain
7-
from typing import Any, Callable, Dict
6+
from typing import Any, Callable
87

98
from django.conf import settings
109
from django.utils.encoding import force_str
@@ -52,7 +51,7 @@
5251
"block-all-mixed-content": None, # Deprecated.
5352
}
5453

55-
DIRECTIVES_T = Dict[str, Any]
54+
DIRECTIVES_T = dict[str, Any]
5655

5756

5857
def default_config(csp: DIRECTIVES_T | None) -> DIRECTIVES_T | None:
@@ -172,15 +171,16 @@ def _async_attr_mapper(attr_name: str, val: str | bool) -> str:
172171

173172

174173
# Allow per-attribute customization of returned string template
175-
SCRIPT_ATTRS: dict[str, Callable[[str, Any], str]] = OrderedDict()
176-
SCRIPT_ATTRS["nonce"] = _default_attr_mapper
177-
SCRIPT_ATTRS["id"] = _default_attr_mapper
178-
SCRIPT_ATTRS["src"] = _default_attr_mapper
179-
SCRIPT_ATTRS["type"] = _default_attr_mapper
180-
SCRIPT_ATTRS["async"] = _async_attr_mapper
181-
SCRIPT_ATTRS["defer"] = _bool_attr_mapper
182-
SCRIPT_ATTRS["integrity"] = _default_attr_mapper
183-
SCRIPT_ATTRS["nomodule"] = _bool_attr_mapper
174+
SCRIPT_ATTRS: dict[str, Callable[[str, Any], str]] = {
175+
"nonce": _default_attr_mapper,
176+
"id": _default_attr_mapper,
177+
"src": _default_attr_mapper,
178+
"type": _default_attr_mapper,
179+
"async": _async_attr_mapper,
180+
"defer": _bool_attr_mapper,
181+
"integrity": _default_attr_mapper,
182+
"nomodule": _bool_attr_mapper,
183+
}
184184

185185
# Generates an interpolatable string of valid attrs eg - '{nonce}{id}...'
186186
ATTR_FORMAT_STR = "".join([f"{{{a}}}" for a in SCRIPT_ATTRS])

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ classifiers = [
2323
"Framework :: Django :: 4.2",
2424
"Framework :: Django :: 5.0",
2525
"Framework :: Django :: 5.1",
26+
"Framework :: Django :: 5.2",
2627
"Intended Audience :: Developers",
2728
"License :: OSI Approved :: BSD License",
2829
"Operating System :: OS Independent",
@@ -87,7 +88,7 @@ include-package-data = true
8788
find = { namespaces = false }
8889

8990
[tool.ruff]
90-
target-version = "py38"
91+
target-version = "py39"
9192
line-length = 150
9293
indent-width = 4
9394
extend-exclude = [

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[tox]
22
isolated_build = True
33
envlist =
4-
{3.10,3.11,3.12,3.13,pypy310}-dj{4.2,5.0,5.1,main}
4+
{3.12,3.13}-djmain
5+
{3.10,3.11,3.12,3.13,pypy310}-dj{5.0,5.1}
56
{3.9,3.10,3.11,3.12,3.13,pypy39,pypy310}-dj4.2
67
{3.9,3.10,3.11,3.12,3.13,pypy39,pypy310}-types
78

89

910
# Don't run coverage when testing with pypy:
1011
# see https://github.com/nedbat/coveragepy/issues/1382
11-
[testenv:pypy{39,310}-dj4.2,pypy310-dj{5.0,5.1,main}]
12+
[testenv:pypy{39,310}-dj4.2,pypy310-dj{5.0,5.1}]
1213
commands =
1314
pytest {toxinidir}/csp
1415

0 commit comments

Comments
 (0)