-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add Config.keep_untouched for custom descriptors support #679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Config.keep_untouched for custom descriptors support #679
Conversation
Codecov Report
@@ Coverage Diff @@
## master #679 +/- ##
=======================================
Coverage ? 100%
=======================================
Files ? 15
Lines ? 2719
Branches ? 538
=======================================
Hits ? 2719
Misses ? 0
Partials ? 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM.
pydantic/main.py
Outdated
| @@ -214,10 +215,11 @@ def __new__(mcs, name, bases, namespace): | |||
| config=config, | |||
| ) | |||
|
|
|||
| type_blacklist = TYPE_BLACKLIST + config.keep_untouched | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename TYPE_BLACKLIST to UNTOUCHED_TYPES to be consistent with config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
It was a hack to bypass the validation But thanks to pydantic/pydantic#679, it is now possible to use custom descriptors like classproperty without raising errors
It was a hack to bypass the validation But thanks to pydantic/pydantic#679, it is now possible to use custom descriptors like classproperty without raising errors
It was a hack to bypass the validation But thanks to pydantic/pydantic#679, it is now possible to use custom descriptors like classproperty without raising errors
Change Summary
This will allow to extend default
TYPE_BLACKLISTduring class creation.It's very helpful if we want use custom descriptors for our class (like cached_property, etc) and don't want pydantic to break them.
Checklist
HISTORY.rsthas been updated#<number>@<whomever>