module documentation
(source)

Undocumented

Class ​ASTConverter No class docstring; 0/7 instance variable, 0/2 constant, 2/84 methods documented
Class ​Type​Converter No class docstring; 0/6 instance variable, 4/28 methods documented
Function ast3​_parse Undocumented
Function bytes​_to​_human​_readable​_repr Converts bytes into some human-readable representation. Unprintable bytes such as the nul byte are escaped. For example:
Function is​_no​_type​_check​_decorator Undocumented
Function parse Parse a source file, without doing any semantic analysis.
Function parse​_type​_comment Parse type portion of a type comment (+ optional type ignore).
Function parse​_type​_ignore​_tag Parse optional "[code, ...]" tag after "# type: ignore".
Function parse​_type​_string Parses a type that was originally present inside of an explicit string, byte string, or unicode string.
Function stringify​_name Undocumented
Constant INVALID​_TYPE​_IGNORE Undocumented
Constant MISSING​_FALLBACK Undocumented
Constant N Undocumented
Constant PY​_MINOR​_VERSION Undocumented
Constant TYPE​_COMMENT​_SYNTAX​_ERROR Undocumented
Constant TYPE​_IGNORE​_PATTERN Undocumented
Constant _dummy​_fallback Undocumented
def ast3_parse(source, filename, mode, feature_version=PY_MINOR_VERSION): (source)

Undocumented

Parameters
source:Union[str, bytes]Undocumented
filename:strUndocumented
mode:strUndocumented
feature​_version:intUndocumented
Returns
ASTUndocumented
def bytes_to_human_readable_repr(b): (source)
Converts bytes into some human-readable representation. Unprintable

bytes such as the nul byte are escaped. For example:

>>> b = bytes([102, 111, 111, 10, 0])
>>> s = bytes_to_human_readable_repr(b)
>>> print(s)
foo
>>> print(repr(s))
'foo\n\x00'
Parameters
b:bytesUndocumented
Returns
strUndocumented
def is_no_type_check_decorator(expr): (source)

Undocumented

Parameters
expr:ast3.exprUndocumented
Returns
boolUndocumented
def parse(source, fnam, module, errors=None, options=None): (source)

Parse a source file, without doing any semantic analysis.

Return the parse tree. If errors is not provided, raise ParseError on failure. Otherwise, use the errors object to report parse errors.

Parameters
source:Union[str, bytes]Undocumented
fnam:strUndocumented
module:Optional[str]Undocumented
errors:Optional[Errors]Undocumented
options:Optional[Options]Undocumented
Returns
MypyFileUndocumented
def parse_type_comment(type_comment, line, column, errors, assume_str_is_unicode=True): (source)

Parse type portion of a type comment (+ optional type ignore).

Return (ignore info, parsed type).

Parameters
type​_comment:strUndocumented
line:intUndocumented
column:intUndocumented
errors:Optional[Errors]Undocumented
assume​_str​_is​_unicode:boolUndocumented
Returns
Tuple[Optional[List[str]], Optional[ProperType]]Undocumented
def parse_type_ignore_tag(tag): (source)

Parse optional "[code, ...]" tag after "# type: ignore".

Return:
  • [] if no tag was found (ignore all errors)
  • list of ignored error codes if a tag was found
  • None if the tag was invalid.
Parameters
tag:Optional[str]Undocumented
Returns
Optional[List[str]]Undocumented
def parse_type_string(expr_string, expr_fallback_name, line, column, assume_str_is_unicode=True): (source)

Parses a type that was originally present inside of an explicit string, byte string, or unicode string.

For example, suppose we have the type Foo["blah"]. We should parse the string expression "blah" using this function.

If assume_str_is_unicode is set to true, this function will assume that Foo["blah"] is equivalent to Foo[u"blah"]. Otherwise, it assumes it's equivalent to Foo[b"blah"].

The caller is responsible for keeping track of the context in which the type string was encountered (e.g. in Python 3 code, Python 2 code, Python 2 code with unicode_literals...) and setting assume_str_is_unicode accordingly.

Parameters
expr​_string:strUndocumented
expr​_fallback​_name:strUndocumented
line:intUndocumented
column:intUndocumented
assume​_str​_is​_unicode:boolUndocumented
Returns
ProperTypeUndocumented
def stringify_name(n): (source)

Undocumented

Parameters
n:ASTUndocumented
Returns
Optional[str]Undocumented
INVALID_TYPE_IGNORE: str = (source)

Undocumented

Value
'Invalid "type: ignore" comment'
MISSING_FALLBACK = (source)

Undocumented

Value
FakeInfo('fallback can\'t be filled out until semanal')

Undocumented

Value
TypeVar('N',
        bound=Node)
PY_MINOR_VERSION = (source)

Undocumented

Value
sys.version_info[1]
TYPE_COMMENT_SYNTAX_ERROR: str = (source)

Undocumented

Value
'syntax error in type comment'
TYPE_IGNORE_PATTERN = (source)

Undocumented

Value
re.compile(r'[^#]*#\s*type:\s*ignore\s*(.*)')
_dummy_fallback = (source)

Undocumented

Value
Instance(MISSING_FALLBACK, [], -1)