python-attrs / attrs

Python Classes Without Boilerplate
https://www.attrs.org/
MIT License
5.3k stars 374 forks source link

Fix type annotations for converter types, considering the Converter class #1373

Open filbranden opened 4 days ago

filbranden commented 4 days ago

Summary

A converter can either be a callable with a single argument or an instance of the Converter class, fix the type annotation to allow both cases everywhere _ConverterType is used

Also update field() and attr.ib() which are able to take a list or tuple of converters as an implicit pipe, add type annotations for that syntax

Pull Request Check List

filbranden commented 1 day ago

@hynek Would you kindly take a look whenever possible? Thanks!