Skip to content

Commit

Permalink
Use attrs.define instead of exporting it
Browse files Browse the repository at this point in the history
  • Loading branch information
LiteApplication authored and ItsDrike committed Jun 7, 2024
1 parent 91fc5b9 commit 6e50d94
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mcproto/packets/handshaking/handshake.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mcproto.buffer import Buffer
from mcproto.packets.packet import GameState, ServerBoundPacket
from mcproto.protocol.base_io import StructFormat
from mcproto.utils.abc import define
from attrs import define

__all__ = [
"NextState",
Expand Down
2 changes: 1 addition & 1 deletion mcproto/packets/login/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mcproto.packets.packet import ClientBoundPacket, GameState, ServerBoundPacket
from mcproto.types.chat import ChatMessage
from mcproto.types.uuid import UUID
from mcproto.utils.abc import define
from attrs import define

__all__ = [
"LoginDisconnect",
Expand Down
2 changes: 1 addition & 1 deletion mcproto/packets/status/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from mcproto.buffer import Buffer
from mcproto.packets.packet import ClientBoundPacket, GameState, ServerBoundPacket
from mcproto.protocol.base_io import StructFormat
from mcproto.utils.abc import define
from attrs import define

__all__ = ["PingPong"]

Expand Down
2 changes: 1 addition & 1 deletion mcproto/packets/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from mcproto.buffer import Buffer
from mcproto.packets.packet import ClientBoundPacket, GameState, ServerBoundPacket
from mcproto.utils.abc import define
from attrs import define

__all__ = ["StatusRequest", "StatusResponse"]

Expand Down
5 changes: 3 additions & 2 deletions mcproto/types/abc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from mcproto.utils.abc import Serializable, define
from mcproto.utils.abc import Serializable

__all__ = ["MCType", "define"] # That way we can import it from mcproto.types.abc

__all__ = ["MCType"]


class MCType(Serializable):
Expand Down
4 changes: 3 additions & 1 deletion mcproto/types/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from typing_extensions import Self, TypeAlias, override

from mcproto.buffer import Buffer
from mcproto.types.abc import MCType, define
from mcproto.types.abc import MCType
from attrs import define


__all__ = [
"ChatMessage",
Expand Down
4 changes: 3 additions & 1 deletion mcproto/types/nbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

from mcproto.buffer import Buffer
from mcproto.protocol.base_io import StructFormat, INT_FORMATS_TYPE, FLOAT_FORMATS_TYPE
from mcproto.types.abc import MCType, define
from mcproto.types.abc import MCType
from attrs import define

from mcproto.utils.abc import RequiredParamsABCMixin

__all__ = [
Expand Down
3 changes: 1 addition & 2 deletions mcproto/utils/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

from abc import ABC, abstractmethod
from collections.abc import Sequence
from attrs import define
from typing import Any, ClassVar

from typing_extensions import Self

from mcproto.buffer import Buffer


__all__ = ["RequiredParamsABCMixin", "Serializable", "define"]
__all__ = ["RequiredParamsABCMixin", "Serializable"]


class RequiredParamsABCMixin:
Expand Down
4 changes: 3 additions & 1 deletion tests/mcproto/utils/test_serializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from typing_extensions import override

from mcproto.buffer import Buffer
from mcproto.utils.abc import Serializable, define
from mcproto.utils.abc import Serializable
from attrs import define

from tests.helpers import gen_serializable_test, TestExc


Expand Down

0 comments on commit 6e50d94

Please sign in to comment.