Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
biggus-developerus committed Jul 20, 2024
1 parent f519cba commit 1576386
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packer/_types/int_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
TypeDescriptor,
)

#TODO: Type options, where it's possible to do the following:
# TODO: Type options, where it's possible to do the following:
"""
@packable
@dataclass
Expand All @@ -16,6 +16,7 @@ class Test:
# Where the False denotes whether it's a signed or unsigned int.
# This could be done with metaclasses and overriding __getitem__ 👍👍


class Int32(TypeDescriptor):
__data_size__: int = 4

Expand All @@ -25,7 +26,9 @@ def pack(cls, val: int) -> bytes:

@classmethod
def unpack(cls, data: bytearray) -> tuple[int, int]:
return cls.__data_size__, int.from_bytes(data[: cls.__data_size__], sys.byteorder, signed=True)
return cls.__data_size__, int.from_bytes(
data[: cls.__data_size__], sys.byteorder, signed=True
)


class Int16(TypeDescriptor):
Expand All @@ -37,7 +40,9 @@ def pack(cls, val: int) -> bytes:

@classmethod
def unpack(cls, data: bytearray) -> tuple[int, int]:
return cls.__data_size__, int.from_bytes(data[: cls.__data_size__], sys.byteorder, signed=True)
return cls.__data_size__, int.from_bytes(
data[: cls.__data_size__], sys.byteorder, signed=True
)


class Int8(TypeDescriptor):
Expand All @@ -49,7 +54,10 @@ def pack(cls, val: int) -> bytes:

@classmethod
def unpack(cls, data: bytearray) -> tuple[int, int]:
return cls.__data_size__, int.from_bytes(data[: cls.__data_size__], sys.byteorder, signed=True)
return cls.__data_size__, int.from_bytes(
data[: cls.__data_size__], sys.byteorder, signed=True
)


class UInt32(TypeDescriptor):
__data_size__: int = 4
Expand Down

0 comments on commit 1576386

Please sign in to comment.