type_stubs

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

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

A simple function.

var: list[str] = []

Docstring override from the .pyi file.

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

An attribute

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

A simple method.

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

A method not present in the .pyi file.

def overloaded(*args, **kwds):
34    def overloaded(self, x):
35        """An overloaded method."""

An overloaded method.

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

An attribute

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

A simple method.

class ImportedClass:
2class ImportedClass:
3    """Docstring from imported py file - ideally this should be overridden."""

Docstring from imported py file - ideally this should be overridden.