1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# stdlib
from typing import TypeVar
# 3rd party
import attr
__all__ = (
"Demo",
"SlotsDemo",
'T',
"T_co",
"T_contra",
'S',
"DS",
"FR",
)
FR = TypeVar("FR", bound="SlotsDemo")
@attr.s(slots=False)
class Demo:
"""
An attrs class
"""
#: An argument
arg1: str = attr.ib()
#: Another argument
arg2: int = attr.ib()
@attr.s(slots=True)
class SlotsDemo:
"""
An attrs class with slots=True
"""
#: An argument
arg1: str = attr.ib()
#: Another argument
arg2: int = attr.ib()
T = TypeVar('T')
T_co = TypeVar("T_co", covariant=True)
T_contra = TypeVar("T_contra", contravariant=True)
S = TypeVar('S', bound=SlotsDemo)
DS = TypeVar("DS", SlotsDemo, Demo)
|