type_stub

This module has an accompanying .pyi file with type stubs.

 1"""
 2This module has an accompanying .pyi file with type stubs.
 3"""
 4
 5
 6def func(x, y):
 7    """A simple function."""
 8
 9
10var = []
11"""A simple variable."""
12
13
14class Class:
15    attr = 42
16    """An attribute"""
17
18    def meth(self, y):
19        """A simple method."""
20
21    class Subclass:
22        attr = "42"
23        """An attribute"""
24
25        def meth(self, y):
26            """A simple method."""
27
28    def no_type_annotation(self, z):
29        """A method not present in the .pyi file."""
30
31    def overloaded(self, x):
32        """An overloaded method."""
def func(x: str, y: Any, z: Iterable[str]) -> int:
7def func(x, y):
8    """A simple function."""

A simple function.

var: list[str] = []

Docstring override from the .pyi file.

class Class:
15class Class:
16    attr = 42
17    """An attribute"""
18
19    def meth(self, y):
20        """A simple method."""
21
22    class Subclass:
23        attr = "42"
24        """An attribute"""
25
26        def meth(self, y):
27            """A simple method."""
28
29    def no_type_annotation(self, z):
30        """A method not present in the .pyi file."""
31
32    def overloaded(self, x):
33        """An overloaded method."""
attr: int = 42

An attribute

def meth(self, y: bool) -> bool:
19    def meth(self, y):
20        """A simple method."""

A simple method.

def no_type_annotation(self, z):
29    def no_type_annotation(self, z):
30        """A method not present in the .pyi file."""

A method not present in the .pyi file.

def overloaded(*args, **kwds):
32    def overloaded(self, x):
33        """An overloaded method."""

An overloaded method.

class Class.Subclass:
22    class Subclass:
23        attr = "42"
24        """An attribute"""
25
26        def meth(self, y):
27            """A simple method."""
attr: str = '42'

An attribute

def meth(self, y: bool) -> bool:
26        def meth(self, y):
27            """A simple method."""

A simple method.