Module opshin.typed_ast

Expand source code
import ast as _ast
import typing as _typing
import pluthon as _plt

from .type_impls import NoneInstanceType, Type


class TypedAST(_ast.AST):
    typ: "Type"


class typedexpr(TypedAST, _ast.expr):
    def typechecks(self) -> _typing.Dict[str, "Type"]:
        """Successful typechecks if this expression evaluates to True"""
        return {}


class typedstmt(TypedAST, _ast.stmt):
    # Statements always have type None
    typ = NoneInstanceType


class typedarg(TypedAST, _ast.arg):
    pass


class typedarguments(TypedAST, _ast.arguments):
    args: _typing.List[typedarg]
    vararg: _typing.Union[typedarg, None]
    kwonlyargs: _typing.List[typedarg]
    kw_defaults: _typing.List[_typing.Union[typedexpr, None]]
    kwarg: _typing.Union[typedarg, None]
    defaults: _typing.List[typedexpr]


class TypedModule(typedstmt, _ast.Module):
    body: _typing.List[typedstmt]


class TypedFunctionDef(typedstmt, _ast.FunctionDef):
    body: _typing.List[typedstmt]
    args: typedarguments
    orig_name: str


class TypedIf(typedstmt, _ast.If):
    test: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]


class TypedReturn(typedstmt, _ast.Return):
    value: typedexpr


class TypedExpression(typedstmt, _ast.Expression):
    body: typedexpr


class TypedCall(typedexpr, _ast.Call):
    func: typedexpr
    args: _typing.List[typedexpr]


class TypedExpr(typedstmt, _ast.Expr):
    value: typedexpr


class TypedAssign(typedstmt, _ast.Assign):
    targets: _typing.List[typedexpr]
    value: typedexpr


class TypedClassDef(typedstmt, _ast.ClassDef):
    class_typ: "Type"


class TypedAnnAssign(typedstmt, _ast.AnnAssign):
    target: typedexpr
    annotation: "Type"
    value: typedexpr


class TypedWhile(typedstmt, _ast.While):
    test: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]


class TypedFor(typedstmt, _ast.For):
    target: typedexpr
    iter: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]


class TypedPass(typedstmt, _ast.Pass):
    pass


class TypedName(typedexpr, _ast.Name):
    pass


class Typedkeyword(TypedAST, _ast.keyword):
    arg: typedexpr
    value: typedexpr


class TypedConstant(TypedAST, _ast.Constant):
    pass


class TypedTuple(typedexpr, _ast.Tuple):
    pass


class TypedList(typedexpr, _ast.List):
    pass


class typedcomprehension(typedexpr, _ast.comprehension):
    target: typedexpr
    iter: typedexpr
    ifs: _typing.List[typedexpr]


class TypedListComp(typedexpr, _ast.ListComp):
    elt: typedexpr
    generators: _typing.List[typedcomprehension]


class TypedDictComp(typedexpr, _ast.DictComp):
    key: typedexpr
    value: typedexpr
    generators: _typing.List[typedcomprehension]


class TypedFormattedValue(typedexpr, _ast.FormattedValue):
    value: typedexpr
    conversion: int
    format_spec: _typing.Optional[_ast.JoinedStr]


class TypedJoinedStr(typedexpr, _ast.JoinedStr):
    values: _typing.List[typedexpr]


class TypedDict(typedexpr, _ast.Dict):
    pass


class TypedIfExp(typedstmt, _ast.IfExp):
    test: typedexpr
    body: typedexpr
    orelse: typedexpr


class TypedCompare(typedexpr, _ast.Compare):
    left: typedexpr
    ops: _typing.List[_ast.cmpop]
    comparators: _typing.List[typedexpr]


class TypedBinOp(typedexpr, _ast.BinOp):
    left: typedexpr
    right: typedexpr


class TypedBoolOp(typedexpr, _ast.BoolOp):
    values: _typing.List[typedexpr]


class TypedUnaryOp(typedexpr, _ast.UnaryOp):
    operand: typedexpr


class TypedSubscript(typedexpr, _ast.Subscript):
    value: typedexpr


class TypedAttribute(typedexpr, _ast.Attribute):
    value: typedexpr
    pos: int


class TypedAssert(typedstmt, _ast.Assert):
    test: typedexpr
    msg: typedexpr


class TypedSlice(typedexpr, _ast.Slice):
    lower: _typing.Optional[typedexpr]
    upper: _typing.Optional[typedexpr]
    step: _typing.Optional[typedexpr]


class RawPlutoExpr(typedexpr):
    typ: "Type"
    expr: _plt.AST

    _attributes = ["lineno", "col_offset", "end_lineno", "end_col_offset"]
    _fields = []

Classes

class RawPlutoExpr (*args, **kwargs)

expr = BoolOp(boolop op, expr values) | NamedExpr(expr target, expr value) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) | IfExp(expr test, expr body, expr orelse) | Dict(expr keys, expr values) | Set(expr elts) | ListComp(expr elt, comprehension generators) | SetComp(expr elt, comprehension generators) | DictComp(expr key, expr value, comprehension generators) | GeneratorExp(expr elt, comprehension generators) | Await(expr value) | Yield(expr? value) | YieldFrom(expr value) | Compare(expr left, cmpop ops, expr comparators) | Call(expr func, expr args, keyword keywords) | FormattedValue(expr value, int conversion, expr? format_spec) | JoinedStr(expr values) | Constant(constant value, string? kind) | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, expr slice, expr_context ctx) | Starred(expr value, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr elts, expr_context ctx) | Tuple(expr* elts, expr_context ctx) | Slice(expr? lower, expr? upper, expr? step)

Expand source code
class RawPlutoExpr(typedexpr):
    typ: "Type"
    expr: _plt.AST

    _attributes = ["lineno", "col_offset", "end_lineno", "end_col_offset"]
    _fields = []

Ancestors

Class variables

var expr : pluthon.pluthon_ast.AST
var typType

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedAST (*args, **kwargs)
Expand source code
class TypedAST(_ast.AST):
    typ: "Type"

Ancestors

  • ast.AST

Subclasses

Class variables

var typType
class TypedAnnAssign (*args, **kwargs)

AnnAssign(expr target, expr annotation, expr? value, int simple)

Expand source code
class TypedAnnAssign(typedstmt, _ast.AnnAssign):
    target: typedexpr
    annotation: "Type"
    value: typedexpr

Ancestors

Class variables

var annotationType
var targettypedexpr
var valuetypedexpr
class TypedAssert (*args, **kwargs)

Assert(expr test, expr? msg)

Expand source code
class TypedAssert(typedstmt, _ast.Assert):
    test: typedexpr
    msg: typedexpr

Ancestors

Class variables

var msgtypedexpr
var testtypedexpr
class TypedAssign (*args, **kwargs)

Assign(expr* targets, expr value, string? type_comment)

Expand source code
class TypedAssign(typedstmt, _ast.Assign):
    targets: _typing.List[typedexpr]
    value: typedexpr

Ancestors

Class variables

var targets : List[typedexpr]
var valuetypedexpr
class TypedAttribute (*args, **kwargs)

Attribute(expr value, identifier attr, expr_context ctx)

Expand source code
class TypedAttribute(typedexpr, _ast.Attribute):
    value: typedexpr
    pos: int

Ancestors

Class variables

var pos : int
var valuetypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedBinOp (*args, **kwargs)

BinOp(expr left, operator op, expr right)

Expand source code
class TypedBinOp(typedexpr, _ast.BinOp):
    left: typedexpr
    right: typedexpr

Ancestors

Class variables

var lefttypedexpr
var righttypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedBoolOp (*args, **kwargs)

BoolOp(boolop op, expr* values)

Expand source code
class TypedBoolOp(typedexpr, _ast.BoolOp):
    values: _typing.List[typedexpr]

Ancestors

Class variables

var values : List[typedexpr]

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedCall (*args, **kwargs)

Call(expr func, expr args, keyword keywords)

Expand source code
class TypedCall(typedexpr, _ast.Call):
    func: typedexpr
    args: _typing.List[typedexpr]

Ancestors

Class variables

var args : List[typedexpr]
var functypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedClassDef (*args, **kwargs)

ClassDef(identifier name, expr bases, keyword keywords, stmt body, expr decorator_list, type_param* type_params)

Expand source code
class TypedClassDef(typedstmt, _ast.ClassDef):
    class_typ: "Type"

Ancestors

Class variables

var class_typType
class TypedCompare (*args, **kwargs)

Compare(expr left, cmpop ops, expr comparators)

Expand source code
class TypedCompare(typedexpr, _ast.Compare):
    left: typedexpr
    ops: _typing.List[_ast.cmpop]
    comparators: _typing.List[typedexpr]

Ancestors

Class variables

var comparators : List[typedexpr]
var lefttypedexpr
var ops : List[ast.cmpop]

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedConstant (*args, **kwargs)

Constant(constant value, string? kind)

Expand source code
class TypedConstant(TypedAST, _ast.Constant):
    pass

Ancestors

  • TypedAST
  • ast.Constant
  • ast.expr
  • ast.AST
class TypedDict (*args, **kwargs)

Dict(expr keys, expr values)

Expand source code
class TypedDict(typedexpr, _ast.Dict):
    pass

Ancestors

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedDictComp (*args, **kwargs)

DictComp(expr key, expr value, comprehension* generators)

Expand source code
class TypedDictComp(typedexpr, _ast.DictComp):
    key: typedexpr
    value: typedexpr
    generators: _typing.List[typedcomprehension]

Ancestors

Class variables

var generators : List[typedcomprehension]
var keytypedexpr
var valuetypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedExpr (*args, **kwargs)

Expr(expr value)

Expand source code
class TypedExpr(typedstmt, _ast.Expr):
    value: typedexpr

Ancestors

Class variables

var valuetypedexpr
class TypedExpression (*args, **kwargs)

stmt = FunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | AsyncFunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | ClassDef(identifier name, expr bases, keyword keywords, stmt body, expr decorator_list, type_param type_params) | Return(expr? value) | Delete(expr targets) | Assign(expr targets, expr value, string? type_comment) | TypeAlias(expr name, type_param type_params, expr value) | AugAssign(expr target, operator op, expr value) | AnnAssign(expr target, expr annotation, expr? value, int simple) | For(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | AsyncFor(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | While(expr test, stmt body, stmt orelse) | If(expr test, stmt body, stmt orelse) | With(withitem items, stmt body, string? type_comment) | AsyncWith(withitem items, stmt body, string? type_comment) | Match(expr subject, match_case cases) | Raise(expr? exc, expr? cause) | Try(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | TryStar(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | Assert(expr test, expr? msg) | Import(alias names) | ImportFrom(identifier? module, alias names, int? level) | Global(identifier names) | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue

Expand source code
class TypedExpression(typedstmt, _ast.Expression):
    body: typedexpr

Ancestors

Class variables

var bodytypedexpr
class TypedFor (*args, **kwargs)

For(expr target, expr iter, stmt body, stmt orelse, string? type_comment)

Expand source code
class TypedFor(typedstmt, _ast.For):
    target: typedexpr
    iter: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]

Ancestors

Class variables

var body : List[typedstmt]
var itertypedexpr
var orelse : List[typedstmt]
var targettypedexpr
class TypedFormattedValue (*args, **kwargs)

FormattedValue(expr value, int conversion, expr? format_spec)

Expand source code
class TypedFormattedValue(typedexpr, _ast.FormattedValue):
    value: typedexpr
    conversion: int
    format_spec: _typing.Optional[_ast.JoinedStr]

Ancestors

Class variables

var conversion : int
var format_spec : ast.JoinedStr | None
var valuetypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedFunctionDef (*args, **kwargs)

FunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param* type_params)

Expand source code
class TypedFunctionDef(typedstmt, _ast.FunctionDef):
    body: _typing.List[typedstmt]
    args: typedarguments
    orig_name: str

Ancestors

Class variables

var argstypedarguments
var body : List[typedstmt]
var orig_name : str
class TypedIf (*args, **kwargs)

If(expr test, stmt body, stmt orelse)

Expand source code
class TypedIf(typedstmt, _ast.If):
    test: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]

Ancestors

Class variables

var body : List[typedstmt]
var orelse : List[typedstmt]
var testtypedexpr
class TypedIfExp (*args, **kwargs)

stmt = FunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | AsyncFunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | ClassDef(identifier name, expr bases, keyword keywords, stmt body, expr decorator_list, type_param type_params) | Return(expr? value) | Delete(expr targets) | Assign(expr targets, expr value, string? type_comment) | TypeAlias(expr name, type_param type_params, expr value) | AugAssign(expr target, operator op, expr value) | AnnAssign(expr target, expr annotation, expr? value, int simple) | For(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | AsyncFor(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | While(expr test, stmt body, stmt orelse) | If(expr test, stmt body, stmt orelse) | With(withitem items, stmt body, string? type_comment) | AsyncWith(withitem items, stmt body, string? type_comment) | Match(expr subject, match_case cases) | Raise(expr? exc, expr? cause) | Try(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | TryStar(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | Assert(expr test, expr? msg) | Import(alias names) | ImportFrom(identifier? module, alias names, int? level) | Global(identifier names) | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue

Expand source code
class TypedIfExp(typedstmt, _ast.IfExp):
    test: typedexpr
    body: typedexpr
    orelse: typedexpr

Ancestors

Class variables

var bodytypedexpr
var orelsetypedexpr
var testtypedexpr
class TypedJoinedStr (*args, **kwargs)

JoinedStr(expr* values)

Expand source code
class TypedJoinedStr(typedexpr, _ast.JoinedStr):
    values: _typing.List[typedexpr]

Ancestors

Class variables

var values : List[typedexpr]

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedList (*args, **kwargs)

List(expr* elts, expr_context ctx)

Expand source code
class TypedList(typedexpr, _ast.List):
    pass

Ancestors

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedListComp (*args, **kwargs)

ListComp(expr elt, comprehension* generators)

Expand source code
class TypedListComp(typedexpr, _ast.ListComp):
    elt: typedexpr
    generators: _typing.List[typedcomprehension]

Ancestors

Class variables

var elttypedexpr
var generators : List[typedcomprehension]

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedModule (*args, **kwargs)

stmt = FunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | AsyncFunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | ClassDef(identifier name, expr bases, keyword keywords, stmt body, expr decorator_list, type_param type_params) | Return(expr? value) | Delete(expr targets) | Assign(expr targets, expr value, string? type_comment) | TypeAlias(expr name, type_param type_params, expr value) | AugAssign(expr target, operator op, expr value) | AnnAssign(expr target, expr annotation, expr? value, int simple) | For(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | AsyncFor(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | While(expr test, stmt body, stmt orelse) | If(expr test, stmt body, stmt orelse) | With(withitem items, stmt body, string? type_comment) | AsyncWith(withitem items, stmt body, string? type_comment) | Match(expr subject, match_case cases) | Raise(expr? exc, expr? cause) | Try(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | TryStar(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | Assert(expr test, expr? msg) | Import(alias names) | ImportFrom(identifier? module, alias names, int? level) | Global(identifier names) | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue

Expand source code
class TypedModule(typedstmt, _ast.Module):
    body: _typing.List[typedstmt]

Ancestors

Class variables

var body : List[typedstmt]
class TypedName (*args, **kwargs)

Name(identifier id, expr_context ctx)

Expand source code
class TypedName(typedexpr, _ast.Name):
    pass

Ancestors

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedPass (*args, **kwargs)

Pass

Expand source code
class TypedPass(typedstmt, _ast.Pass):
    pass

Ancestors

class TypedReturn (*args, **kwargs)

Return(expr? value)

Expand source code
class TypedReturn(typedstmt, _ast.Return):
    value: typedexpr

Ancestors

Class variables

var valuetypedexpr
class TypedSlice (*args, **kwargs)

Slice(expr? lower, expr? upper, expr? step)

Expand source code
class TypedSlice(typedexpr, _ast.Slice):
    lower: _typing.Optional[typedexpr]
    upper: _typing.Optional[typedexpr]
    step: _typing.Optional[typedexpr]

Ancestors

Class variables

var lowertypedexpr | None
var steptypedexpr | None
var uppertypedexpr | None

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedSubscript (*args, **kwargs)

Subscript(expr value, expr slice, expr_context ctx)

Expand source code
class TypedSubscript(typedexpr, _ast.Subscript):
    value: typedexpr

Ancestors

Class variables

var valuetypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedTuple (*args, **kwargs)

Tuple(expr* elts, expr_context ctx)

Expand source code
class TypedTuple(typedexpr, _ast.Tuple):
    pass

Ancestors

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedUnaryOp (*args, **kwargs)

UnaryOp(unaryop op, expr operand)

Expand source code
class TypedUnaryOp(typedexpr, _ast.UnaryOp):
    operand: typedexpr

Ancestors

Class variables

var operandtypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class TypedWhile (*args, **kwargs)

While(expr test, stmt body, stmt orelse)

Expand source code
class TypedWhile(typedstmt, _ast.While):
    test: typedexpr
    body: _typing.List[typedstmt]
    orelse: _typing.List[typedstmt]

Ancestors

Class variables

var body : List[typedstmt]
var orelse : List[typedstmt]
var testtypedexpr
class Typedkeyword (*args, **kwargs)

keyword(identifier? arg, expr value)

Expand source code
class Typedkeyword(TypedAST, _ast.keyword):
    arg: typedexpr
    value: typedexpr

Ancestors

Class variables

var argtypedexpr
var valuetypedexpr
class typedarg (*args, **kwargs)

arg(identifier arg, expr? annotation, string? type_comment)

Expand source code
class typedarg(TypedAST, _ast.arg):
    pass

Ancestors

class typedarguments (*args, **kwargs)

arguments(arg posonlyargs, arg args, arg? vararg, arg kwonlyargs, expr kw_defaults, arg? kwarg, expr* defaults)

Expand source code
class typedarguments(TypedAST, _ast.arguments):
    args: _typing.List[typedarg]
    vararg: _typing.Union[typedarg, None]
    kwonlyargs: _typing.List[typedarg]
    kw_defaults: _typing.List[_typing.Union[typedexpr, None]]
    kwarg: _typing.Union[typedarg, None]
    defaults: _typing.List[typedexpr]

Ancestors

Class variables

var args : List[typedarg]
var defaults : List[typedexpr]
var kw_defaults : List[typedexpr | None]
var kwargtypedarg | None
var kwonlyargs : List[typedarg]
var varargtypedarg | None
class typedcomprehension (*args, **kwargs)

expr = BoolOp(boolop op, expr values) | NamedExpr(expr target, expr value) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) | IfExp(expr test, expr body, expr orelse) | Dict(expr keys, expr values) | Set(expr elts) | ListComp(expr elt, comprehension generators) | SetComp(expr elt, comprehension generators) | DictComp(expr key, expr value, comprehension generators) | GeneratorExp(expr elt, comprehension generators) | Await(expr value) | Yield(expr? value) | YieldFrom(expr value) | Compare(expr left, cmpop ops, expr comparators) | Call(expr func, expr args, keyword keywords) | FormattedValue(expr value, int conversion, expr? format_spec) | JoinedStr(expr values) | Constant(constant value, string? kind) | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, expr slice, expr_context ctx) | Starred(expr value, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr elts, expr_context ctx) | Tuple(expr* elts, expr_context ctx) | Slice(expr? lower, expr? upper, expr? step)

Expand source code
class typedcomprehension(typedexpr, _ast.comprehension):
    target: typedexpr
    iter: typedexpr
    ifs: _typing.List[typedexpr]

Ancestors

Class variables

var ifs : List[typedexpr]
var itertypedexpr
var targettypedexpr

Methods

def typechecks(self) ‑> Dict[str, Type]

Inherited from: typedexpr.typechecks

Successful typechecks if this expression evaluates to True

class typedexpr (*args, **kwargs)

expr = BoolOp(boolop op, expr values) | NamedExpr(expr target, expr value) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) | IfExp(expr test, expr body, expr orelse) | Dict(expr keys, expr values) | Set(expr elts) | ListComp(expr elt, comprehension generators) | SetComp(expr elt, comprehension generators) | DictComp(expr key, expr value, comprehension generators) | GeneratorExp(expr elt, comprehension generators) | Await(expr value) | Yield(expr? value) | YieldFrom(expr value) | Compare(expr left, cmpop ops, expr comparators) | Call(expr func, expr args, keyword keywords) | FormattedValue(expr value, int conversion, expr? format_spec) | JoinedStr(expr values) | Constant(constant value, string? kind) | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, expr slice, expr_context ctx) | Starred(expr value, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr elts, expr_context ctx) | Tuple(expr* elts, expr_context ctx) | Slice(expr? lower, expr? upper, expr? step)

Expand source code
class typedexpr(TypedAST, _ast.expr):
    def typechecks(self) -> _typing.Dict[str, "Type"]:
        """Successful typechecks if this expression evaluates to True"""
        return {}

Ancestors

Subclasses

Methods

def typechecks(self) ‑> Dict[str, Type]

Successful typechecks if this expression evaluates to True

Expand source code
def typechecks(self) -> _typing.Dict[str, "Type"]:
    """Successful typechecks if this expression evaluates to True"""
    return {}
class typedstmt (*args, **kwargs)

stmt = FunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | AsyncFunctionDef(identifier name, arguments args, stmt body, expr decorator_list, expr? returns, string? type_comment, type_param type_params) | ClassDef(identifier name, expr bases, keyword keywords, stmt body, expr decorator_list, type_param type_params) | Return(expr? value) | Delete(expr targets) | Assign(expr targets, expr value, string? type_comment) | TypeAlias(expr name, type_param type_params, expr value) | AugAssign(expr target, operator op, expr value) | AnnAssign(expr target, expr annotation, expr? value, int simple) | For(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | AsyncFor(expr target, expr iter, stmt body, stmt orelse, string? type_comment) | While(expr test, stmt body, stmt orelse) | If(expr test, stmt body, stmt orelse) | With(withitem items, stmt body, string? type_comment) | AsyncWith(withitem items, stmt body, string? type_comment) | Match(expr subject, match_case cases) | Raise(expr? exc, expr? cause) | Try(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | TryStar(stmt body, excepthandler handlers, stmt orelse, stmt finalbody) | Assert(expr test, expr? msg) | Import(alias names) | ImportFrom(identifier? module, alias names, int? level) | Global(identifier names) | Nonlocal(identifier* names) | Expr(expr value) | Pass | Break | Continue

Expand source code
class typedstmt(TypedAST, _ast.stmt):
    # Statements always have type None
    typ = NoneInstanceType

Ancestors

Subclasses

Class variables

var typType