-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
[...]
src/colocation/colocation.py:29: in __init__
self.metadata.validate()
.venv/lib/python3.10/site-packages/aeromancy/struct.py:87: in validate
self.decode(self.encode(format="msgpack"), format="msgpack")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'colocation.structs.Metadata'>
encoded_bytes = b'\x83\xabinstruments\x9d\x91\x8d\xadinstrument_id\xa8ref-PM25\xafinstrument_type\x01\xa9pollutant\xa4pm25\xaftime_res...etary\xa4note\xc0\xa5parts\xc0\xa9num_parts\x01\xafgps_coordinates\x92\xcb@P6\x1f\xc8\xf3#y\xcb\xc0bwF\xf7\xa0\xb5\xee'
format = 'msgpack'
@classmethod
def decode(cls, encoded_bytes: bytes, format: str):
"""Deserialize this `msgspec.Struct` from bytes.
Parameters
----------
encoded_bytes
Bytes to attempt to deserialize.
format
The format to used to encode the `msgspec.Struct`. This can be
"yaml", "json", or "msgpack".
Returns
-------
An instance of this class decoded according to `format`.
"""
match format:
case "yaml":
return msgspec.yaml.decode(encoded_bytes, type=cls)
case "json":
return msgspec.json.decode(encoded_bytes, type=cls)
case "msgpack":
> return msgspec.msgpack.decode(encoded_bytes, type=cls)
E msgspec.ValidationError: Expected `object`, got `array` - at `$.instruments[0]`
.venv/lib/python3.10/site-packages/aeromancy/struct.py:71: ValidationError
Catching and rethrowing the message with more details should help substantially.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers