Hey there! I've been putting pyrallis to action lately and can't over emphasize how much cleaner it's been to integrate and apply configurations.
That said, there are a couple use cases I'm interested to hear your thoughts on. First being how pyrallis handles typing.Literal. I see in decoding/decode_field that the Literal field will decode to 'Any' and that Literal[arg1, arg2, ..] will decode into arg1. In the case of Literal["constant"] this decodes to "constant", which is not a type.
More succinctly, does the patternLiteral[object] make good sense to use and if so, what might be the way for pyralis to handle this type appropriately?
Traceback (most recent call last):
File "/anaconda3/envs/spec/lib/python3.9/site-packages/pyrallis/parsers/decoding.py", line 65, in decode_dataclass
field_value = decode_field(field, raw_value)
File "/anaconda3/envs/spec/lib/python3.9/site-packages/pyrallis/parsers/decoding.py", line 102, in decode_field
return decode(field_type, raw_value)
File "/anaconda3/envs/spec/lib/python3.9/functools.py", line 877, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/anaconda3/envs/spec/lib/python3.9/site-packages/pyrallis/parsers/decoding.py", line 33, in decode
return get_decoding_fn(t)(raw_value)
File "/anaconda3/envs/spec/lib/python3.9/site-packages/pyrallis/parsers/decoding.py", line 176, in get_decoding_fn
raise Exception(f"No decoding function for type {t}, consider using pyrallis.decode.register")
Exception: No decoding function for type typing.Literal['onecycle', 'constant'], consider using pyrallis.decode.register
Hey there! I've been putting pyrallis to action lately and can't over emphasize how much cleaner it's been to integrate and apply configurations.
That said, there are a couple use cases I'm interested to hear your thoughts on. First being how pyrallis handles typing.Literal. I see in
decoding/decode_fieldthat theLiteralfield will decode to 'Any' and thatLiteral[arg1, arg2, ..]will decode intoarg1. In the case ofLiteral["constant"]this decodes to "constant", which is not a type.More succinctly, does the pattern
Literal[object]make good sense to use and if so, what might be the way for pyralis to handle this type appropriately?