From 659c3181b4d9da2d1845cf9bb69eda72fe546c77 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 29 Apr 2024 21:57:32 +0200 Subject: [PATCH] Apply black formatting after update --- docs/conf.py | 1 + mcproto/packets/packet_map.py | 9 +++---- mcproto/protocol/base_io.py | 48 ++++++++++++----------------------- mcproto/utils/deprecation.py | 3 +-- 4 files changed, 21 insertions(+), 40 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 226d825c..8ca26190 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,6 +6,7 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information """ + from __future__ import annotations import sys diff --git a/mcproto/packets/packet_map.py b/mcproto/packets/packet_map.py index 73c26b81..aed3803b 100644 --- a/mcproto/packets/packet_map.py +++ b/mcproto/packets/packet_map.py @@ -17,8 +17,7 @@ T = TypeVar("T") - def lru_cache(func: T, /) -> T: - ... + def lru_cache(func: T, /) -> T: ... else: from functools import lru_cache @@ -97,16 +96,14 @@ def _walk_module_packets(module_data: WalkableModuleData) -> Iterator[type[Packe def generate_packet_map( direction: Literal[PacketDirection.SERVERBOUND], state: GameState, -) -> Mapping[int, type[ServerBoundPacket]]: - ... +) -> Mapping[int, type[ServerBoundPacket]]: ... @overload def generate_packet_map( direction: Literal[PacketDirection.CLIENTBOUND], state: GameState, -) -> Mapping[int, type[ClientBoundPacket]]: - ... +) -> Mapping[int, type[ClientBoundPacket]]: ... @lru_cache diff --git a/mcproto/protocol/base_io.py b/mcproto/protocol/base_io.py index fe6b9cfb..b2b6fc61 100644 --- a/mcproto/protocol/base_io.py +++ b/mcproto/protocol/base_io.py @@ -89,20 +89,16 @@ async def write(self, data: bytes, /) -> None: """ @overload - async def write_value(self, fmt: INT_FORMATS_TYPE, value: int, /) -> None: - ... + async def write_value(self, fmt: INT_FORMATS_TYPE, value: int, /) -> None: ... @overload - async def write_value(self, fmt: FLOAT_FORMATS_TYPE, value: float, /) -> None: - ... + async def write_value(self, fmt: FLOAT_FORMATS_TYPE, value: float, /) -> None: ... @overload - async def write_value(self, fmt: Literal[StructFormat.BOOL], value: bool, /) -> None: - ... + async def write_value(self, fmt: Literal[StructFormat.BOOL], value: bool, /) -> None: ... @overload - async def write_value(self, fmt: Literal[StructFormat.CHAR], value: str, /) -> None: - ... + async def write_value(self, fmt: Literal[StructFormat.CHAR], value: str, /) -> None: ... async def write_value(self, fmt: StructFormat, value: object, /) -> None: """Write a given ``value`` as given struct format (``fmt``) in big-endian mode.""" @@ -210,20 +206,16 @@ def write(self, data: bytes, /) -> None: """ @overload - def write_value(self, fmt: INT_FORMATS_TYPE, value: int, /) -> None: - ... + def write_value(self, fmt: INT_FORMATS_TYPE, value: int, /) -> None: ... @overload - def write_value(self, fmt: FLOAT_FORMATS_TYPE, value: float, /) -> None: - ... + def write_value(self, fmt: FLOAT_FORMATS_TYPE, value: float, /) -> None: ... @overload - def write_value(self, fmt: Literal[StructFormat.BOOL], value: bool, /) -> None: - ... + def write_value(self, fmt: Literal[StructFormat.BOOL], value: bool, /) -> None: ... @overload - def write_value(self, fmt: Literal[StructFormat.CHAR], value: str, /) -> None: - ... + def write_value(self, fmt: Literal[StructFormat.CHAR], value: str, /) -> None: ... def write_value(self, fmt: StructFormat, value: object, /) -> None: """Write a given ``value`` as given struct format (``fmt``) in big-endian mode.""" @@ -335,20 +327,16 @@ async def read(self, length: int, /) -> bytearray: """ @overload - async def read_value(self, fmt: INT_FORMATS_TYPE, /) -> int: - ... + async def read_value(self, fmt: INT_FORMATS_TYPE, /) -> int: ... @overload - async def read_value(self, fmt: FLOAT_FORMATS_TYPE, /) -> float: - ... + async def read_value(self, fmt: FLOAT_FORMATS_TYPE, /) -> float: ... @overload - async def read_value(self, fmt: Literal[StructFormat.BOOL], /) -> bool: - ... + async def read_value(self, fmt: Literal[StructFormat.BOOL], /) -> bool: ... @overload - async def read_value(self, fmt: Literal[StructFormat.CHAR], /) -> str: - ... + async def read_value(self, fmt: Literal[StructFormat.CHAR], /) -> str: ... async def read_value(self, fmt: StructFormat, /) -> object: """Read a value as given struct format (``fmt``) in big-endian mode. @@ -478,20 +466,16 @@ def read(self, length: int, /) -> bytearray: """ @overload - def read_value(self, fmt: INT_FORMATS_TYPE, /) -> int: - ... + def read_value(self, fmt: INT_FORMATS_TYPE, /) -> int: ... @overload - def read_value(self, fmt: FLOAT_FORMATS_TYPE, /) -> float: - ... + def read_value(self, fmt: FLOAT_FORMATS_TYPE, /) -> float: ... @overload - def read_value(self, fmt: Literal[StructFormat.BOOL], /) -> bool: - ... + def read_value(self, fmt: Literal[StructFormat.BOOL], /) -> bool: ... @overload - def read_value(self, fmt: Literal[StructFormat.CHAR], /) -> str: - ... + def read_value(self, fmt: Literal[StructFormat.CHAR], /) -> str: ... def read_value(self, fmt: StructFormat, /) -> object: """Read a value into given struct format in big-endian mode. diff --git a/mcproto/utils/deprecation.py b/mcproto/utils/deprecation.py index 89093cb8..579fb19f 100644 --- a/mcproto/utils/deprecation.py +++ b/mcproto/utils/deprecation.py @@ -74,8 +74,7 @@ def deprecation_warn( class DecoratorFunction(Protocol): - def __call__(self, __x: Callable[P, R]) -> Callable[P, R]: - ... + def __call__(self, __x: Callable[P, R]) -> Callable[P, R]: ... def deprecated(