From d090efbd9696fa2854b19265fd816640185a0327 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:54:36 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.15.0 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.15.2) - [github.com/psf/black: 23.12.1 → 24.3.0](https://github.com/psf/black/compare/23.12.1...24.3.0) - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05fe3f82..16c31cf1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: [--py38-plus] - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.3.0 hooks: - id: black language_version: python3 @@ -14,7 +14,7 @@ repos: hooks: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 additional_dependencies: From 75cce9018e2d4e67935cb6e6a07632cc8d8d3d69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:54:45 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- daphne/cli.py | 12 ++++++------ daphne/http_protocol.py | 8 +++++--- daphne/ws_protocol.py | 24 ++++++++++++------------ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/daphne/cli.py b/daphne/cli.py index 7c0c3c94..a036821c 100755 --- a/daphne/cli.py +++ b/daphne/cli.py @@ -270,16 +270,16 @@ def run(self, args): websocket_connect_timeout=args.websocket_connect_timeout, websocket_handshake_timeout=args.websocket_connect_timeout, application_close_timeout=args.application_close_timeout, - action_logger=AccessLogGenerator(access_log_stream) - if access_log_stream - else None, + action_logger=( + AccessLogGenerator(access_log_stream) if access_log_stream else None + ), root_path=args.root_path, verbosity=args.verbosity, proxy_forwarded_address_header=self._get_forwarded_host(args=args), proxy_forwarded_port_header=self._get_forwarded_port(args=args), - proxy_forwarded_proto_header="X-Forwarded-Proto" - if args.proxy_headers - else None, + proxy_forwarded_proto_header=( + "X-Forwarded-Proto" if args.proxy_headers else None + ), server_name=args.server_name, ) self.server.run() diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index b7da1bf7..e9eba960 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -286,9 +286,11 @@ def handle_reply(self, message): "path": uri, "status": self.code, "method": self.method.decode("ascii", "replace"), - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) + if self.client_addr + else None + ), "time_taken": self.duration(), "size": self.sentLength, }, diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 184515db..b1e29c3b 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -115,9 +115,9 @@ def applicationCreateWorked(self, application_queue): "connecting", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -138,9 +138,9 @@ def onOpen(self): "connected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -175,9 +175,9 @@ def onClose(self, wasClean, code, reason): "disconnected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -242,9 +242,9 @@ def serverReject(self): "rejected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, )