prodict
prodict copied to clipboard
Python Unions in Prodict
Greetings! I have a data structure that I set to be a string (single value) or a dict. So I've tried using this:
class ModelConfig(Prodict):
label_mapping: typing.Union[Prodict, str]
This works okay for the PyCharm warnings and completion but if I try to assign a prodict I get all sorts of weird errors. So this doesn't work
model_config.label_mapping = Prodict.from_dict({"0": "dog", "1": "cat"})
Is there some sort of Union construct in Prodict that works better than the built in typing?
Thanks!