diff --git a/.idea/objutils@1.iml b/.idea/objutils@1.iml
index 8e33d7d..6276174 100644
--- a/.idea/objutils@1.iml
+++ b/.idea/objutils@1.iml
@@ -8,4 +8,4 @@
-
\ No newline at end of file
+
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8b28c32..308d929 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -42,7 +42,7 @@ repos:
args: ["--line-length=132"]
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.16.1
+ rev: v0.16.2
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]
diff --git a/objutils/section.py b/objutils/section.py
index a688f33..5cb826e 100644
--- a/objutils/section.py
+++ b/objutils/section.py
@@ -1326,8 +1326,7 @@ def write_asam_ndarray(
# axis breakpoint. This is identical to C-order (ROW_DIR) for a 2-D array.
if typed_array.ndim != 2:
raise ValueError(
- "ALTERNATE_CURVES requires a 2-D array with shape "
- "(num_axis_points, num_curves) in numpy convention"
+ "ALTERNATE_CURVES requires a 2-D array with shape " "(num_axis_points, num_curves) in numpy convention"
)
raw_data = typed_array.tobytes() # C-order = AoS
permuted = self._permute_asam_buffer(raw_data, internal_dtype, asam_byte_order)
@@ -1422,10 +1421,7 @@ def read_asam_ndarray(
# --- ALTERNATE_CURVES --------------------------------------------------
if index_mode == "ALTERNATE_CURVES":
if numpy_shape is None or len(numpy_shape) != 2:
- raise ValueError(
- "ALTERNATE_CURVES requires a 2-D shape (num_curves, num_axis_points) "
- "in ASAM convention"
- )
+ raise ValueError("ALTERNATE_CURVES requires a 2-D shape (num_curves, num_axis_points) " "in ASAM convention")
type_name = internal_dtype.split("_")[0]
type_size = TYPE_SIZES[type_name]
byte_count = length * type_size
diff --git a/objutils/tests/test_asam_alternate_modes.py b/objutils/tests/test_asam_alternate_modes.py
index f3cf7aa..b33ff99 100644
--- a/objutils/tests/test_asam_alternate_modes.py
+++ b/objutils/tests/test_asam_alternate_modes.py
@@ -731,21 +731,96 @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 8,
+ 0,
+ 0,
+ 0,
+ 8,
+ 0,
+ 0,
+ 0,
] # 5 * 4 * 4 = 80 Bytes (SLONG, LE)
@@ -758,11 +833,26 @@ def test_alternate_curves_memory_layout_ubyte():
"""
arr = VXP_TYPE_DATA.astype(np.uint8)
expected = [
- 10, 3, 4, 8,
- 12, 2, 4, 6,
- 17, 9, 5, 8,
- 10, 1, 4, 8,
- 18, 3, 8, 8,
+ 10,
+ 3,
+ 4,
+ 8,
+ 12,
+ 2,
+ 4,
+ 6,
+ 17,
+ 9,
+ 5,
+ 8,
+ 10,
+ 1,
+ 4,
+ 8,
+ 18,
+ 3,
+ 8,
+ 8,
]
total_bytes = 5 * 4 # num_axis_points * num_curves
sec = Section(start_address=0x1000, data=bytearray(total_bytes + 8))
@@ -860,8 +950,7 @@ def test_alternate_curves_layout_equals_row_dir():
"""ALTERNATE_CURVES und ROW_DIR erzeugen identisches Speicher-Layout."""
arr = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.uint8)
sec_curves = Section(start_address=0, data=bytearray(16))
- sec_row = Section(start_address=0, data=bytearray(16))
+ sec_row = Section(start_address=0, data=bytearray(16))
sec_curves.write_asam_ndarray(0, arr, "UBYTE", byte_order="MSB_LAST", index_mode="ALTERNATE_CURVES")
- sec_row.write_asam_ndarray( 0, arr, "UBYTE", byte_order="MSB_LAST", index_mode="ROW_DIR")
+ sec_row.write_asam_ndarray(0, arr, "UBYTE", byte_order="MSB_LAST", index_mode="ROW_DIR")
assert sec_curves.read(0, 6) == sec_row.read(0, 6)
-