Skip to content

Commit 6eafc0e

Browse files
committed
Merge branch '2.3.x' into 3.0.x
2 parents d30ef25 + ac6859f commit 6eafc0e

24 files changed

+102
-142
lines changed

.flake8

Lines changed: 0 additions & 29 deletions
This file was deleted.

.gitignore

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
1-
MANIFEST
2-
build
3-
dist
4-
/src/Werkzeug.egg-info
5-
*.pyc
6-
*.pyo
7-
.venv
8-
.DS_Store
9-
docs/_build
10-
bench/a
11-
bench/b
12-
.tox
1+
.idea/
2+
.vscode/
3+
__pycache__/
4+
.pytest_cache/
5+
.tox/
136
.coverage
147
.coverage.*
15-
coverage_out
16-
htmlcov
17-
.cache
18-
.xprocess
19-
.hypothesis
20-
test_uwsgi_failed
21-
.idea
22-
.pytest_cache/
8+
htmlcov/
9+
docs/_build/
10+
dist/
2311
venv/
24-
.vscode
25-
.mypy_cache/
26-
.dmypy.json

.pre-commit-config.yaml

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
11
ci:
2-
autoupdate_branch: "2.3.x"
32
autoupdate_schedule: monthly
43
repos:
5-
- repo: https://github.com/asottile/pyupgrade
6-
rev: v3.10.1
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.1.5
76
hooks:
8-
- id: pyupgrade
9-
args: ["--py38-plus"]
10-
- repo: https://github.com/asottile/reorder-python-imports
11-
rev: v3.10.0
12-
hooks:
13-
- id: reorder-python-imports
14-
name: Reorder Python imports (src, tests)
15-
files: "^(?!examples/)"
16-
args: ["--application-directories", ".:src"]
17-
- id: reorder-python-imports
18-
name: Reorder Python imports (examples)
19-
files: "^examples/"
20-
args: ["--application-directories", "examples"]
21-
- repo: https://github.com/psf/black
22-
rev: 23.7.0
23-
hooks:
24-
- id: black
25-
- repo: https://github.com/PyCQA/flake8
26-
rev: 6.1.0
27-
hooks:
28-
- id: flake8
29-
additional_dependencies:
30-
- flake8-bugbear
31-
- flake8-implicit-str-concat
32-
- repo: https://github.com/peterdemin/pip-compile-multi
33-
rev: v2.6.3
34-
hooks:
35-
- id: pip-compile-multi-verify
7+
- id: ruff
8+
- id: ruff-format
369
- repo: https://github.com/pre-commit/pre-commit-hooks
37-
rev: v4.4.0
10+
rev: v4.5.0
3811
hooks:
12+
- id: check-merge-conflict
13+
- id: debug-statements
3914
- id: fix-byte-order-marker
4015
- id: trailing-whitespace
4116
- id: end-of-file-fixer
42-
exclude: "^tests/.*.http$"

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,28 @@ module = [
102102
"xprocess.*",
103103
]
104104
ignore_missing_imports = true
105+
106+
[tool.ruff]
107+
extend-exclude = ["examples/"]
108+
src = ["src"]
109+
fix = false
110+
show-fixes = true
111+
show-source = true
112+
113+
[tool.ruff.lint]
114+
select = [
115+
"B", # flake8-bugbear
116+
"E", # pycodestyle error
117+
"F", # pyflakes
118+
#"I", # isort
119+
"UP", # pyupgrade
120+
"W", # pycodestyle warning
121+
]
122+
ignore = [
123+
"E402" # allow circular imports at end of file
124+
]
125+
ignore-init-module-imports = true
126+
127+
[tool.ruff.lint.isort]
128+
force-single-line = true
129+
order-by-type = false

src/werkzeug/datastructures/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def to_header(self) -> str:
124124
if self.type == "basic":
125125
value = base64.b64encode(
126126
f"{self.username}:{self.password}".encode()
127-
).decode("utf8")
127+
).decode("ascii")
128128
return f"Basic {value}"
129129

130130
if self.token is not None:

src/werkzeug/datastructures/mixins.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ImmutableListMixin(list[V]):
2121
_hash_cache: int | None
2222
def __hash__(self) -> int: ... # type: ignore
2323
def __delitem__(self, key: SupportsIndex | slice) -> NoReturn: ...
24-
def __iadd__(self, other: t.Any) -> NoReturn: ... # type: ignore
24+
def __iadd__(self, other: Any) -> NoReturn: ... # type: ignore
2525
def __imul__(self, other: SupportsIndex) -> NoReturn: ...
2626
def __setitem__(self, key: int | slice, value: V) -> NoReturn: ... # type: ignore
2727
def append(self, value: V) -> NoReturn: ...

src/werkzeug/datastructures/structures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class MultiDict(TypeConversionDict):
146146

147147
def __init__(self, mapping=None):
148148
if isinstance(mapping, MultiDict):
149-
dict.__init__(self, ((k, l[:]) for k, l in mapping.lists()))
149+
dict.__init__(self, ((k, vs[:]) for k, vs in mapping.lists()))
150150
elif isinstance(mapping, dict):
151151
tmp = {}
152152
for key, value in mapping.items():

src/werkzeug/debug/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _generate() -> str | bytes | None:
110110
guid, guid_type = winreg.QueryValueEx(rk, "MachineGuid")
111111

112112
if guid_type == winreg.REG_SZ:
113-
return guid.encode("utf-8")
113+
return guid.encode()
114114

115115
return guid
116116
except OSError:
@@ -193,7 +193,7 @@ def get_pin_and_cookie_name(
193193
if not bit:
194194
continue
195195
if isinstance(bit, str):
196-
bit = bit.encode("utf-8")
196+
bit = bit.encode()
197197
h.update(bit)
198198
h.update(b"cookiesalt")
199199

src/werkzeug/debug/repr.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ def __call__(self, topic: t.Any | None = None) -> None:
8080
helper = _Helper()
8181

8282

83-
def _add_subclass_info(
84-
inner: str, obj: object, base: t.Type | tuple[t.Type, ...]
85-
) -> str:
83+
def _add_subclass_info(inner: str, obj: object, base: type | tuple[type, ...]) -> str:
8684
if isinstance(base, tuple):
8785
for cls in base:
8886
if type(obj) is cls:
@@ -96,7 +94,7 @@ def _add_subclass_info(
9694

9795

9896
def _sequence_repr_maker(
99-
left: str, right: str, base: t.Type, limit: int = 8
97+
left: str, right: str, base: type, limit: int = 8
10098
) -> t.Callable[[DebugReprGenerator, t.Iterable, bool], str]:
10199
def proxy(self: DebugReprGenerator, obj: t.Iterable, recursive: bool) -> str:
102100
if recursive:

src/werkzeug/debug/tbtools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ def all_tracebacks(
265265
@cached_property
266266
def all_frames(self) -> list[DebugFrameSummary]:
267267
return [
268-
f for _, te in self.all_tracebacks for f in te.stack # type: ignore[misc]
268+
f # type: ignore[misc]
269+
for _, te in self.all_tracebacks
270+
for f in te.stack
269271
]
270272

271273
def render_traceback_text(self) -> str:

0 commit comments

Comments
 (0)