* StrictBool
StrictBool only allows booleans to be parsed. Any other value, no matter
its truthiness, is rejected.
* Fix type of `validate`
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* " => '
* Update the exotic docs with StrictBool
* Fix error message
* Improve docs
* tweak docs.
* Add support for circular references in generated JSON Schema
* Update JSON Schema for referenced models with overrides, using allOf
* Add tests for circular references in Python 3.7
* Update History
* Remove unnecessary check, raise coverage (remove partial)
* Trigger Travis and others
* Use str concat expression instead of double expression in schema
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update pydantic/schema.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Partial implementation of PR review
* Simplify definition of known_models
* added feature post_init_post_parse
* fixed bug where post_init_post_parse was triggered without looking is post_init_original is set
* change double to single quotes
* __doc__ strings fixed back to double quote
* added better way of doing the post_init_post_parse also tests passes now
* removed unused file
* deleted unnecessary test
* update history.rst, changed previouis change 560 to breaking change because it broke the original flow
* update docs, added section post_init_post_parse under dataclasses
* added __post_init_post_parse__ as attribute of DataclassType
* Update HISTORY.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update HISTORY.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update pydantic/dataclasses.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* update docs, added subsection initialize hooks under dataclasses
* my bad
* make tests work again
* removed checking if post_init_parse is none
* correct typo in history
* fixed typo in history.rst
* Update pygments from 2.3.1 to 2.4.2
* Update sphinxcontrib-websupport from 1.1.0 to 1.1.2
* Update email-validator from 1.0.3 to 1.0.4
* Update isort from 4.3.17 to 4.3.20
* Update pytest from 4.4.1 to 4.6.0
* Update pytest-cov from 2.6.1 to 2.7.1
* Fix issue with unspecified generic type, fix#550
Seems to solve #550
With this change, models with bare `List` or `Dict` as a typehint still validate for type agreement, but don't validate the type of the parameters.
I'm not sure this is the "right" fix (I don't know the implications of ignoring TypeVars like this), but considering how simple it was I figured I'd at least share.
* Update validators.py
Found this discussion: https://github.com/samuelcolvin/pydantic/issues/545; `lenient_issubclass` does seem to fix it.
* Update validators.py
Hacky solution to prevent no validator exception. Maybe there's a better way?
* Tests pass and PR checklist done
* Check sooner
* Block empty list from dict constructor
* Removed modifications to dict_validator
* Color validator MVP
* Color Validator refactored
* Small optimizations applied
* Code coverage improved
* hex processing improved, json encoder and repr added
* Add documentation, update HISTORY (#504)
* Increase test coverage (#504)
* hex helpers refactored (#504)
* Fixes after code review (#509)
* Color Type section in docs reduced
* Check for valid but unnamed colors
* Minor fixes: typo in docs, default value for float comparison function
* rewrite Color
* fix color tests
* tweaks and improve docs
* tweaks and change Color.__str__
* add as_hsla and as_hsl
* support more rgb(a) formats
* add hsl parsing
* parsing hex with alpha channel
* fix hsl parsing
* simpler failure/fallback rules for color display
* storage as floats internally
* tweak docs
* fix type hints
* Fix __fields_set__ not using alias field names (#517)
fix#517
* Update HISTORY.rst
* Fix single quotes
* Don't need to check allow_population_by_alias
* Calculate fields_set in validate_model instead
* Fix formatting
* Add breaking change to history
* Minor fixed to validate_mode
* Minor fixes to tests
* Add comments for names_used and fields_set in validate_model
* Update sphinx from 2.0.0 to 2.0.1
* Update isort from 4.3.16 to 4.3.17
* Update mypy from 0.670 to 0.701
* Update pytest from 4.4.0 to 4.4.1
* Update pytest-mock from 1.10.3 to 1.10.4
* fix typing
* feat: implement const keyword in Schema
Fix#434.
* make fields marked `const` optional
* move `const` out of the `Field`
* check that `schema` is not `None` instead of using `getattr`
* tweak constant error
* fix json for Path, FilePath, and DirectoryPath objects, fix#473
* convert to single spaces
* assert result to a string
* Update test_json.py
* encode entire Path hierarchy the same way
* Added validators for dataclass, fix#415
* Added dataclass validators
* Added dataclass validators
* Updated docs for added validating to dataclass
* Updated docs for added validating to dataclass
* Fixed line endings
* Set __validators__ type to Mapping instead of Dict
* Update History
* Use __mro__ instead of __bases__ for gather_validators
* Fix PR number
* Fix issue.rst header underline
* Fix HISTORY.rst merge conflict
* Fix utils.py merge conflict
* fix utils.py
* Rebase and other fixes
* Fix rebase and other issues
* Change history
* Remove unnecessary lines in main.py
* Rebase
* Update history
* Rename ModelType to ModelOrDc
* Added inheritance replace test
* More consiste dataclass validator tests
* fix history.
* Remove Optional ModelOrDc Type
* Fix ModelOrDc
* fix: serialize secrets to json, fix#462
* feat: adjust documentation for secretstr.
* feat: undo unnecessary changes. keep tests.
* fix: tests were broken, now they're fixed again.
* feat: add display fn to SecretStr and SecretBytes, to be used for json output.
* fix: minor typo.
* fix: last few comments.
* Update sub_types when calling update_forward_refs(), fix#404
* Update History
* Handle deeply nested ForwardRef types in sub_types using recursion
* Move update_field_forward_refs to utils.py
* feat: add SecretStr and SecretBytes.
* chore: update HISTORY.rst
* fix: file permissions were incorrect.
* feat: lint, format, fix comments.
* feat: changed inner type of SecretBytes in the schema to string as there is no bytes type in json.
* feat: remove format from secret str and secret bytes.
* feat: fix schema mapping.
* Support specialized ClassVars, e. g. ClassVar[int] now works in a model, fix#435
* Use apostrophes and pass the test also on python 3.6, where ClassVar[int] is a ClassVar, not a _GenericAlias. Note that the == operator gives False in this case, so we must really compare the classes directly.
* Another attempt at the ClassVar check.
* Ran make format.
* Make mypy happy.
* add HISTORY
* fix ForwardRef collection bug, fix#439
* reformat codes
* minor document error
* add HISTORY.rst and simplified unit test
* restore the original example for ForwardRef
* Update sphinx from 1.8.4 to 2.0.0
* Update attrs from 18.2.0 to 19.1.0
* Update black from 18.9b0 to 19.3b0
* Update coverage from 4.5.2 to 4.5.3
* Update isort from 4.3.9 to 4.3.16
* Update pytest from 4.3.0 to 4.4.0
* Update pytest-isort from 0.2.1 to 0.3.1
* Update pytest-mock from 1.10.1 to 1.10.3
* IPv{4,6,Any}{Network,Interface} types added, unittests and docs updated
* HISTORY.rst minor update
* Remove strict argument from IP network types
* IP Networks validators and type hints fixed
* tweak history
* Update sphinx from 1.8.3 to 1.8.4
* Update flake8 from 3.7.4 to 3.7.7
* Update isort from 4.3.4 to 4.3.9
* Update mypy from 0.660 to 0.670
* Update pyflakes from 2.1.0 to 2.1.1
* Update pytest from 4.2.0 to 4.3.0
* Update pytest-mock from 1.10.0 to 1.10.1
fix#378
* Tracking for setting attributes
* Fixes accidental leak of fields
* Allows defaults fields to be recursively set
* Docs and history for skip_defaults
* Mypy fix on calculate keys
* Update pydantic/main.py
Co-Authored-By: dgasmith <dgasmith@icloud.com>
* Update pydantic/main.py
Co-Authored-By: dgasmith <dgasmith@icloud.com>
* Update HISTORY.rst
Co-Authored-By: dgasmith <dgasmith@icloud.com>
* Cleanup pass based off review
* Simplifies constructors based on feedback
* Makes mypy happy with exlicit KeysView
* SetOrKeys and faster key search
* Formats files once more
* add tests for dict, pickle and construct
* fixes for dict, pickle and construct
* correct field_set for extra.ignore
* Fixes format