* Fix alias_generator and field config conflict (see #645)
* HISTORY.rst update: fix alias_generator and field config conflict
* Merge HISTORY.rst with master
* Use inspect.getdoc to get model description
This instead of the custom function clean_docstring.
It also allows models to inherit a description, the same way classes inherit a docstring.
* Update History
* Add advanced exclude support for dict, json and copy
* Add advanced exclude support for dict, json and copy
Add new version section (v0.31)
* Add advanced include support, add more tests, improve code style
Rename ValueExclude to ValueItems and move it to utils
Use old logic to calculate keys, but still exclude it in _iter
* Add more tests for ValueItems
* Removed update arg check in _calculate_keys for return None
This will increase speed when no include or exclude given and skip_defaults is False
* Fix formatting, remove duplicate imports
* Add # pragma: no cover to 'if TYPE_CHECKING:' block
* tweaks and coverage
* fix history
* Add docs
* tweak docs
* Make schema work for Literal and NewType, fix#646
* Fix test when typing_extensions not installed
* Make literal values fetching 3.6 compatible
* Rework to get around issues with Literal in python 3.6
* Make cython-compatible
* Use union for multiple allowed literal values
* Minor simplification of values-gathering
* Updated history
* Re-enable nested model init calls while still allowing self
This commit enables nested model `__init__` statements to be executed
while still allowing `self` as an argument.
Effectively reverses the changes from #632 while still enabling the
feature it implemented. In theory, there will still be a collision if
someone ever tried to use `pydantic_base_model/settings_init` as an arg,
but I don't know how to engineer a case where a collision would *never*
happen, I'm not sure there is one.
This commit also added a test for both BaseModel` and `BaseSettings` for
both the `self`-as-a-parameter and the nested `__init__` features since
`BaseSettings` now has the same issue as `BaseModel` since it invoked
an `__init__` with self.
I have added a comment under the `__init__` for both `BaseModel` and
`BaseSetting` since not having `self` as the first arg is such a
rarity within Python that it will likely confuse future developers who
encounter it.
The actual name of the variable referencing the class itself can be
up for debate.
* Please Lint
* Please Black
* Update from comments
* support custom root types
* update HISTORY.rst for costom root types
* fix invalid arguments case
* remove the keyword argument of "__root__" in __init__
add a keyword argument of "__root__" in parse_obj
fix documents
create a method for cheking valid field name
* fix parse_obj
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Apply suggestions from code review
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* add type cheking for custom root type
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update index.rst
* Update sphinx from 2.0.1 to 2.1.2
* Update typing-extensions from 3.7.2 to 3.7.4
* Update cython from 0.29.9 to 0.29.11
* Update isort from 4.3.20 to 4.3.21
* Update mypy from 0.701 to 0.711
* Update pytest from 4.6.0 to 5.0.0
* pytest and mypy fixes
* prevent deprication warnings
* Added alias_provider
* Update HISTORY.rst (+ add alias_provider support #622 by @MrMrRobat)
* Rename alias_provider —> alias_generator
Move docs to config section, reformat example
Separate test_alias_generator
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Fix conflict between dictionary field config in Config.fields and Config.alias_generator
Add one more condition for applying alias_generator
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Add test for using alias_generator with field schema
* Fix circular schema generation, remove None checking hack
* Include test written by @wongpat to make it run in CI
* Update History
* Update nested_models in-place
Co-Authored-By: Patrick Wong <wongpat@users.noreply.github.com>
* Update nested_models in-place
Co-Authored-By: Patrick Wong <wongpat@users.noreply.github.com>
* Update nested_models in place everywhere for consistency