<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Python parser for compact-array capture objects]]></title><description><![CDATA[<p dir="auto">The parser below is intentionally small and defensive. It rejects trailing bytes instead of guessing a schema.</p>
<pre><code class="language-python">def decode_compact_array(payload: bytes, widths: list[int]) -&gt; list[list[bytes]]:
    row_width = sum(widths)
    if row_width == 0 or len(payload) % row_width:
        raise ValueError("payload does not align with the synthetic schema")
    rows = []
    for offset in range(0, len(payload), row_width):
        cursor = offset
        row = []
        for width in widths:
            row.append(payload[cursor:cursor + width])
            cursor += width
        rows.append(row)
    return rows
</code></pre>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Column</th>
<th style="text-align:right">Width</th>
<th>Synthetic meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>timestamp</td>
<td style="text-align:right">12</td>
<td>octet string</td>
</tr>
<tr>
<td>active energy</td>
<td style="text-align:right">4</td>
<td>unsigned</td>
</tr>
<tr>
<td>status</td>
<td style="text-align:right">1</td>
<td>bit flags</td>
</tr>
</tbody>
</table>
]]></description><link>https://dlms.sharur.org/topic/7/python-parser-for-compact-array-capture-objects</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 19:48:58 GMT</lastBuildDate><atom:link href="https://dlms.sharur.org/topic/7.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 22 Aug 2026 06:18:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Python parser for compact-array capture objects on Sat, 22 Aug 2026 06:18:41 GMT]]></title><description><![CDATA[<p dir="auto">For production code, return offsets with each error so a 400-byte trace does not force operators to count bytes manually.</p>
]]></description><link>https://dlms.sharur.org/post/17</link><guid isPermaLink="true">https://dlms.sharur.org/post/17</guid><dc:creator><![CDATA[sharur_gate2_admin]]></dc:creator><pubDate>Sat, 22 Aug 2026 06:18:41 GMT</pubDate></item><item><title><![CDATA[Reply to Python parser for compact-array capture objects on Sat, 22 Aug 2026 06:18:41 GMT]]></title><description><![CDATA[<p dir="auto">Keep the structure description beside the payload in test evidence. Without it, a compact array cannot be decoded unambiguously.</p>
]]></description><link>https://dlms.sharur.org/post/16</link><guid isPermaLink="true">https://dlms.sharur.org/post/16</guid><dc:creator><![CDATA[sharur_gate2_admin]]></dc:creator><pubDate>Sat, 22 Aug 2026 06:18:41 GMT</pubDate></item></channel></rss>