class documentation

class Director: (source)

View In Hierarchy

Holds all of the directive information for a source file.

Method __init__ Create a Director for a source file.
Method filter_error Return whether the error should be logged.
Instance Variable block_returns Undocumented
Instance Variable features Undocumented
Instance Variable matches Undocumented
Instance Variable return_lines Undocumented
Property annotations Undocumented
Property decorators Undocumented
Property ignore Undocumented
Property type_comments Undocumented
Method _adjust_line_number_for_pytype_directive Adjusts the line number for a pytype directive.
Method _parse_src_tree Parse a source file, extracting directives from comments.
Method _process_pytype Process a pytype: comment.
Method _process_type Process a type: comment.
Instance Variable _decorators Undocumented
Instance Variable _disables Undocumented
Instance Variable _errorlog Undocumented
Instance Variable _filename Undocumented
Instance Variable _function_ranges Undocumented
Instance Variable _ignore Undocumented
Instance Variable _type_comments Undocumented
Instance Variable _variable_annotations Undocumented
def __init__(self, src_tree, errorlog, filename, disable, code): (source)

Create a Director for a source file. Args: src_tree: The source text as an ast. errorlog: An ErrorLog object. Directive errors will be logged to the errorlog. filename: The name of the source file. disable: List of error messages to always ignore. code: Optionally, bytecode for adjusting line numbers. If provided, directives will be moved to lines at which corresponding opcodes are present. Otherwise, directives will be moved to the starting line of their containing statement.

def filter_error(self, error): (source)

Return whether the error should be logged. This method is suitable for use as an error filter. Args: error: An error._Error object. Returns: True iff the error should be included in the log.

block_returns = (source)

Undocumented

features = (source)

Undocumented

Undocumented

return_lines = (source)

Undocumented

@property
annotations = (source)

Undocumented

Undocumented

Undocumented

@property
type_comments = (source)

Undocumented

def _adjust_line_number_for_pytype_directive(self, line: int, error_class: str, line_range: parser.LineRange, opcode_lines: Optional[_OpcodeLines]): (source)

Adjusts the line number for a pytype directive.

def _parse_src_tree(self, src_tree, code): (source)

Parse a source file, extracting directives from comments.

def _process_pytype(self, line: int, data: str, open_ended: bool, line_range: parser.LineRange, opcode_lines: Optional[_OpcodeLines]): (source)

Process a pytype: comment.

def _process_type(self, line: int, data: str, open_ended: bool, line_range: parser.LineRange, opcode_lines: Optional[_OpcodeLines]): (source)

Process a type: comment.

_decorators = (source)

Undocumented

_disables = (source)

Undocumented

_errorlog = (source)

Undocumented

_filename = (source)

Undocumented

_function_ranges = (source)

Undocumented

Undocumented

_type_comments: dict = (source)

Undocumented

_variable_annotations: dict = (source)

Undocumented