__init__.pyi 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from typing import (
  2. Any,
  3. Callable,
  4. Dict,
  5. Mapping,
  6. Optional,
  7. Sequence,
  8. Tuple,
  9. Type,
  10. )
  11. # Because we need to type our own stuff, we have to make everything from
  12. # attr explicitly public too.
  13. from attr import __author__ as __author__
  14. from attr import __copyright__ as __copyright__
  15. from attr import __description__ as __description__
  16. from attr import __email__ as __email__
  17. from attr import __license__ as __license__
  18. from attr import __title__ as __title__
  19. from attr import __url__ as __url__
  20. from attr import __version__ as __version__
  21. from attr import __version_info__ as __version_info__
  22. from attr import _FilterType
  23. from attr import assoc as assoc
  24. from attr import Attribute as Attribute
  25. from attr import define as define
  26. from attr import evolve as evolve
  27. from attr import Factory as Factory
  28. from attr import exceptions as exceptions
  29. from attr import field as field
  30. from attr import fields as fields
  31. from attr import fields_dict as fields_dict
  32. from attr import frozen as frozen
  33. from attr import has as has
  34. from attr import make_class as make_class
  35. from attr import mutable as mutable
  36. from attr import NOTHING as NOTHING
  37. from attr import resolve_types as resolve_types
  38. from attr import setters as setters
  39. from attr import validate as validate
  40. from attr import validators as validators
  41. # TODO: see definition of attr.asdict/astuple
  42. def asdict(
  43. inst: Any,
  44. recurse: bool = ...,
  45. filter: Optional[_FilterType[Any]] = ...,
  46. dict_factory: Type[Mapping[Any, Any]] = ...,
  47. retain_collection_types: bool = ...,
  48. value_serializer: Optional[
  49. Callable[[type, Attribute[Any], Any], Any]
  50. ] = ...,
  51. tuple_keys: bool = ...,
  52. ) -> Dict[str, Any]: ...
  53. # TODO: add support for returning NamedTuple from the mypy plugin
  54. def astuple(
  55. inst: Any,
  56. recurse: bool = ...,
  57. filter: Optional[_FilterType[Any]] = ...,
  58. tuple_factory: Type[Sequence[Any]] = ...,
  59. retain_collection_types: bool = ...,
  60. ) -> Tuple[Any, ...]: ...