Skip to content

Commit

Permalink
Apply black formatting after update
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDrike committed Apr 29, 2024
1 parent fbdb0e3 commit 659c318
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 40 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
"""

from __future__ import annotations

import sys
Expand Down
9 changes: 3 additions & 6 deletions mcproto/packets/packet_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
48 changes: 16 additions & 32 deletions mcproto/protocol/base_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions mcproto/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 659c318

Please sign in to comment.