From 15e702f5e2d3d086762bb519fe306bcefeb9f36b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Apr 2023 01:25:18 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- daphne/access.py | 11 +++++++---- daphne/cli.py | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/daphne/access.py b/daphne/access.py index f0c48df..5aea5bb 100644 --- a/daphne/access.py +++ b/daphne/access.py @@ -3,6 +3,7 @@ import logging logger = logging.getLogger(__name__) + class AccessLogGenerator: """ Object that implements the Daphne "action logger" internal interface in @@ -13,9 +14,11 @@ class AccessLogGenerator: if stream: logger.propagate = False handler = logging.StreamHandler(stream) - formatter = logging.Formatter('%(host)s %(ident)s %(user)s [%(asctime)s] "%{request} %(message)s" ' - '%(status)s %(length)s' - "%d/%b/%Y:%H:%M:%S") + formatter = logging.Formatter( + '%(host)s %(ident)s %(user)s [%(asctime)s] "%{request} %(message)s" ' + "%(status)s %(length)s" + "%d/%b/%Y:%H:%M:%S" + ) handler.setFormatter(fmt=formatter) logger.addHandler(handler) else: @@ -78,5 +81,5 @@ class AccessLogGenerator: "user": user or "-", "status": status or "-", "length": length or "-", - } + }, ) diff --git a/daphne/cli.py b/daphne/cli.py index 0dd9fce..0490075 100755 --- a/daphne/cli.py +++ b/daphne/cli.py @@ -228,7 +228,9 @@ class CommandLineInterface: elif args.verbosity >= 1: access_log_stream = sys.stdout - access_logger = AccessLogGenerator(access_log_stream) if access_log_stream else None + access_logger = ( + AccessLogGenerator(access_log_stream) if access_log_stream else None + ) # Import application sys.path.insert(0, ".") @@ -272,9 +274,7 @@ class CommandLineInterface: websocket_connect_timeout=args.websocket_connect_timeout, websocket_handshake_timeout=args.websocket_connect_timeout, application_close_timeout=args.application_close_timeout, - action_logger=access_logger - if access_log_stream - else None, + action_logger=access_logger if access_log_stream else None, root_path=args.root_path, verbosity=args.verbosity, proxy_forwarded_address_header=self._get_forwarded_host(args=args),