forked from goodboy/tractor
1
0
Fork 0

Mk `MsgDec.spec_str` have a more compact `

runtime_to_msgspec
Tyler Goodlet 2024-05-22 15:18:45 -04:00
parent c6f599b1be
commit ce4d64ed2f
1 changed files with 5 additions and 2 deletions

View File

@ -162,7 +162,10 @@ class MsgDec(Struct):
# TODO: would get moved into `FieldSpec.__str__()` right? # TODO: would get moved into `FieldSpec.__str__()` right?
@property @property
def spec_str(self) -> str: def spec_str(self) -> str:
return pformat_msgspec(codec=self) return pformat_msgspec(
codec=self,
join_char='|',
)
pld_spec_str = spec_str pld_spec_str = spec_str
@ -211,7 +214,7 @@ def mk_msgspec_table(
msgtypes = [msgspec] msgtypes = [msgspec]
msgt_table: dict[str, MsgType] = { msgt_table: dict[str, MsgType] = {
msgt: str(msgt) msgt: str(msgt.__name__)
for msgt in msgtypes for msgt in msgtypes
} }
if msg: if msg: