Skip to content

Conversation

@bluebinary
Copy link
Owner

@bluebinary bluebinary commented Jul 8, 2025

Added input validation for the .encode() methods, and additional unit testing for the UnsignedLong type.

Added a new utilities sub-module containing the hexbytes helper method that can be used to format raw bytes or bytearray values into hexadecimal encoded strings for review, and the print_hexbytes helper method that can be used to print such strings.

Changed type casting of the decoded return value for the Bytes class when reversed back to a bytes type, fixing a previous issue where the reversed return type was a list type.

The BytesView class split length can now be equal to the length of the provided data value, previously the split length had to be less than the length of the data value.

The type hints for the BytesView class' __iter__ and __next__ methods have been corrected from bytesview to BytesView, and bytes to bytearray respectively.

Added several new features to the library including a new `BytesView`
class; updated the documentation, added unit tests for all of the data
types; and fixed a few issues:

 * Added support for creating `Bytes` values from `bytes` values.

 * Added a new `BytesView` class for iterating over `bytes` and
`bytearray` objects with the ability to access the data as arbitrarily
sized groups of bytes as well as being able to cast bytes to specific
data types.

 * Added `Float`, `Float16`, `Float32` and `Float64` types, as well as
`Double` (an alias for `Float64`).

 * Added `Size`, `SingedSize` and `UnsignedSize` integer subtypes which
have a maximum size dependent upon the system they are running on.

 * Added `Unicode`, `UTF8`, `UTF16`, `UTF32`, `ASCII` types to
compliment the `String` type; these string variants hold strings with
different default character encodings.

 * Added `Type` superclass as a parent of all of the type subclasses
which makes type comparison and class hierarchy membership easier to
discern and allows shared behaviour to be centrally defined and
maintained.

 * The `Short` type was previously unsigned and is now signed as per
the C standard following the Python convention; the `Short` type was
previously based on embedded metadata standards, which treat `short` as
unsigned and defined a separate `signed short`.

 * The `Long` type was previously unsigned and is now signed as per the
C standard following the Python convention; the `Long` type was
previously based on embedded metadata standards, which treat `long` as
unsigned and defined a separate `signed long`.

 * The `LongLong` type was previously unsigned and is now signed as per
the C standard following the Python convention; the `LongLong` type was
previously based on embedded metadata standards, which treat `long
long` as unsigned and defined a separate `signed long long`.

 * A new `UnsignedShort` type has been added to compliment the signed
`Short` type and pairs with the `SignedShort` type which is
functionally equivalent to `Short`.

 * A new `UnsignedLong` type has been added to compliment signed `Long`
type and pairs with the `SignedLong` type which is functionally
equivalent to `Long`.

 * A new `UnsignedLongLong` type has been added to compliment signed
`LongLong` type and pairs with the `SignedLongLong` type which is
functionally equivalent to `LongLong`.
Fixed Python 3.13’s breaking change related to dropped support for
combining the `@classmethod` and `@property` decorators to create class
properties; this was supported between at least Python versions 3.9 and
3.12.

Backwards compatible support that works on Python versions 3.9+ has
been introduced via the new `@classproperty` decorator from the
`classicist` library.
Add input validation for the `.encode()` methods, and additional unit
testing for the `UnsignedLong` type.

Added a new `utilities` sub-module containing the `hexbytes` helper
method that can be used to format raw `bytes` or `bytearray` values
into hexadecimal encoded strings for review, and the `print_hexbytes`
helper method that can be used to print such strings.

Changed type casting of the decoded return value for the `Bytes` class
when reversed back to a `bytes` type, fixing a previous issue where the
reversed return type was a `list` type.

The `BytesView` class `split` length can now be equal to the length of
the provided `data` value, previously the `split` length had to be less
than the length of the `data` value.

The type hints for the `BytesView` class' `__iter__` and `__next__`
methods have been corrected from `bytesview` to `BytesView`, and
`bytes` to `bytearray` respectively.
@bluebinary bluebinary self-assigned this Jul 8, 2025
@bluebinary bluebinary merged commit f3398dc into main Jul 8, 2025
4 checks passed
@bluebinary bluebinary deleted the library_improvements branch September 8, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants