* typing: allow union types for instance_of
fixes#1336
* Make hint meaningful albeit broken
* Stop running mypy on 3.9
* Declare bankruptcy
* Testing types only on 3.10+ now
* Introduce NothingType
* Fallback to typing_extensions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Avoid TypeAlias at runtime
* Add changelog
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Docs
* Add import, test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Make attrs.converters.pipe only return a Converter instance if one is passed
* Add type check overloads to specify that callables will return callables
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Fix type annotations for converter types, considering the Converter class
Also consider that field() or attr.ib() takes a list or tuple of
converters as an implicit pipe, add type annotations for that syntax
* Fix expected mypy output with bad converters now that typing information has been expanded
* Allow converter.optional to take a converter such as converter.pipe as its argument
* Only turn optional into a Converter if needed
* Move call to Converter constructor to the end of optional()
The constructor consumes __annotations__, so move the constructor call to after those have been set on the optional_converter function
* Update tests/test_converters.py
* Update tests/test_converters.py
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* allow __suppress_context__ to be mutated on frozen exceptions
* add changelog
* and __notes__! lets' not forget that.
* add notes to news
* add tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix improt
* fix test
* fix tests again
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Document how to handle class variables/constants in typed syntax
This is mentioned very briefly in the API docs for `auto_attrib` but
it's not easy to find if you don't already know about `typing.ClassVar`.
* Fix typo
* 2 empty lines before headers
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
It took me a bit to figure out what was meant by the link to the
characteristic issue and why there is no such thing as a private
argument. Incorporate (my understanding of) the meaning inline and also
provide an example of how to work around the _1 syntax error.