* fix(decorator): detect when a duplicate argument is passed in
Currently, it is possible to override a positional argument with a keyword
argument using the decorator.
In native python, this raises a TypeError.
Detect this usecase, to prevent keywords overriding positional parameters.
Closes: https://github.com/samuelcolvin/pydantic/issues/2249
* add changelog entry
* fix docs example to not override positional argument
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* fix(decorator): align kwargs behaviour with native python
Previously, validate_arguments would strip the value if the keyword
was the same as the target kwargs argument.
Align with Python's behaviour.
* fix: also prevent overwriting variable args
Introduces tests for both, which compare against the native python implementation
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* mention about 'args' in the changelog too
* simplify var_kwargs pop
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* update_forward_refs now modifies only a copy of __dict__ of cls.__module__
* changes
* test for update_forward_refs
* fixed brackets
* black changes fixed
* make format
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* starting validation_decorator
* correct skip_pre_38
* fix coverage and type hints
* mypy tests and move to class based decorator
* 3.6 fix, prevent duplicate github actions
* correct py 3.6 check
* better errors
* cleaner field names for args and kwargs
* add change and comments
* starting docs
* back to 3.7 for docs
* docs
* bump
* add async example and fix print indents
* allow type annotations as strings
* python 3.8 in docs