class documentation

class AnnotationPrinter(TypeStrVisitor): (source)

View In Hierarchy

Visitor used to print existing annotations in a file. The main difference from TypeStrVisitor is a better treatment of unbound types. Notes: * This visitor doesn't add imports necessary for annotations, this is done separately by ImportTracker. * It can print all kinds of types, but the generated strings may not be valid (notably callable types) since it prints the same string that reveal_type() does. * For Instance types it prints the fully qualified names.

Method __init__ Undocumented
Method args_str Convert an array of arguments to strings and join the results with commas.
Method visit_any Undocumented
Method visit_none_type Undocumented
Method visit_type_list Undocumented
Method visit_unbound_type Undocumented
Method visit_union_type Undocumented
Instance Variable stubgen Undocumented

Inherited from TypeStrVisitor:

Method list_str Convert items of an array to strings (pretty-print types) and join the results with commas.
Method visit_callable_argument Undocumented
Method visit_callable_type Undocumented
Method visit_deleted_type Undocumented
Method visit_ellipsis_type Undocumented
Method visit_erased_type Undocumented
Method visit_instance Undocumented
Method visit_literal_type Undocumented
Method visit_overloaded Undocumented
Method visit_param_spec Undocumented
Method visit_parameters Undocumented
Method visit_partial_type Undocumented
Method visit_placeholder_type Undocumented
Method visit_raw_expression_type Undocumented
Method visit_tuple_type Undocumented
Method visit_type_alias_type Undocumented
Method visit_type_type Undocumented
Method visit_type_var Undocumented
Method visit_type_var_tuple Undocumented
Method visit_typeddict_type Undocumented
Method visit_uninhabited_type Undocumented
Method visit_unpack_type Undocumented
Instance Variable any_as_dots Undocumented
Instance Variable id_mapper Undocumented
def __init__(self, stubgen: StubGenerator): (source)

Undocumented

def args_str(self, args: Iterable[Type]) -> str: (source)

Convert an array of arguments to strings and join the results with commas. The main difference from list_str is the preservation of quotes for string arguments

def visit_any(self, t: AnyType) -> str: (source)

Undocumented

def visit_none_type(self, t: NoneType) -> str: (source)
def visit_type_list(self, t: TypeList) -> str: (source)
def visit_unbound_type(self, t: UnboundType) -> str: (source)
def visit_union_type(self, t: UnionType) -> str: (source)

Undocumented