Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DeliciousBytes Library Change Log

## [1.1.1] - 2025-09-09
### Changed
- The `Bytes.encode()` and the `Bytes.decode()` methods now treat the `order` keyword
argument as optional, with a default value of `None`, although if it is specified, it
must reference a `ByteOrder` enumeration option.

## [1.1.0] - 2025-09-09
### Added
- The `Bytes.encode()` and the `Bytes.decode()` methods now support reversing the order
Expand Down
16 changes: 10 additions & 6 deletions source/deliciousbytes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def __new__(cls, value: bytes | bytearray | Int, length: int = None):

def encode(
self,
order: ByteOrder = ByteOrder.MSB,
order: ByteOrder = None,
reverse: bool = False,
length: int = None,
raises: bool = True,
Expand All @@ -1017,9 +1017,11 @@ def encode(
"Ensure the 'encode' method is being called on a class instance!"
)

if not isinstance(order, ByteOrder):
if order is None:
pass
elif not isinstance(order, ByteOrder):
raise TypeError(
"The 'order' argument must have a ByteOrder enumeration value!"
"The 'order' argument, if specified, must have a ByteOrder enumeration value!"
)

if not isinstance(reverse, bool):
Expand Down Expand Up @@ -1064,7 +1066,7 @@ def encode(
def decode(
cls,
value: bytes | bytearray,
order: ByteOrder = ByteOrder.MSB,
order: ByteOrder = None,
reverse: bool = False,
) -> Bytes:
"""The decode method decodes the provided value into a Bytes type; the byte
Expand All @@ -1079,9 +1081,11 @@ def decode(
"The 'value' argument must have a bytes or bytearray value!"
)

if not isinstance(order, ByteOrder):
if order is None:
pass
elif not isinstance(order, ByteOrder):
raise TypeError(
"The 'order' argument must have a ByteOrder enumeration value!"
"The 'order' argument, if specified, must have a ByteOrder enumeration value!"
)

if not isinstance(reverse, bool):
Expand Down
2 changes: 1 addition & 1 deletion source/deliciousbytes/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1