File: _autonamedtuple_demo_pep563.py

package info (click to toggle)
sphinx-toolbox 3.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,924 kB
  • sloc: python: 11,636; sh: 26; javascript: 25; makefile: 16
file content (23 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

# stdlib
from typing import Callable, NamedTuple

# Examples from
# https://docs.python.org/3/library/typing.html#typing.NamedTuple
# https://www.python.org/dev/peps/pep-0589/#totality
# https://github.com/python/typing/pull/700

__all__ = ("Animal", )


class Animal(NamedTuple):
	"""
	An animal.

	:param name: The name of the animal.
	:param voice: The animal's voice.
	"""

	name: str
	voice: Callable[[], str]