package pyast

  1. Overview
  2. Docs
type withitem = unit
and unaryop =
  1. | Invert
  2. | Not
  3. | UAdd
  4. | USub
and type_ignore = unit
and stmt = {
  1. desc : stmt_desc;
  2. lineno : int;
  3. col_offset : int;
}
and stmt_desc =
  1. | FunctionDef of {
    1. name : string;
    2. args : arguments;
    3. body : stmt list;
    4. decorators : expr list;
    }
  2. | ClassDef of {
    1. name : string;
    2. bases : expr list;
    3. body : stmt list;
    }
  3. | Return of expr option
  4. | Delete of expr list
  5. | Assign of {
    1. targets : expr list;
    2. value : expr;
    }
  6. | AugAssign of {
    1. target : expr;
    2. op : operator;
    3. value : expr;
    }
  7. | Print of {
    1. dest : expr option;
    2. values : expr list;
    3. nl : bool;
    }
  8. | For of {
    1. target : expr;
    2. iter : expr;
    3. body : stmt list;
    4. orelse : stmt list;
    }
  9. | While of {
    1. test : expr;
    2. body : stmt list;
    3. orelse : stmt list;
    }
  10. | If of {
    1. test : expr;
    2. body : stmt list;
    3. orelse : stmt list;
    }
  11. | With of {
    1. context_expr : expr;
    2. optional_vars : expr option;
    3. body : stmt list;
    }
  12. | Raise of {
    1. type_ : expr option;
    2. inst : expr option;
    3. tback : expr option;
    }
  13. | TryExcept of {
    1. body : stmt list;
    2. handlers : excepthandler list;
    3. orelse : stmt list;
    }
  14. | TryFinally of {
    1. body : stmt list;
    2. finalbody : stmt list;
    }
  15. | Assert of {
    1. test : expr;
    2. msg : expr option;
    }
  16. | Import of alias list
  17. | ImportFrom of {
    1. module_ : string;
    2. names : alias list;
    3. level : int option;
    }
  18. | Exec of {
    1. body : expr;
    2. globals : expr option;
    3. locals : expr option;
    }
  19. | Global of string list
  20. | Expr of expr
  21. | Pass
  22. | Break
  23. | Continue
and slice =
  1. | Ellipsis
  2. | Slice of {
    1. lower : expr option;
    2. upper : expr option;
    3. step : expr option;
    }
  3. | ExtSlice of slice list
  4. | Index of expr
and pattern = unit
and operator =
  1. | Add
  2. | Sub
  3. | Mult
  4. | Div
  5. | Mod
  6. | Pow
  7. | LShift
  8. | RShift
  9. | BitOr
  10. | BitXor
  11. | BitAnd
  12. | FloorDiv
and mod_ =
  1. | Module of stmt list
  2. | Interactive of stmt list
  3. | Expression of expr
  4. | Suite of stmt list
and match_case = unit
and keyword = {
  1. arg : string;
  2. value : expr;
}
and expr_context =
  1. | Load
  2. | Store
  3. | Del
  4. | AugLoad
  5. | AugStore
  6. | Param
and expr = {
  1. desc : expr_desc;
  2. lineno : int;
  3. col_offset : int;
}
and expr_desc =
  1. | BoolOp of {
    1. op : boolop;
    2. values : expr list;
    }
  2. | BinOp of {
    1. left : expr;
    2. op : operator;
    3. right : expr;
    }
  3. | UnaryOp of {
    1. op : unaryop;
    2. operand : expr;
    }
  4. | Lambda of {
    1. args : arguments;
    2. body : expr;
    }
  5. | IfExp of {
    1. test : expr;
    2. body : expr;
    3. orelse : expr;
    }
  6. | Dict of {
    1. keys : expr list;
    2. values : expr list;
    }
  7. | ListComp of {
    1. elt : expr;
    2. generators : comprehension list;
    }
  8. | GeneratorExp of {
    1. elt : expr;
    2. generators : comprehension list;
    }
  9. | Yield of expr option
  10. | Compare of {
    1. left : expr;
    2. ops : cmpop list;
    3. comparators : expr list;
    }
  11. | Call of {
    1. func : expr;
    2. args : expr list;
    3. keywords : keyword list;
    4. starargs : expr option;
    5. kwargs : expr option;
    }
  12. | Repr of expr
  13. | Num of object_
  14. | Str of string
  15. | Attribute of {
    1. value : expr;
    2. attr : string;
    3. ctx : expr_context;
    }
  16. | Subscript of {
    1. value : expr;
    2. slice : slice;
    3. ctx : expr_context;
    }
  17. | Name of {
    1. id : string;
    2. ctx : expr_context;
    }
  18. | List of {
    1. elts : expr list;
    2. ctx : expr_context;
    }
  19. | Tuple of {
    1. elts : expr list;
    2. ctx : expr_context;
    }
and excepthandler = {
  1. type_ : expr option;
  2. name : expr option;
  3. body : stmt list;
  4. lineno : int;
  5. col_offset : int;
}
and comprehension = {
  1. target : expr;
  2. iter : expr;
  3. ifs : expr list;
}
and cmpop =
  1. | Eq
  2. | NotEq
  3. | Lt
  4. | LtE
  5. | Gt
  6. | GtE
  7. | Is
  8. | IsNot
  9. | In
  10. | NotIn
and boolop =
  1. | And
  2. | Or
and arguments = {
  1. args : expr list;
  2. vararg : string option;
  3. kwarg : string option;
  4. defaults : expr list;
}
and arg = string
and alias = {
  1. name : string;
  2. asname : string option;
}
type arguments_args =
  1. | Expr_list of expr list
  2. | Arg_list of arg list
type arguments_kwarg =
  1. | Identifier_opt of string option
  2. | Arg_opt of arg option
type arguments_vararg =
  1. | Identifier_opt of string option
  2. | Arg_opt of arg option
type excepthandler_excepthandler_name =
  1. | Identifier_opt of string option
  2. | Expr_opt of expr option
type expr_bytes_s =
  1. | String of string
  2. | Bytes of string
type expr_formattedvalue_conversion =
  1. | Int_opt of int option
  2. | Int of int
type expr_subscript_slice =
  1. | Slice of slice
  2. | Expr of expr
type expr_yieldfrom_value =
  1. | Expr_opt of expr option
  2. | Expr of expr
type keyword_arg =
  1. | Identifier_opt of string option
  2. | Identifier of string
type stmt_importfrom_module =
  1. | Identifier_opt of string option
  2. | Identifier of string
val withitem : ?optional_vars:'a -> ?context_expr:'b -> unit -> withitem
val unaryop_usub : unit -> unaryop
val unaryop_uadd : unit -> unaryop
val unaryop_not : unit -> unaryop
val unaryop_invert : unit -> unaryop
val type_ignore_typeignore : ?tag:'a -> ?lineno:'b -> unit -> type_ignore
val stmt_with : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?type_comment:'c -> ?optional_vars:expr option -> ?items:'d -> ?context_expr:expr -> ?body:stmt list -> unit -> stmt
val stmt_while : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?test:expr -> ?orelse:stmt list -> ?body:stmt list -> unit -> stmt
val stmt_trystar : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?orelse:'e -> ?handlers:'f -> ?finalbody:'g -> ?body:'h -> unit -> stmt
val stmt_tryfinally : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?finalbody:stmt list -> ?body:stmt list -> unit -> stmt
val stmt_tryexcept : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?orelse:stmt list -> ?handlers:excepthandler list -> ?body:stmt list -> unit -> stmt
val stmt_try : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?orelse:stmt list -> ?handlers:excepthandler list -> ?finalbody:stmt list -> ?body:stmt list -> unit -> stmt
val stmt_return : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr option -> unit -> stmt
val stmt_raise : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?type_:expr option -> ?tback:expr option -> ?inst:expr option -> ?exc:'c -> ?cause:'d -> unit -> stmt
val stmt_print : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?values:expr list -> ?nl:bool -> ?dest:expr option -> unit -> stmt
val stmt_pass : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> unit -> stmt
val stmt_nonlocal : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?names:'e -> unit -> stmt
val stmt_match : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?subject:'e -> ?cases:'f -> unit -> stmt
val stmt_importfrom : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?names:alias list -> ?module_:stmt_importfrom_module -> ?level:int option -> unit -> stmt
val stmt_import : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?names:alias list -> unit -> stmt
val stmt_if : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?test:expr -> ?orelse:stmt list -> ?body:stmt list -> unit -> stmt
val stmt_global : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?names:string list -> unit -> stmt
val stmt_functiondef : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?type_comment:'c -> ?returns:'d -> ?name:string -> ?decorators:expr list -> ?decorator_list:'e -> ?body:stmt list -> ?args:arguments -> unit -> stmt
val stmt_for : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?type_comment:'c -> ?target:expr -> ?orelse:stmt list -> ?iter:expr -> ?body:stmt list -> unit -> stmt
val stmt_expr : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> unit -> stmt
val stmt_exec : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?locals:expr option -> ?globals:expr option -> ?body:expr -> unit -> stmt
val stmt_delete : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?targets:expr list -> unit -> stmt
val stmt_continue : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> unit -> stmt
val stmt_classdef : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?starargs:'c -> ?name:string -> ?kwargs:'d -> ?keywords:'e -> ?decorator_list:'f -> ?body:stmt list -> ?bases:expr list -> unit -> stmt
val stmt_break : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> unit -> stmt
val stmt_augassign : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> ?target:expr -> ?op:operator -> unit -> stmt
val stmt_asyncwith : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_comment:'e -> ?items:'f -> ?body:'g -> unit -> stmt
val stmt_asyncfunctiondef : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_comment:'e -> ?returns:'f -> ?name:'g -> ?decorator_list:'h -> ?body:'i -> ?args:'j -> unit -> stmt
val stmt_asyncfor : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_comment:'e -> ?target:'f -> ?orelse:'g -> ?iter:'h -> ?body:'i -> unit -> stmt
val stmt_assign : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> ?type_comment:'c -> ?targets:expr list -> unit -> stmt
val stmt_assert : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?test:expr -> ?msg:expr option -> unit -> stmt
val stmt_annassign : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> ?target:'f -> ?simple:'g -> ?annotation:'h -> unit -> stmt
val slice_slice : ?upper:expr option -> ?step:expr option -> ?lower:expr option -> unit -> slice
val slice_index : ?value:expr -> unit -> slice
val slice_extslice : ?dims:slice list -> unit -> slice
val slice_ellipsis : unit -> slice
val pattern_matchvalue : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> unit -> pattern
val pattern_matchstar : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?name:'e -> unit -> pattern
val pattern_matchsingleton : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> unit -> pattern
val pattern_matchsequence : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?patterns:'e -> unit -> pattern
val pattern_matchor : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?patterns:'e -> unit -> pattern
val pattern_matchmapping : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?rest:'e -> ?patterns:'f -> ?keys:'g -> unit -> pattern
val pattern_matchclass : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?patterns:'e -> ?kwd_patterns:'f -> ?kwd_attrs:'g -> ?cls:'h -> unit -> pattern
val pattern_matchas : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?pattern:'e -> ?name:'f -> unit -> pattern
val operator_sub : unit -> operator
val operator_rshift : unit -> operator
val operator_pow : unit -> operator
val operator_mult : unit -> operator
val operator_mod : unit -> operator
val operator_matmult : unit -> operator
val operator_lshift : unit -> operator
val operator_floordiv : unit -> operator
val operator_div : unit -> operator
val operator_bitxor : unit -> operator
val operator_bitor : unit -> operator
val operator_bitand : unit -> operator
val operator_add : unit -> operator
val mod_suite : ?body:stmt list -> unit -> mod_
val mod_module : ?type_ignores:'a -> ?body:stmt list -> unit -> mod_
val mod_interactive : ?body:stmt list -> unit -> mod_
val mod_functiontype : ?returns:'a -> ?argtypes:'b -> unit -> mod_
val mod_expression : ?body:expr -> unit -> mod_
val match_case : ?pattern:'a -> ?guard:'b -> ?body:'c -> unit -> match_case
val keyword : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:expr -> ?arg:keyword_arg -> unit -> keyword
val expr_context_store : unit -> expr_context
val expr_context_param : unit -> expr_context
val expr_context_load : unit -> expr_context
val expr_context_del : unit -> expr_context
val expr_context_augstore : unit -> expr_context
val expr_context_augload : unit -> expr_context
val expr_yieldfrom : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> unit -> expr
val expr_yield : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr option -> unit -> expr
val expr_unaryop : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?operand:expr -> ?op:unaryop -> unit -> expr
val expr_tuple : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?elts:expr list -> ?ctx:expr_context -> unit -> expr
val expr_subscript : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> ?slice:expr_subscript_slice -> ?ctx:expr_context -> unit -> expr
val expr_str : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?s:string -> unit -> expr
val expr_starred : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> ?ctx:'f -> unit -> expr
val expr_slice : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?upper:expr option -> ?step:expr option -> ?lower:expr option -> unit -> expr
val expr_setcomp : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?generators:'e -> ?elt:'f -> unit -> expr
val expr_set : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?elts:'e -> unit -> expr
val expr_repr : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> unit -> expr
val expr_num : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?n:object_ -> unit -> expr
val expr_namedexpr : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> ?target:'f -> unit -> expr
val expr_nameconstant : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:bool option -> unit -> expr
val expr_name : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?id:string -> ?ctx:expr_context -> unit -> expr
val expr_listcomp : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?generators:comprehension list -> ?elt:expr -> unit -> expr
val expr_list : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?elts:expr list -> ?ctx:expr_context -> unit -> expr
val expr_lambda : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?body:expr -> ?args:arguments -> unit -> expr
val expr_joinedstr : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?values:'e -> unit -> expr
val expr_ifexp : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?test:expr -> ?orelse:expr -> ?body:expr -> unit -> expr
val expr_generatorexp : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?generators:comprehension list -> ?elt:expr -> unit -> expr
val expr_formattedvalue : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> ?format_spec:'f -> ?conversion:'g -> unit -> expr
val expr_ellipsis : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> unit -> expr
val expr_dictcomp : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> ?key:'f -> ?generators:'g -> unit -> expr
val expr_dict : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?values:expr list -> ?keys:expr list -> unit -> expr
val expr_constant : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:constant -> ?kind:'e -> unit -> expr
val expr_compare : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?ops:cmpop list -> ?left:expr -> ?comparators:expr list -> unit -> expr
val expr_call : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?starargs:expr option -> ?kwargs:expr option -> ?keywords:keyword list -> ?func:expr -> ?args:expr list -> unit -> expr
val expr_bytes : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?s:'e -> unit -> expr
val expr_boolop : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?values:expr list -> ?op:boolop -> unit -> expr
val expr_binop : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?right:expr -> ?op:operator -> ?left:expr -> unit -> expr
val expr_await : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?value:'e -> unit -> expr
val expr_attribute : ?lineno:int -> ?end_lineno:'a -> ?end_col_offset:'b -> ?col_offset:int -> ?value:expr -> ?ctx:expr_context -> ?attr:string -> unit -> expr
val excepthandler_excepthandler : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_:expr option -> ?name:excepthandler_excepthandler_name -> ?body:stmt list -> unit -> excepthandler
val excepthandler : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_:expr option -> ?name:expr option -> ?lineno:int -> ?col_offset:int -> ?body:stmt list -> unit -> excepthandler
val comprehension : ?target:expr -> ?iter:expr -> ?is_async:'a -> ?ifs:expr list -> unit -> comprehension
val cmpop_notin : unit -> cmpop
val cmpop_noteq : unit -> cmpop
val cmpop_lte : unit -> cmpop
val cmpop_lt : unit -> cmpop
val cmpop_isnot : unit -> cmpop
val cmpop_is : unit -> cmpop
val cmpop_in : unit -> cmpop
val cmpop_gte : unit -> cmpop
val cmpop_gt : unit -> cmpop
val cmpop_eq : unit -> cmpop
val boolop_or : unit -> boolop
val boolop_and : unit -> boolop
val arguments : ?varargannotation:'a -> ?vararg:arguments_vararg -> ?posonlyargs:'b -> ?kwonlyargs:'c -> ?kwargannotation:'d -> ?kwarg:arguments_kwarg -> ?kw_defaults:'e -> ?defaults:expr list -> ?args:arguments_args -> unit -> arguments
val arg : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?type_comment:'e -> ?arg:arg -> ?annotation:'f -> unit -> arg
val alias : ?lineno:'a -> ?end_lineno:'b -> ?end_col_offset:'c -> ?col_offset:'d -> ?name:string -> ?asname:string option -> unit -> alias