forked from pydantic/pydantic
-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix extra in dataclasses with bases #148
Closed
DetachHead
wants to merge
223
commits into
PrettyWood:dataclass-extra
from
DetachHead:dataclass-extra
Closed
fix extra in dataclasses with bases #148
DetachHead
wants to merge
223
commits into
PrettyWood:dataclass-extra
from
DetachHead:dataclass-extra
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`importlib-metadata` now requires python3.8+ or `typing-extensions` since [3.2.0](python/importlib_metadata@530f5da#diff-cc51f8e0c17159a1860664f70a89eba0d48c641f4deafe74912a7274dff91a34R15) And `pytest` doesn't pin the version of `importlib-metadata`. So on the CI when we uninstall `typing-extensions` **after** installing `pytest`, it crashes! Let's pin `importlib-metadata` to 3.1.0 for now
… 6.1.7 and codecov-action v1.0.15 (pydantic#2201) * build(deps): bump to pytest 6.2.1, pytest-mock 3.4.0, mkdocs-material 6.1.7 and codecov-action v1.0.15 replaces pydantic#2199, pydantic#2180 and pydantic#2164 * fix: yield_fixture is deprecated * chore: add dotenv in optional deps
* Add `rediss` (Redis over SSL) protocol to `RedisDsn` * Update docs * Update changes history * Fix typo in `changes/1911-TrDex.md` Co-authored-by: PrettyWood <em.jolibois@gmail.com> * Bump black from 19.10b0 to 20.8b1 (pydantic#1909) * Bump black from 19.10b0 to 20.8b1 Bumps [black](https://github.com/psf/black) from 19.10b0 to 20.8b1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/master/CHANGES.md) - [Commits](https://github.com/psf/black/commits) Signed-off-by: dependabot[bot] <support@github.com> * fix: run `make format` Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: PrettyWood <em.jolibois@gmail.com> * Allow URLs without `user` part Refer to pydantic#1877 * Update docs * Allow Redis DSN with schema only Refer to pydantic#1911 (comment) Refer to https://www.iana.org/assignments/uri-schemes/prov/redis * Fix lint error * Fix lint error * Set `parts: Dict[str, Optional[str]]` instead of `Dict[str, str]` * Fix linting * More verbose default values set in `RedisDsn.validate_parts()` * Fix linting 2 * Fix typo in docs * Add a note in the changelog * Add test case for URL without `user` part * change port in test Co-authored-by: PrettyWood <em.jolibois@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
… to be present in parent generic classes (pydantic#1989) * Fix pydantic#947, fix pydantic#1483, fix pydantic#1247 allow inner type vars to be present in parent generic classes - Rename generics._is_type to _is_generic in response to comment: pydantic#1989 (comment) - Add more explicit type assertion in generics test - Add generics tests and unify naming - Move deep generic tests all into same place in code - Unify naming convention in deep generic tests using naming of existing tests - Add tests for multiple inheritance and multiple type vars - Add generic tests for type hint resolution cases - Fix edge cases for handling parameters in generic models - Resolve parameters correctly - Add tests for special cases like callables - Add returning generic type directly if parameters and arguments are identical. * Apply review comments - Add docstrings - Small refactor `generics.__concrete_name__` - Small refactor of `generics.resolve_type_hints` - Change `is_identity_typevars_map` to more generic and clearer `all_identical` and move into utils. - rename "resolve_type_hint" to "replace_types" so as to not get confused with "resolve_annotations" from `pydantic.typing` * Fix generics test coverage * Update pydantic/generics.py, remove unneeded annotation mypy understands list comprehensions as they are now Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Use % for percentage in string format * add change Co-authored-by: Samuel Colvin <s@muelcolvin.com>
…ling it (pydantic#2128) * feat: add `validate` method on function to validate input without calling it * docs: add documentation * chore: add change file
…ic#2149) * feat: add validator for NoneType closes pydantic#2095 * feat: support NoneType directly as type * chore: add change file * chore: fix typo * fix: handle Literal[None] for python3.6/3.7 without typing_extensions * chore: move NotNoneError and export it * chore: use constant NONE_TYPES to simplify a bit * chore: use check on Literal instead of typing_extensions These tests would not run on python 3.8+ without typing_extensions even though Literal is defined * test: use fresh Literal[None] in test case * feat: handle `None` type in schema * docs: add NoneType documentation * refactor: switch NONE_TYPES from tuple to set
* fix: ignore `__doc__` as valid private attribute (pydantic#2091) closes pydantic#2090 * Fixes a regression where Enum fields would not propagate keyword arguments to the schema (pydantic#2109) fix pydantic#2108 * Fix schema extra not being included when field type is Enum * Code format * More code format * Add changes file Co-authored-by: Ben Martineau <b.martineau@iwoca.co.uk> * fix: update all modified field values in `root_validator` when `validate_assignment` is on (pydantic#2119) * fix: update all modified field values in `root_validator` when `validate_assignment` is on closes pydantic#2116 * chore: update root_validator name Co-authored-by: Arthur Pastel <arthur.pastel@gmail.com> Co-authored-by: Arthur Pastel <arthur.pastel@gmail.com> * fix: support `underscore_attrs_are_private` with generic models (pydantic#2139) closes pydantic#2138 * fix: set right default value for required (optional) fields (pydantic#2143) closes pydantic#2142 * Fix pydantic#2111: support pickle for built-in dataclasses (pydantic#2114) * 2111: support pickle for built-in dataclasses * 2111: add changes * 2111: simplify test * return original name + handle similar names * add additional check * fix a misspell * remove useless f-string * cleanup test Co-authored-by: Samuel Colvin <s@muelcolvin.com> * uprev and add history * tempoarily pin pip Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Ben Martineau <bm424@cam.ac.uk> Co-authored-by: Ben Martineau <b.martineau@iwoca.co.uk> Co-authored-by: Arthur Pastel <arthur.pastel@gmail.com> Co-authored-by: aimestereo <aimestereo@gmail.com>
… models (pydantic#2167) * revert logic of pydantic#2143 * rewrite logic removed in pydantic#1755 * test: add test to ensure dynamic and static behaviours are the same
* fix: parse URL fragment without query string (pydantic#2168) * Add changes file
Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.3 to 5.3.1. - [Release notes](https://github.com/nedbat/coveragepy/releases) - [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst) - [Commits](nedbat/coveragepy@coverage-5.3...coverage-5.3.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 6.1.7 to 6.2.3. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/docs/changelog.md) - [Commits](squidfunk/mkdocs-material@6.1.7...6.2.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [twine](https://github.com/pypa/twine) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/pypa/twine/releases) - [Changelog](https://github.com/pypa/twine/blob/master/docs/changelog.rst) - [Commits](pypa/twine@3.2.0...3.3.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ntic#2230) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.0.15 to v1.1.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](codecov/codecov-action@v1.0.15...1fc7722) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
pydantic#2181) * fix: ensure to always return one of the values in `Literal` field type closes pydantic#2166 * perf: improve `literal_validator` speed Thanks to @yobiscus * fix: when more options in Literal switch from `set` to `dict` to still have a O(1) complexity Thanks @layday :)
…c#2221) * fix: force need of `update_forward_refs` in recursive models closes pydantic#1201 * fix: lint issue (false positive) PyCQA/pyflakes#567 * chore: avoid if statement for coverage * fix linting Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* chore: unpin pip revert pydantic@de0657e * fix CI temporarily * improve caught warning in pytest Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* build(deps): bump mkdocs-material from 6.2.3 to 6.2.8 * build(deps): bump codecov/codecov-action from v1.1.1 to v1.2.1 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.1.1 to v1.2.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](codecov/codecov-action@v1.1.1...e156083) Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump pytest-cov from 2.10.1 to 2.11.1 Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.10.1 to 2.11.1. - [Release notes](https://github.com/pytest-dev/pytest-cov/releases) - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v2.10.1...v2.11.1) Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump pytest-mock from 3.4.0 to 3.5.1 Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.4.0 to 3.5.1. - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-mock@v3.4.0...v3.5.1) Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump isort from 5.6.4 to 5.7.0 Bumps [isort](https://github.com/pycqa/isort) from 5.6.4 to 5.7.0. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md) - [Commits](PyCQA/isort@5.6.4...5.7.0) Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump mypy from 0.790 to 0.800 * build(deps): bump pytest from 6.2.1 to 6.2.2 * build(deps): bump coverage from 5.3.1 to 5.4 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tic#1991) * fix: check only first sublevel for validators with `each_item` When using a validator with `each_item`, the items are all validated one by one. But if the items are also iterable the subitems would then be validated because the validator would be kept as it is. Now the validator passed to the items is changed and won't be propagated closes pydantic#1933 * chore: add breaking change
…tic#2094) * fix(fields): handle properly default value for type `Callable` closes pydantic#1596 * chore: move test in test_dataclasses * chore: add comments * test: rewrite test * chore: remove useless variable * fix(schema): add support when callable field has default value closes pydantic#2086
* Configure Hypothesis * Hypothesis plugin docs * Add Hypothesis plugin Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* feat: Add the ability to add extra settings sources * doc: Document "customise settings sources" feature * tests: Add missing test and add change file * Update changes/2107-kozlek.md Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> * improve docs for settings customise_sources * fix docs building * fix test :-( Co-authored-by: Thomas Berdy <thomas.berdy@outlook.com> Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
…red within different classes (pydantic#2170) * Fixed issue causing KeyError to be raised when building schema from multiple `BaseModel` with the same names declared in separate classes (pydantic#1912) * Update test * Removed redundant f-string * Fixed formatting * Fixed lint
…ntic#2198) * docs: add changelog entry * chore: add a frozenset type annotation
* make hypothesis optional for testing * fix coveragin in "_hypothesis_plugin.py" * uncomment ci checks
* added anystr_lower field to config * updated docs with any anystr_lower config property * updated changes folder with markdown describing new change * added anystr to _validators list under bytes type * added unit tests for anystr_lower config * Update pydantic/validators.py Fix wrong method used in cosntr_lower Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> * added lower_str to conbytes and constr functions * Update changes/2134-tayoogunbiyi.md Co-authored-by: Samuel Colvin <samcolvin@gmail.com> * renamed conbytes & constr paramater name * updated change markdown * added docs for args to constr and conbytes * added examples to showing to_lower functionality in conbytes & constr * added better description for curtail_length * removed unessary whitespace, added default and types in docs * Update changes/2134-tayoogunbiyi.md Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> * added single whitespace to arguments list under constr & conbytes Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Samuel Colvin <samcolvin@gmail.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
…antic#2970) * Parse JSON for union type with complex subfields (pydantic#2936) * style * simplify Co-authored-by: Christopher Bartz <c.bartz@zbw.eu> Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* mention 3.8 requirement in contrib docs * add change.md for PR#2856 * docs: fix grammar and wording
* clarify docs on validation and strict type checking Related: Issue#578 Co-authored-by: cknoll <unknown@exampleemail.com> Co-authored-by: PyAntony <unknown@exampleemail.com> * add change.md for PR#2855 * docs: explicitly specify _partial_ support * chore: update formatting of change description Co-authored-by: cknoll <unknown@exampleemail.com>
* Added dark color scheme for docs Added alternative, dark color scheme for docs, which should be automatically activated if user's browser presents the `prefers-color-scheme: dark` media query. * switch icons * add change file Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Accept empty query/fragment URL parts * forbid two # in fragment Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* fix(schema): fix schema generation for `Deque` field * add change description
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Thanks to @PrettyWood for pointing me to the right place to fix this! Since I was told that both NamedTuple and TypedDict use the same __pydantic_model__ machinery that dataclasses do, I checked and found that TypedDict had the same bug, and fixed that too. Tests for both issues are included, which fail without the associated fixes being applied.
* add toml reader * fix path * skip configparser step * fix quotes * full pyproject.toml check * add doc note * cleaner formatting, raise ValueError for non-bool * fix tests * add bad config test case * add changelog file. * bump mypy to 0.902 * tweak change MD, fix formatting in requirements * import check around toml * switch to tomli for parsing to match mypy dependency * import check around toml/tomli * add note on tomli usage * more succinct changelog entry * fix quotes in changelog * linting fixes, remove unnecessary stub install * mypy checks on mypy plugin file * wrongly placed pragma no cover Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Fix bug when mypy plugin fail on construct method call * Update type annotation for __config__ field * Remove type ignore * Update changes/2753-uriyyo.md Co-authored-by: Eric Jolibois <em.jolibois@gmail.com> Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
…tic#3176) * fix: make `validate_arguments` work with `Config.validate_all` * coverage
…dantic#2721) * ✨ Add autocomplete support for VS Code, via dataclass_transform * 📝 Update changes * 📝 Add docs for VS Code * 📝 Clarify strict type error checks alternatives, include example with cast() * ♻️ Update BaseSettings annotation to improve editor support keeping editor support for BaseSetting's custom Config, but preventing __config__ from showing in constructor on editors supporting dataclass_transform * 🎨 Remove unused type: ignore comment * 🎨 Update type annotations for BaseSettings and BaseModel to use ClassVar where suitable to improve editor support with type annotations and dataclass_transform * 🎨 Apply ClassVars again * 📝 Simplify VS Code docs terms refer mainly to Pylance and clarify the relationship with Pyright * 📝 Add link to Pylance FAQ Co-authored-by: PrettyWood <em.jolibois@gmail.com>
Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.17.4 to 6.18.0. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](HypothesisWorks/hypothesis@hypothesis-python-6.17.4...hypothesis-python-6.18.0) --- updated-dependencies: - dependency-name: hypothesis dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps-dev): bump mkdocs requirements * fix: google analytics `google_analytics` is deprecated and mkdocs raises an error in strict mode Switched to new syntax squidfunk/mkdocs-material#2055 https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#google-analytics
Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.18.0 to 6.24.0. - [Release notes](https://github.com/HypothesisWorks/hypothesis/releases) - [Commits](HypothesisWorks/hypothesis@hypothesis-python-6.18.0...hypothesis-python-6.24.0) --- updated-dependencies: - dependency-name: hypothesis dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Customisation is the British spelling. Below (and elsewhere) the American spelling (customization) is used.
DetachHead
force-pushed
the
dataclass-extra
branch
from
November 5, 2021 07:39
d9bc078
to
5074f94
Compare
not required since pydantic#3674 was merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
it was throwing "missing required positional argument" because the new
__init__
was removing the arguments for the bases