[read_properties] skip unrecognized tags

This commit is contained in:
jan 2026-03-09 01:41:57 -07:00
commit 286f9e1949

View file

@ -2,6 +2,7 @@
Functionality for reading/writing elements (geometry, text labels, Functionality for reading/writing elements (geometry, text labels,
structure references) and associated properties. structure references) and associated properties.
""" """
import io
from typing import IO, TypeVar from typing import IO, TypeVar
from collections.abc import Mapping from collections.abc import Mapping
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
@ -53,6 +54,8 @@ def read_properties(stream: IO[bytes]) -> dict[int, bytes]:
if key in properties: if key in properties:
raise KlamathError(f'Duplicate property key: {key!r}') raise KlamathError(f'Duplicate property key: {key!r}')
properties[key] = value properties[key] = value
else:
stream.seek(size, io.SEEK_CUR)
size, tag = Record.read_header(stream) size, tag = Record.read_header(stream)
return properties return properties