From b217279ce09a868aa681306554848b7267baf6d6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:50:35 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit.git: v0.13.3 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit.git/compare/v0.13.3...v0.15.9) - [github.com/astral-sh/ruff-pre-commit.git: v0.13.3 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit.git/compare/v0.13.3...v0.15.9) - [github.com/asottile/add-trailing-comma.git: v3.2.0 → v4.0.0](https://github.com/asottile/add-trailing-comma.git/compare/v3.2.0...v4.0.0) - [github.com/astral-sh/ruff-pre-commit.git: v0.13.3 → v0.15.9](https://github.com/astral-sh/ruff-pre-commit.git/compare/v0.13.3...v0.15.9) - [github.com/Lucas-C/pre-commit-hooks.git: v1.5.5 → v1.5.6](https://github.com/Lucas-C/pre-commit-hooks.git/compare/v1.5.5...v1.5.6) - [github.com/python-jsonschema/check-jsonschema.git: 0.34.0 → 0.37.1](https://github.com/python-jsonschema/check-jsonschema.git/compare/0.34.0...0.37.1) - [github.com/adrienverge/yamllint.git: v1.37.1 → v1.38.0](https://github.com/adrienverge/yamllint.git/compare/v1.37.1...v1.38.0) - [github.com/pre-commit/mirrors-mypy.git: v1.18.2 → v1.20.0](https://github.com/pre-commit/mirrors-mypy.git/compare/v1.18.2...v1.20.0) - [github.com/pre-commit/mirrors-mypy.git: v1.14.1 → v1.20.0](https://github.com/pre-commit/mirrors-mypy.git/compare/v1.14.1...v1.20.0) - [github.com/pre-commit/mirrors-mypy.git: v1.18.2 → v1.20.0](https://github.com/pre-commit/mirrors-mypy.git/compare/v1.18.2...v1.20.0) - [github.com/PyCQA/pylint.git: v3.3.9 → v4.0.5](https://github.com/PyCQA/pylint.git/compare/v3.3.9...v4.0.5) --- .pre-commit-config.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4c1d1a1b6..fe7b03170f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,7 +60,7 @@ repos: - id: no_optional - repo: https://github.com/astral-sh/ruff-pre-commit.git - rev: v0.13.3 + rev: v0.15.9 hooks: - id: ruff args: @@ -68,31 +68,31 @@ repos: - --fix # NOTE: When `--fix` is used, linting should be before ruff-format - repo: https://github.com/astral-sh/ruff-pre-commit.git - rev: v0.13.3 + rev: v0.15.9 hooks: - id: ruff-format alias: ruff-format-first-pass name: ruff-format (first pass) - repo: https://github.com/asottile/add-trailing-comma.git - rev: v3.2.0 + rev: v4.0.0 hooks: - id: add-trailing-comma - repo: https://github.com/astral-sh/ruff-pre-commit.git - rev: v0.13.3 + rev: v0.15.9 hooks: - id: ruff-format alias: ruff-format-second-pass name: ruff-format (second pass) - repo: https://github.com/Lucas-C/pre-commit-hooks.git - rev: v1.5.5 + rev: v1.5.6 hooks: - id: remove-tabs - repo: https://github.com/python-jsonschema/check-jsonschema.git - rev: 0.34.0 + rev: 0.37.1 hooks: - id: check-github-workflows files: ^\.github/workflows/[^/]+$ @@ -166,7 +166,7 @@ repos: - id: debug-statements - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.1 + rev: v1.38.0 hooks: - id: yamllint types: @@ -205,7 +205,7 @@ repos: - id: forbid-html-img-without-alt-text - repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v1.18.2 + rev: v1.20.0 hooks: - id: mypy alias: mypy-py314 @@ -260,7 +260,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v1.14.1 # the last MyPy version to support Python 3.8 + rev: v1.20.0 # the last MyPy version to support Python 3.8 hooks: - id: mypy alias: mypy-py38 @@ -283,7 +283,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v1.18.2 + rev: v1.20.0 hooks: - id: mypy alias: mypy-stubtest @@ -317,7 +317,7 @@ repos: $ - repo: https://github.com/PyCQA/pylint.git - rev: v3.3.9 + rev: v4.0.5 hooks: - id: pylint additional_dependencies: From fb857f25913d6b7338dab73b2353b64a1c5e10b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:54:38 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cheroot/server.py | 80 +++++++++++++++++++++-------------- cheroot/workers/threadpool.py | 50 +++++++++++++--------- 2 files changed, 78 insertions(+), 52 deletions(-) diff --git a/cheroot/server.py b/cheroot/server.py index 27e9173b15..284cf17c72 100644 --- a/cheroot/server.py +++ b/cheroot/server.py @@ -1670,49 +1670,65 @@ def clear_stats(self): self.stats = { 'Enabled': False, 'Bind Address': lambda s: repr(self.bind_addr), - 'Run time': lambda s: ((not s['Enabled']) and -1) - or self.runtime(), + 'Run time': lambda s: ( + ((not s['Enabled']) and -1) or self.runtime() + ), 'Accepts': 0, 'Accepts/sec': lambda s: s['Accepts'] / self.runtime(), 'Queue': lambda s: getattr(self.requests, 'qsize', None), 'Threads': lambda s: len(getattr(self.requests, '_threads', [])), 'Threads Idle': lambda s: getattr(self.requests, 'idle', None), 'Socket Errors': 0, - 'Requests': lambda s: ((not s['Enabled']) and -1) - or sum( - (w['Requests'](w) for w in s['Worker Threads'].values()), - 0, + 'Requests': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + (w['Requests'](w) for w in s['Worker Threads'].values()), + 0, + ) ), - 'Bytes Read': lambda s: ((not s['Enabled']) and -1) - or sum( - (w['Bytes Read'](w) for w in s['Worker Threads'].values()), - 0, + 'Bytes Read': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + (w['Bytes Read'](w) for w in s['Worker Threads'].values()), + 0, + ) ), - 'Bytes Written': lambda s: ((not s['Enabled']) and -1) - or sum( - (w['Bytes Written'](w) for w in s['Worker Threads'].values()), - 0, + 'Bytes Written': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + ( + w['Bytes Written'](w) + for w in s['Worker Threads'].values() + ), + 0, + ) ), - 'Work Time': lambda s: ((not s['Enabled']) and -1) - or sum( - (w['Work Time'](w) for w in s['Worker Threads'].values()), - 0, + 'Work Time': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + (w['Work Time'](w) for w in s['Worker Threads'].values()), + 0, + ) ), - 'Read Throughput': lambda s: ((not s['Enabled']) and -1) - or sum( - ( - w['Bytes Read'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values() - ), - 0, + 'Read Throughput': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + ( + w['Bytes Read'](w) / (w['Work Time'](w) or 1e-6) + for w in s['Worker Threads'].values() + ), + 0, + ) ), - 'Write Throughput': lambda s: ((not s['Enabled']) and -1) - or sum( - ( - w['Bytes Written'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values() - ), - 0, + 'Write Throughput': lambda s: ( + ((not s['Enabled']) and -1) + or sum( + ( + w['Bytes Written'](w) / (w['Work Time'](w) or 1e-6) + for w in s['Worker Threads'].values() + ), + 0, + ) ), 'Worker Threads': {}, } diff --git a/cheroot/workers/threadpool.py b/cheroot/workers/threadpool.py index 269574514c..31bc004b4f 100644 --- a/cheroot/workers/threadpool.py +++ b/cheroot/workers/threadpool.py @@ -71,30 +71,40 @@ def __init__(self, server): self.start_time = None self.work_time = 0 self.stats = { - 'Requests': lambda s: self.requests_seen - + ( - (self.start_time is None and trueyzero) - or self.conn.requests_seen + 'Requests': lambda s: ( + self.requests_seen + + ( + (self.start_time is None and trueyzero) + or self.conn.requests_seen + ) + ), + 'Bytes Read': lambda s: ( + self.bytes_read + + ( + (self.start_time is None and trueyzero) + or self.conn.rfile.bytes_read + ) ), - 'Bytes Read': lambda s: self.bytes_read - + ( - (self.start_time is None and trueyzero) - or self.conn.rfile.bytes_read + 'Bytes Written': lambda s: ( + self.bytes_written + + ( + (self.start_time is None and trueyzero) + or self.conn.wfile.bytes_written + ) + ), + 'Work Time': lambda s: ( + self.work_time + + ( + (self.start_time is None and trueyzero) + or time.time() - self.start_time + ) ), - 'Bytes Written': lambda s: self.bytes_written - + ( - (self.start_time is None and trueyzero) - or self.conn.wfile.bytes_written + 'Read Throughput': lambda s: ( + s['Bytes Read'](s) / (s['Work Time'](s) or 1e-6) ), - 'Work Time': lambda s: self.work_time - + ( - (self.start_time is None and trueyzero) - or time.time() - self.start_time + 'Write Throughput': lambda s: ( + s['Bytes Written'](s) / (s['Work Time'](s) or 1e-6) ), - 'Read Throughput': lambda s: s['Bytes Read'](s) - / (s['Work Time'](s) or 1e-6), - 'Write Throughput': lambda s: s['Bytes Written'](s) - / (s['Work Time'](s) or 1e-6), } threading.Thread.__init__(self) From 0e758072b8c7aea9bd2f498c3d1f67bea4f7fe08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=87=BA=F0=9F=87=A6=20Sviatoslav=20Sydorenko=20=28?= =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D1=82=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=B8=D0=B4=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=29?= Date: Tue, 7 Apr 2026 13:05:09 +0200 Subject: [PATCH 3/3] Revert MyPy running against Python 3.8 to v1.14.1 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe7b03170f..968c79fad2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -260,7 +260,7 @@ repos: pass_filenames: false - repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v1.20.0 # the last MyPy version to support Python 3.8 + rev: v1.14.1 # the last MyPy version to support Python 3.8 hooks: - id: mypy alias: mypy-py38