typed_dict

 1from typing import TypedDict
 2
 3
 4class Foo(TypedDict):
 5    a: int | None
 6    """First attribute."""
 7
 8
 9class Bar(Foo, total=False):
10    """A TypedDict subclass. Before 3.12, TypedDict botches __mro__."""
11
12    b: int
13    """Second attribute."""
14    c: str
15    # undocumented attribute
16
17
18class Baz(Bar):
19    """A TypedDict subsubclass."""
20
21    d: bool
22    """new attribute"""
class Foo(typing.TypedDict):
5class Foo(TypedDict):
6    a: int | None
7    """First attribute."""
a: int | None

First attribute.

class Bar(Foo):
10class Bar(Foo, total=False):
11    """A TypedDict subclass. Before 3.12, TypedDict botches __mro__."""
12
13    b: int
14    """Second attribute."""
15    c: str
16    # undocumented attribute

A TypedDict subclass. Before 3.12, TypedDict botches __mro__.

b: int

Second attribute.

c: str
Inherited Members
Foo
a
class Baz(Bar):
19class Baz(Bar):
20    """A TypedDict subsubclass."""
21
22    d: bool
23    """new attribute"""

A TypedDict subsubclass.

d: bool

new attribute

Inherited Members
Bar
b
c
Foo
a