* Renamed schema variable name to schema_ as there is a schema function already defined
* Same approach in enum_process_schema()
* added changes file
* Update changes/2724-shahriyarr.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* last shadow rename
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* add `FileUrl` type for `file://` schemes
Also add a `host_required` parameter, True by default,
False in `FileUrl` and `RedisDsn`.
* chore: useless extra in assert statement
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* added KafkaDsn to network
* added short description to chandes folder
* added default non-displayable ports to HttpUrl model
* added info to changes folder
* fix: support non default ports in HttpUrl
* fix pr issues
* remove noqa
* add more typing by @PrettyWood
* add default http and https ports to `HttpUrl` model
* fix mypy
* chore: do not add implementation details
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Added suport to postgresql async driver
* Added postgres+asyncpg in the doc.
* Added changes file
* Added postgresql+pg8000 schema
* ran make format
* Update docs/usage/types.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Changed from schema to scheme
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fixed typo scheme
* fixed merge schema
* changed to one line description
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added others DBAPI dialects.
* Added two # by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fix typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fixed typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added postgresql+psycopg2 in changes dir
* Fixed typo by @samuelcolvin
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* docs: fix typo
* chore: sort alphabetically
Co-authored-by: Fernando Ike <fernando.ike@maburix.com>
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Allow collections.abc.Callable to be used as type in python 3.9
* Add is_none_type as function to check none types by identity
* Modify `typing.is_none_type` to work in python 3.6 and 3.7
* Add tests for none types in typing.py
* Apply review comments on #2519
* Add different implementations depending on python version
* Add tests for is_none_type
* Add change entry
* Fix field info repr
* Remove unneeded try/except for python < 3.8
* Add comment explaining alternative is_none_type implementation
* fix: typo
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* refactor: extra `BaseConfig` and `Extra` in dedicated `config` module
* refactor: clean useless `#noqa: F401`
* refactor: clean useless `#noqa: F811`
* refactor: replace enum check
Error with 3.10
> DeprecationWarning: accessing one member from another is not supported
* refactor: avoid using `distutils` directly
error with python 3.10
> DeprecationWarning: The distutils package is deprecated and slated
> for removal in Python 3.12.
> Use setuptools or check PEP 632 for potential alternatives
* fix: `__annotations__` always exists
* fix: origin of `typing.Hashable` is not `None`
* ci: add run with 3.10.0b2
* docs: add 3.10
* feat: support `|` union operator properly
`|` operator has origin `types.Union` (and not `typing.Union`)
* fix: enum repr is different with 3.10+
* fix: error message changed a bit
change from basic `__init__` to `test_hashable_required.<locals>.MyDataclass.__init__()` (with `__qualname__`)
* fix: always exists and is not inherited anymore
* fix: avoid calling `asyncio.get_event_loop` directly
With python 3.10, calling it results in
> DeprecationWarning: There is no current event loop
* fix(ci): do not run 3.10 on linux for now
For now it can not be compiled.
Let's just skip the check on linux for now instead of tuning the CI pipeline
* fix(ci): ignore DeprecationWarning raised by `mypy` on windows
* docs: add change file
* Add GetterDict example
* Update docs/usage/models.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* add repr parameter to hide a field from repr()
* fix styling issues
… found by flake8.
* fix type annotation issues
* correctly name changes file
* test hiding default values from repr() of a Field
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fix: generate a valid name in schema for `Enum` classes
* test: add schema with generic enum
* (erase me): just to check fastapi tests
* Revert "(erase me): just to check fastapi tests"
This reverts commit f334c4b575d413639d26c17c2c36d30333afcf7c.
* fix linting 😴
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* fix: provide __version__ attribute
Pyinstaller is giving an error packaging a script that uses pydantic, "AttributeError: Module 'pydantic' has no attribute '__version__'"
See Issue #2572
* chore: add md file in changes folder
* test: __version__ attribute of pydantic module
* Add functionality to create a constrained decimal strategy when decimal_place argument is provided
* adding readme
* edit readme
* adding back confloattmul test
* Update changes/2524-cwe5590.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fix(docs): remove colon to separate unrelated clauses
The colon at the end of the line "The fields which were supplied when user was initialised:" suggests that the code following it is related.
Changed it to a period.
* Include change summary readme.
* Add exclude/include as field parameters
- Add "exclude" / "include" as a field parameter so that it can be
configured using model config (or fields) instead of purely at
`.dict` / `.json` export time.
- Unify merging logic of advanced include/exclude fields
- Add tests for merging logic and field/config exclude/include params
- Closes#660
* Precompute include/exclude fields for class
* Increase test coverage
* Remove (now) redundant type checks in Model._iter: New
exclusion/inclusion algorithms guarantee that no sets are passed further down.
* Add docs for advanced field level exclude/include settings
* Minimal optimization for simple exclude/include export
Running benchmarks this vs. master is at:
this: pydantic best=33.225μs/iter avg=33.940μs/iter stdev=1.120μs/iter version=1.7.3
master: pydantic best=32.901μs/iter avg=33.276μs/iter stdev=0.242μs/iter version=1.7.3
* Apply review comments on exclude/enclude field arguments
* Fix/simplify type annotations
* Allow both ``True`` and ``Ellipsis`` to be used to indicate full field
exclusion
* Reenable hypothesis plugin (removed by mistake)
* Update advanced include/include docs to use ``True`` instead of ``...``
* Move field info exclude/include updates into FieldInfo class
This way, the model field object does not need to concern itself with
dealing with field into specific fields.
(Same was done for alias in a previous commit).
* remove double back tick in markdown.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* docs preview using smokeshow
* switch to using smokeshow for coverage
* fix macos and windows builds
* correct coverage prep.
* tweak coverage build logic
* print more coverage info
* mess with coverage setup, set config [PATHS]
* updating badges
* add context to coverage reports
* adding smokeshow status context
* allow Config.field to update a Field, fix#2426
* move logic to update_from_config, work with Annotated
* fix flake8 erroneous warnings
* test for allow_mutation
* better support for allow_mutation
* fix: support properly `Enum` when combined with generic models
* whitelist iterables
* update change description
* add test for Literal
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* added method to generate a constrained float with multiple_of argument
* removed HealthCheck.filter_too_much
* Added change file
* fixes for case when min/max aren't provided; adding an extra test for float gt/lt with multiple of
* add tests that should pass
But we have those errors
226: error: Item "str" of "Union[UUID, str]" has no attribute "hex" [union-attr]
227: error: Item "str" of "Union[UUID, str]" has no attribute "hex" [union-attr]
228: error: Item "str" of "Union[Path, str]" has no attribute "absolute" [union-attr]
229: error: Item "str" of "Union[Path, str]" has no attribute "absolute" [union-attr]
230: error: Item "str" of "Union[Path, str]" has no attribute "absolute" [union-attr]
231: error: Item "str" of "Union[Path, str]" has no attribute "absolute" [union-attr]
* fix: right types should be valid
* remove new useless `type: ignore`
* docs: add change file
* Support `Field` in `dataclass` + `'metadata'` kwarg of `dataclasses.field`
Please enter the commit message for your changes. Lines starting
* add `__has_field_info_default__` for minimal effect on perf
* lower complexity of `_process_class`