From 13beeeeffbcbadfb53ee09373aae5cd740105584 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 15:16:20 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- daphne/endpoints.py | 6 ++++++ tests/test_cli.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/daphne/endpoints.py b/daphne/endpoints.py index 6b89953..b25a7e1 100644 --- a/daphne/endpoints.py +++ b/daphne/endpoints.py @@ -1,10 +1,12 @@ from abc import ABC, abstractmethod + class Endpoint(ABC): @abstractmethod def parse(self, options): pass + class TCPEndpoint(Endpoint): def parse(self, options): if options.get("port") and options.get("host"): @@ -14,20 +16,24 @@ class TCPEndpoint(Endpoint): raise ValueError("TCP binding requires both port and host kwargs.") return None + class UNIXEndpoint(Endpoint): def parse(self, options): if options.get("unix_socket"): return f"unix:{options['unix_socket']}" return None + class FileDescriptorEndpoint(Endpoint): def parse(self, options): if options.get("file_descriptor") is not None: return f"fd:fileno={int(options['file_descriptor'])}" return None + endpoint_parsers = [TCPEndpoint(), UNIXEndpoint(), FileDescriptorEndpoint()] + def build_endpoint_description_strings(**kwargs): """ Build a list of twisted endpoint description strings that the server will listen on. diff --git a/tests/test_cli.py b/tests/test_cli.py index aee7f8b..f6c6f78 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -5,10 +5,12 @@ from unittest import TestCase, skipUnless from daphne.cli import CommandLineInterface from daphne.endpoints import ( - build_endpoint_description_strings as build, - endpoint_parsers, Endpoint, ) +from daphne.endpoints import build_endpoint_description_strings as build +from daphne.endpoints import ( + endpoint_parsers, +) class TestEndpointDescriptions(TestCase):