__init__.pyi 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 AttrsInstance as AttrsInstance
  26. from attr import cmp_using as cmp_using
  27. from attr import converters as converters
  28. from attr import define as define
  29. from attr import evolve as evolve
  30. from attr import exceptions as exceptions
  31. from attr import Factory as Factory
  32. from attr import field as field
  33. from attr import fields as fields
  34. from attr import fields_dict as fields_dict
  35. from attr import filters as filters
  36. from attr import frozen as frozen
  37. from attr import has as has
  38. from attr import make_class as make_class
  39. from attr import mutable as mutable
  40. from attr import NOTHING as NOTHING
  41. from attr import resolve_types as resolve_types
  42. from attr import setters as setters
  43. from attr import validate as validate
  44. from attr import validators as validators
  45. # TODO: see definition of attr.asdict/astuple
  46. def asdict(
  47. inst: AttrsInstance,
  48. recurse: bool = ...,
  49. filter: Optional[_FilterType[Any]] = ...,
  50. dict_factory: Type[Mapping[Any, Any]] = ...,
  51. retain_collection_types: bool = ...,
  52. value_serializer: Optional[
  53. Callable[[type, Attribute[Any], Any], Any]
  54. ] = ...,
  55. tuple_keys: bool = ...,
  56. ) -> Dict[str, Any]: ...
  57. # TODO: add support for returning NamedTuple from the mypy plugin
  58. def astuple(
  59. inst: AttrsInstance,
  60. recurse: bool = ...,
  61. filter: Optional[_FilterType[Any]] = ...,
  62. tuple_factory: Type[Sequence[Any]] = ...,
  63. retain_collection_types: bool = ...,
  64. ) -> Tuple[Any, ...]: ...