You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched (google, github) for similar issues and couldn't find anything
I have read and followed the docs and couldn't find an answer
After submitting this, I commit to one of:
Look through open issues and helped at least one other person
Hit the "watch" button on this repo to receive notifications and I commit to help at least 2 people that ask questions in the future
Implement a Pull Request for a confirmed bug
Question
I'm trying to instantiate a class inheriting from BaseModel that has one member variable. I want this to be an immutable mapping type; currently, I'm using FrozenDict from flax while waiting for PEP 603.
The problem is that pydantic seems to recognise this type as a dict, and tries to cast to a dict as stated in the docs when typing.Dict is used for a field. This works regardless of setting arbitrary_types_allowed to True or False. Is there any way I can circumvent this behaviour in this one case, while still having the isinstance check I would expect for arbitrary_types_allowed = True?
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
I'd say from a user perspective, it would be nice to not have implicit casting (you could lose access to class methods, for example), but that's ultimately your decision.
Oh and thanks for working on pydantic, its pretty awesome :)
Checks
Question
I'm trying to instantiate a class inheriting from
BaseModel
that has one member variable. I want this to be an immutable mapping type; currently, I'm usingFrozenDict
from flax while waiting for PEP 603.The problem is that pydantic seems to recognise this type as a dict, and tries to cast to a dict as stated in the docs when
typing.Dict
is used for a field. This works regardless of settingarbitrary_types_allowed
toTrue
orFalse
. Is there any way I can circumvent this behaviour in this one case, while still having theisinstance
check I would expect forarbitrary_types_allowed = True
?Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:The text was updated successfully, but these errors were encountered: