Module Expr Str Assign NameStore SubscriptLoad Str Slice Num Num Assign NameStore Str Assign NameStore Str Assign NameStore ListLoad Str Str Str Str Import alias alias alias alias alias TryExcept body Import alias FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list handlers ExceptHandler type NameLoad name NameStore body TryExcept body Import alias FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad NameLoad decorator_list handlers ExceptHandler type NameLoad name NameStore body FunctionDef arguments args NameParam NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore NameLoad TryFinally body Assign NameStore Call NameLoad NameLoad Str Expr Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad finalbody If NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body FunctionDef arguments args NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Return Str If Call NameLoad NameLoad NameLoad body Return NameLoad If Call NameLoad NameLoad NameLoad body Return NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body If CompareIs NameLoad NameLoad body Return Str If Call NameLoad NameLoad NameLoad body Return NameLoad If Call NameLoad NameLoad NameLoad body Return Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Str SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str ListLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index Str Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str If NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad If NameLoad body Assign SubscriptStore SubscriptLoad NameLoad Index Str Index NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Call AttributeLoad NameLoad attr Num NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults BinOpMod Str Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults BinOpMod Str Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults BinOpMod Str Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults BinOpMod Str Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str NameLoad Return NameLoad decorator_list Assign NameStore Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad Str Str Str Str Str Str Str Str Str Str Return NameLoad decorator_list Assign NameStore Call NameLoad Delete NameDel Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Dict Str Str Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Call AttributeLoad NameLoad attr Num FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If UnaryOpNot NameLoad body Return Str If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad orelse Assign NameStore Call NameLoad NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad Return BinOpMod Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BoolOpOr BoolOpAnd NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BoolOpOr BoolOpAnd NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return BoolOpOr BoolOpAnd NameLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot NameLoad body Return Str Return Call AttributeLoad NameLoad attr Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot NameLoad body Return Str Return Call NameLoad Call AttributeLoad Call NameLoad NameLoad attr Str Str decorator_list Assign NameStore Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr Call NameLoad Delete NameDel Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Str Assign NameStore Str Assign NameStore Num Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign AttributeStore NameLoad attr Str If CompareIs NameLoad NameLoad body Assign AttributeStore NameLoad attr Str If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareNotEq NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str If CompareLt NameLoad Num body Assign AttributeStore NameLoad attr Str orelse If BoolOpAnd CompareGtE Call NameLoad NameLoad Num CompareEq SubscriptLoad NameLoad Index BinOpSub NameLoad Num Str body Assign AttributeStore NameLoad attr Str orelse Assign AttributeStore NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BoolOpOr BoolOpAnd Call AttributeLoad AttributeLoad NameLoad attr attr Str Str Str decorator_list FunctionDef arguments args NameParam NameParam defaults body If AttributeLoad NameLoad attr body If UnaryOpNot Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpAdd AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad Call NameLoad NameLoad Str attr Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If BoolOpAnd AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr BinOpMod Str NameLoad AttributeLoad NameLoad attr decorator_list Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad NameLoad FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If UnaryOpNot NameLoad body Return Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore NameLoad Assign NameStore Num For NameStore Call AttributeLoad NameLoad attr NameLoad body Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Slice NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore NameLoad If CompareEq NameLoad Str body If NameLoad body Assign NameStore Str orelse If CompareEq SubscriptLoad NameLoad Index Num Str body Assign NameStore Str orelse Assign NameStore Call AttributeLoad NameLoad attr Str If CompareLt NameLoad Num body If BoolOpAnd NameLoad Call AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore Str orelse Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num If Call AttributeLoad NameLoad attr body Assign NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore CompareIsNot NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Str body Expr Call AttributeLoad NameLoad attr BoolOpOr BoolOpAnd CompareEq NameLoad Str Str Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str Assign NameStore SubscriptLoad NameLoad Slice NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareIs AttributeLoad NameLoad attr NameLoad body Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body Assign NameStore Call AttributeLoad BoolOpOr Call AttributeLoad NameLoad attr Num Str attr Str Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Continue If UnaryOpNot Call AttributeLoad NameLoad attr Str NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return TupleLoad Call AttributeLoad NameLoad attr Num CompareEq Call AttributeLoad NameLoad attr Num Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body If UnaryOpNot NameLoad body Return If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore Num For NameStore Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Slice NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If NameLoad body Assign NameStore BoolOpOr Call AttributeLoad NameLoad attr NameLoad BoolOpAnd UnaryOpNot NameLoad BoolOpOr CompareGt NameLoad Num NameLoad If BoolOpAnd NameLoad UnaryOpNot NameLoad CompareEq SubscriptLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad NameLoad body AugAssignAdd NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str If NameLoad body If BoolOpAnd NameLoad CompareEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Slice NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Str decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body If UnaryOpNot NameLoad body Return If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad If BoolOpOr UnaryOpNot NameLoad CompareNotEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str orelse If BoolOpAnd CompareGtE Call NameLoad NameLoad Num CompareEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Num Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Num Expr Call AttributeLoad NameLoad attr Str decorator_list Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body If BoolOpOr UnaryOpNot NameLoad Call AttributeLoad NameLoad attr body Return If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str orelse If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr Str NameLoad Str orelse Expr Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Str NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body If NameLoad body If CompareEq NameLoad Str body Assign NameStore BinOpAdd NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore BinOpAdd BinOpAdd NameLoad Str NameLoad Assign NameStore BinOpAdd Call AttributeLoad Call AttributeLoad NameLoad attr attr Str Num Assign NameStore Num Assign NameStore Call NameLoad NameLoad Assign NameStore NameLoad While CompareLt NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareEq NameLoad Str body AugAssignAdd NameStore Num orelse If CompareEq NameLoad Str body AugAssignAdd NameStore Num orelse Break AugAssignAdd NameStore Num If NameLoad body If CompareEq SubscriptLoad Call AttributeLoad NameLoad attr Index Num Str body AugAssignAdd NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BinOpMult Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore NameStore Dict orelse If CompareIs AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr orelse Assign NameStore Dict If Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad Call AttributeLoad NameLoad attr Str attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore NameLoad If CompareIs NameLoad NameLoad body Assign NameStore ListLoad Assign SubscriptStore NameLoad Index Str NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Exec AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr BoolOpOr AttributeLoad NameLoad attr Str Str decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body If BoolOpOr UnaryOpNot NameLoad Call AttributeLoad NameLoad attr body Return Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad kwarg body Expr Str If NameLoad body Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Dict decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq SubscriptLoad NameLoad Index Num Str body Return BinOpAdd BinOpAdd AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body Assign NameStore BinOpAdd BinOpAdd NameLoad AttributeLoad AttributeLoad NameLoad attr attr NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return NameLoad orelse If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return NameLoad Raise Call NameLoad BinOpMod Str TupleLoad NameLoad Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If UnaryOpNot Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call NameLoad NameLoad attr If Call AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore SubscriptLoad NameLoad Slice Call NameLoad Str NameLoad Assign AttributeStore NameLoad attr BoolOpOr BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str ListLoad Assign NameStore SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num orelse Assign AttributeStore NameLoad attr NameLoad If AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Dict Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr If BoolOpAnd AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpMod Str TupleLoad Call AttributeLoad Str attr AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Str Str BinOpAdd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse If BoolOpAnd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad CompareGtE Call NameLoad NameLoad Call NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Return Call AttributeLoad Call NameLoad NameLoad attr If CompareIs NameLoad NameLoad body Assign NameStore Dict If UnaryOpNot Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore NameLoad If BoolOpOr CompareIs NameLoad NameLoad BoolOpAnd AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareLt AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assert Call AttributeLoad NameLoad attr Str Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str orelse Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Dict If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr Num attr Expr Call AttributeLoad NameLoad attr NameLoad While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If BoolOpOr CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Break Assign NameStore NameLoad Assign NameStore NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Very fast and light-weight template engine based embedded Python.

   pyTenjin is similar to PHP or eRuby (embedded Ruby).
   * '<?py ... ?>' represents python statement.
   * '#{...}' represents python expression.
   * '${...}' represents python expression with escaping.

   And it provides the following features.
   * Layout template and nested template
   * Including other template files
   * Template caching
   * Capturing

   See help of tenjin.Template and tenjin.Engine for details.
 N/A __revision__ N/A $Rev: 137 $ N/A 6 -2 N/A __release__ 0.6.2 N/A __license__ MIT License N/A __all__ N/A Template Engine helpers html N/A re sys os time marshal N/A N/A N/A fcntl _lock_file N/A N/A file content N/A N/A N/A N/A N/A fcntl flock N/A N/A file fileno N/A fcntl LOCK_EX N/A N/A N/A N/A ImportError N/A ex N/A N/A N/A N/A msvcrt _lock_file N/A N/A file content N/A N/A N/A N/A N/A msvcrt locking N/A N/A file fileno N/A msvcrt LK_LOCK N/A len content N/A N/A N/A N/A ImportError N/A ex N/A _lock_file N/A N/A file content N/A N/A N/A N/A _write_file_with_lock N/A N/A filename content N/A N/A N/A f None N/A N/A N/A f N/A open filename wb N/A N/A _lock_file f content N/A N/A N/A f write content N/A N/A f N/A N/A N/A N/A f close N/A _create_module N/A N/A module_name N/A N/A N/A ex. mod = _create_module('tenjin.util') N/A new N/A mod N/A N/A new module N/A N/A N/A module_name split . N/A -1 N/A N/A N/A sys modules N/A module_name mod N/A mod N/A _create_helpers_module N/A N/A N/A N/A to_str N/A N/A val N/A N/A N/A Convert value into string. Return '' if val is None.
           ex.
             >>> to_str(None)
             ''
             >>> to_str("foo")
             'foo'
             >>> to_str(u"\u65e5\u672c\u8a9e")
             u'\u65e5\u672c\u8a9e'
             >>> to_str(123)
             '123'
         N/A N/A val None N/A N/A N/A N/A isinstance val str N/A N/A val N/A N/A isinstance val unicode N/A N/A val N/A N/A str val N/A generate_tostrfunc N/A N/A encoding N/A N/A N/A Generate 'to_str' function which encodes unicode to str.
           ex.
              import tenjin
              from tenjin.helpers import escape
              to_str = tenjin.generate_tostrfunc('utf-8')
              engine = tenjin.Engine()
              context = { 'items': [u'AAA', u'BBB', u'CCC'] }
              output = engine.render('example.pyhtml')
              print output
         to_str N/A N/A val N/A N/A N/A N/A val None N/A N/A N/A N/A isinstance val str N/A N/A val N/A N/A isinstance val unicode N/A N/A N/A N/A val encode encoding N/A N/A str val N/A N/A to_str N/A echo N/A N/A string N/A N/A N/A add string value into _buf. this is equivarent to '#{string}'. N/A frame N/A N/A sys _getframe 1 N/A context N/A frame f_locals N/A N/A N/A N/A context N/A _buf append string N/A start_capture N/A N/A varname N/A None N/A N/A 
        start capturing with name.

        ex. list.rbhtml
          <html><body>
          <?py start_capture('itemlist') ?>
            <ul>
              <?py for item in list: ?>
              <li>${item}</li>
              <?py #end ?>
            </ul>
          <?py stop_capture() ?>
          </body></html>

        ex. layout.rbhtml
          <html xml:lang="en" lang="en">
           <head>
            <title>Capture Example</title>
           </head>
           <body>
            <!-- content -->
          #{itemlist}
            <!-- /content -->
           </body>
          </html>
         N/A frame N/A N/A sys _getframe 1 N/A context N/A frame f_locals N/A N/A context N/A _buf_tmp N/A context N/A _buf N/A N/A context N/A _capture_varname varname N/A N/A context N/A _buf N/A N/A stop_capture N/A N/A store_to_context N/A True N/A N/A 
        stop capturing and return the result of capturing.
        if store_to_context is True then the result is stored into _context[varname].
         N/A frame N/A N/A sys _getframe 1 N/A context N/A frame f_locals N/A result N/A N/A join N/A context N/A _buf N/A N/A context N/A _buf N/A N/A context pop _buf_tmp N/A varname N/A N/A context pop _capture_varname N/A varname N/A N/A N/A context N/A varname result N/A store_to_context N/A N/A N/A N/A context N/A _context N/A varname result N/A result N/A captured_as N/A N/A name N/A N/A N/A 
        helper method for layout template.
        if captured string is found then append it to _buf and return True,
        else return False.
         N/A frame N/A N/A sys _getframe 1 N/A context N/A frame f_locals N/A N/A N/A context has_key name N/A N/A _buf N/A context N/A _buf N/A N/A N/A _buf append N/A context N/A name N/A True N/A False N/A _p N/A N/A arg N/A N/A N/A ex. '/show/'+_p("item['id']") => "/show/#{item['id']}"  N/A N/A <`#%s#`> arg N/A _P N/A N/A arg N/A N/A N/A ex. '<b>%s</b>' % _P("item['id']") => "<b>${item['id']}</b>"  N/A N/A <`$%s$`> arg N/A _decode_params N/A N/A s N/A N/A N/A decode <`#...#`> and <`$...$`> into #{...} and ${...} urllib unquote N/A dct N/A lt gt amp quot #039 < > & " ' unescape N/A N/A s N/A N/A N/A N/A N/A re sub &(lt|gt|quot|amp|#039); N/A N/A N/A m N/A N/A dct N/A N/A N/A m group 1 s N/A N/A s N/A N/A re sub %3C%60%23(.*?)%23%60%3E N/A N/A N/A m N/A N/A #{%s} N/A unquote N/A N/A m group 1 s N/A s N/A N/A re sub %3C%60%24(.*?)%24%60%3E N/A N/A N/A m N/A N/A ${%s} N/A unquote N/A N/A m group 1 s N/A s N/A N/A re sub &lt;`#(.*?)#`&gt; N/A N/A N/A m N/A N/A #{%s} N/A unescape N/A N/A m group 1 s N/A s N/A N/A re sub &lt;`\$(.*?)\$`&gt; N/A N/A N/A m N/A N/A ${%s} N/A unescape N/A N/A m group 1 s N/A s N/A N/A re sub <`#(.*?)#`> #{\1} s N/A s N/A N/A re sub <`\$(.*?)\$`> ${\1} s N/A s N/A N/A mod N/A _create_module tenjin.helpers N/A N/A mod to_str to_str N/A N/A mod generate_tostrfunc generate_tostrfunc N/A N/A mod echo echo N/A N/A mod start_capture start_capture N/A N/A mod stop_capture stop_capture N/A N/A mod captured_as captured_as N/A N/A mod _p _p N/A N/A mod _P _P N/A N/A mod _decode_params _decode_params N/A N/A mod __all__ N/A escape to_str echo generate_tostrfunc start_capture stop_capture captured_as _p _P _decode_params N/A mod N/A N/A helpers N/A _create_helpers_module N/A _create_helpers_module N/A generate_tostrfunc N/A helpers generate_tostrfunc _create_html_module N/A N/A N/A N/A N/A to_str N/A helpers to_str N/A _escape_table N/A & < > " &amp; &lt; &gt; &quot; N/A _escape_pattern N/A N/A re compile [&<>"] N/A _escape_callable N/A N/A N/A m N/A N/A _escape_table N/A N/A N/A m group 0 escape_xml N/A N/A s N/A N/A N/A Escape '&', '<', '>', '"' into '&amp;', '&lt;', '&gt;', '&quot;'.
         N/A N/A N/A _escape_pattern sub _escape_callable s N/A tagattr N/A N/A name expr value escape N/A None True N/A N/A return empty string when expr is false value, ' name="value"' when
           value is specified, or ' name="expr"' when value is None.
           ex.
           >>> tagattr('size', 20)
           ' size="20"'
           >>> tagattr('size', 0)
           ''
           >>> tagattr('checked', True, 'checked')
           ' checked="checked"'
           >>> tagattr('checked', False, 'checked')
           ''
            N/A N/A expr N/A N/A N/A N/A value None N/A N/A value N/A to_str expr N/A N/A value N/A to_str value N/A escape N/A N/A value N/A escape_xml value N/A N/A  %s="%s" N/A name value N/A checked N/A N/A expr N/A N/A N/A return ' checked="checked"' if expr is true. N/A N/A N/A expr  checked="checked" N/A selected N/A N/A expr N/A N/A N/A return ' selected="selected"' if expr is true. N/A N/A N/A expr  selected="selected" N/A disabled N/A N/A expr N/A N/A N/A return ' disabled="disabled"' if expr is true. N/A N/A N/A expr  disabled="disabled" N/A nl2br N/A N/A text N/A N/A N/A replace "
" to "<br />
" and return it. N/A N/A text N/A N/A N/A N/A N/A text replace <br />
 N/A text2html N/A N/A text N/A N/A N/A (experimental) escape xml characters, replace "
" to "<br />
", and return it. N/A N/A text N/A N/A N/A N/A nl2br N/A N/A N/A escape_xml text replace  &nbsp; N/A N/A mod N/A _create_module tenjin.helpers.html N/A N/A mod _escape_table _escape_table N/A N/A mod escape_xml escape_xml N/A N/A mod escape escape_xml N/A N/A mod tagattr tagattr N/A N/A mod checked checked N/A N/A mod selected selected N/A N/A mod disabled disabled N/A N/A mod nl2br nl2br N/A N/A mod text2html text2html N/A mod N/A N/A N/A helpers html N/A _create_html_module N/A _create_html_module N/A N/A helpers escape N/A N/A helpers html escape_xml Template N/A object N/A N/A Convert and evaluate embedded python string.

       Notation:
       * '<?py ... ?>' means python statement code.
       * '#{...}' means python expression code.
       * '${...}' means python escaped expression code.

       ex. example.pyhtml
         <table>
         <?py is_odd = False ?>
         <?py for item in items: ?>
         <?py     is_oddd = not is_odd ?>
         <?py     color = is_odd and '#FFF' or '#FCF' ?>
          <tr bgcolor="#{color}">
           <td>${item}</td>
          </tr>
         <?py #end ?>
         </table>

       ex.
         >>> filename = 'example.pyhtml'
         >>> import tenjin
         >>> from tenjin.helpers import escape, to_str
         >>> template = tenjin.Template(filename)
         >>> script = template.script
         >>> ## or
         >>> #template = tenjin.Template()
         >>> #script = template.convert_file(filename)
         >>> ## or
         >>> #template = tenjin.Template()
         >>> #input = open(filename).read()
         >>> #script = template.convert(input, filename)  # filename is optional
         >>> print script
         >>> context = {'items': ['<foo>','bar&bar','"baz"']}
         >>> output = template.render(context)
         >>> print output
         <table>
          <tr bgcolor="#FFF">
           <td>&lt;foo&gt;</td>
          </tr>
          <tr bgcolor="#FCF">
           <td>bar&amp;bar</td>
          </tr>
          <tr bgcolor="#FFF">
           <td>&quot;baz&quot;</td>
          </tr>
         </table>
     N/A filename None N/A encoding None N/A escapefunc escape N/A tostrfunc to_str N/A indent 4 N/A preamble None N/A postamble None N/A smarttrim None N/A args None __init__ N/A N/A self filename encoding escapefunc tostrfunc indent preamble postamble smarttrim N/A None None None None None None None None N/A N/A Initailizer of Template class.

           filename:str (=None)
             Filename to convert (optional). If None, no convert.
           encoding:str (=None)
             Encoding name. If specified, template string is converted into
             unicode object internally.
             Template.render() returns str object if encoding is None,
             else returns unicode object if encoding name is specified.
           escapefunc:str (='escape')
             Escape function name.
           tostrfunc:str (='to_str')
             'to_str' function name.
           indent:int (=4)
             Indent width.
           preamble:str or bool (=None)
             Preamble string which is inserted into python code.
             If true, '_buf = []' is used insated.
           postamble:str or bool (=None)
             Postamble string which is appended to python code.
             If true, 'print "".join(_buf)' is used instead.
           smarttrim:bool (=None)
             If True then "<div>\n#{_context}\n</div>" is parsed as
             "<div>\n#{_context}</div>".
         N/A N/A encoding None N/A N/A N/A self encoding encoding N/A N/A escapefunc None N/A N/A N/A self escapefunc escapefunc N/A N/A tostrfunc None N/A N/A N/A self tostrfunc tostrfunc N/A N/A indent None N/A N/A N/A self indent indent N/A N/A preamble None N/A N/A N/A self preamble preamble N/A N/A postamble None N/A N/A N/A self postamble postamble N/A N/A smarttrim None N/A N/A N/A self smarttrim smarttrim N/A N/A preamble True N/A N/A N/A self preamble _buf = [] N/A N/A postamble True N/A N/A N/A self postamble print ''.join(_buf) N/A filename N/A N/A N/A N/A self convert_file filename N/A N/A N/A N/A self _reset N/A _reset N/A N/A self input filename N/A None None N/A N/A N/A self _spaces N/A N/A self script None N/A N/A self bytecode None N/A N/A self input input N/A N/A self filename filename N/A N/A input None N/A N/A i N/A N/A input find N/A N/A i 0 N/A N/A N/A self newline N/A N/A N/A N/A N/A len input 2 N/A N/A input N/A N/A i 1 N/A N/A N/A self newline N/A N/A N/A self newline N/A before_convert N/A N/A self buf N/A N/A N/A N/A self preamble N/A N/A N/A N/A buf append N/A self preamble N/A N/A N/A buf append N/A N/A N/A N/A N/A self input startswith <?py ;  N/A after_convert N/A N/A self buf N/A N/A N/A N/A self postamble N/A N/A N/A N/A N/A N/A buf N/A -1 endswith N/A N/A N/A N/A buf append N/A N/A N/A buf append N/A N/A self postamble N/A convert_file N/A N/A self filename N/A N/A N/A Convert file into python script and return it.
           This is equivarent to convert(open(filename).read(), filename).
         N/A input N/A N/A N/A open filename rb read N/A N/A N/A self convert input filename N/A convert N/A N/A self input filename N/A None N/A N/A Convert string in which python code is embedded into python script and return it.

           input:str
             Input string to convert into python code.
           filename:str (=None)
             Filename of input. this is optional but recommended to report errors.

           ex.
             >>> import tenjin
             >>> from tenjin.helpers import escape, to_str
             >>> template = tenjin.Template()
             >>> filename = 'example.html'
             >>> input = open(filename).read()
             >>> script = template.convert(input, filename)   # filename is optional
             >>> print script
         N/A N/A N/A self encoding N/A isinstance input str N/A N/A input N/A N/A input decode N/A self encoding N/A N/A N/A self _reset input filename N/A buf N/A N/A N/A N/A self before_convert buf N/A N/A N/A self parse_stmts buf input N/A N/A N/A self after_convert buf N/A script N/A N/A join buf N/A N/A self script script N/A script N/A compile_stmt_pattern N/A N/A pi N/A N/A N/A N/A N/A re compile N/A <\?%s( |\t|\r?\n)(.*?) ?\?>([ \t]*\r?\n)? pi N/A re S N/A N/A STMT_PATTERN N/A compile_stmt_pattern py N/A compile_stmt_pattern N/A staticmethod compile_stmt_pattern stmt_pattern N/A N/A self N/A N/A N/A N/A Template STMT_PATTERN N/A parse_stmts N/A N/A self buf input N/A N/A N/A N/A input N/A N/A N/A rexp N/A N/A self stmt_pattern N/A is_bol True N/A index 0 N/A m N/A N/A rexp finditer input N/A N/A N/A mspace code rspace N/A N/A m groups N/A text N/A input N/A index N/A N/A m start N/A index N/A N/A m end N/A lspace None N/A N/A text N/A N/A is_bol N/A N/A lspace N/A N/A N/A N/A text N/A -1 N/A N/A lspace N/A N/A rindex N/A N/A text rfind N/A N/A rindex 0 N/A N/A N/A is_bol N/A N/A text isspace N/A N/A lspace text N/A text N/A N/A s N/A text N/A N/A rindex 1 N/A N/A N/A s isspace N/A N/A lspace s N/A text N/A text N/A N/A rindex 1 N/A N/A N/A self parse_exprs buf text is_bol N/A is_bol N/A rspace None N/A lspace N/A N/A N/A N/A buf append lspace N/A N/A mspace N/A N/A N/A N/A buf append N/A N/A N/A mspace N/A code N/A N/A code N/A N/A self statement_hook code N/A N/A N/A self add_stmt buf code N/A N/A N/A self _set_spaces code lspace mspace N/A rspace N/A N/A N/A N/A buf append N/A rest N/A input N/A index N/A rest N/A N/A N/A N/A self parse_exprs buf rest N/A statement_hook N/A N/A self stmt N/A N/A N/A expand macros and parse '#@ARGS' in a statement. N/A N/A N/A self args None N/A N/A args_pattern ^ *#@ARGS(?:[ \t]+(.*?))?$ N/A m N/A N/A re match args_pattern stmt N/A m N/A N/A arr N/A N/A N/A N/A N/A m group 1 split , N/A args N/A N/A declares N/A N/A s arr N/A N/A arg N/A N/A s strip N/A N/A s N/A N/A N/A N/A N/A N/A re match ^[a-zA-Z_]\w*$ arg N/A N/A N/A ValueError N/A %s: invalid template argument. arg N/A N/A N/A args append arg N/A N/A N/A declares append N/A %s = _context.get('%s');  N/A arg arg N/A N/A self args args N/A N/A N/A join declares N/A stmt N/A N/A EXPR_PATTERN N/A N/A re compile ([#$])\{(.*?)\} N/A re S expr_pattern N/A N/A self N/A N/A N/A N/A Template EXPR_PATTERN N/A get_expr_and_escapeflag N/A N/A self match N/A N/A N/A N/A N/A N/A match group 2 N/A N/A N/A match group 1 $ N/A parse_exprs N/A N/A self buf input is_bol N/A False N/A N/A N/A input N/A N/A N/A N/A self _spaces N/A N/A N/A N/A buf append N/A self _spaces N/A N/A N/A self start_text_part buf N/A rexp N/A N/A self expr_pattern N/A smarttrim N/A self smarttrim N/A nl N/A self newline N/A nl_len N/A len nl N/A pos 0 N/A m N/A N/A rexp finditer input N/A N/A start N/A N/A m start N/A text N/A input N/A pos start N/A pos N/A N/A m end N/A N/A expr flag_escape N/A N/A self get_expr_and_escapeflag m N/A text N/A N/A N/A N/A self add_text buf text N/A N/A N/A self add_expr buf expr flag_escape N/A smarttrim N/A N/A flag_bol N/A N/A N/A text endswith nl N/A N/A text N/A N/A start 0 is_bol N/A N/A flag_bol N/A flag_escape N/A N/A input N/A pos N/A pos nl_len nl N/A N/A pos nl_len N/A N/A N/A buf append N/A smarttrim N/A N/A N/A buf N/A N/A buf N/A -1 N/A N/A N/A N/A buf pop N/A rest N/A input N/A pos N/A rest N/A N/A N/A N/A self add_text buf rest True N/A N/A N/A self stop_text_part buf N/A N/A N/A input N/A -1 N/A N/A N/A N/A buf append N/A start_text_part N/A N/A self buf N/A N/A N/A N/A N/A buf append _buf.extend(( N/A stop_text_part N/A N/A self buf N/A N/A N/A N/A N/A buf append )); N/A N/A _quote_rexp N/A N/A re compile (['\\\\]) add_text N/A N/A self buf text encode_newline N/A False N/A N/A N/A text N/A N/A N/A N/A self encoding N/A N/A N/A N/A buf append u''' N/A N/A N/A N/A buf append ''' N/A text N/A N/A N/A Template _quote_rexp sub \\\1 text N/A N/A N/A encode_newline N/A N/A text N/A -1 N/A N/A N/A N/A buf append text N/A N/A N/A buf append ''',  N/A N/A N/A N/A N/A len text 2 N/A N/A text N/A -2 N/A N/A N/A N/A buf append N/A text N/A 0 -2 N/A N/A N/A buf append \r\n''',  N/A N/A N/A N/A buf append N/A text N/A 0 -1 N/A N/A N/A buf append \n''',  N/A N/A _add_text add_text add_expr N/A N/A self buf code flag_escape N/A None N/A N/A N/A N/A code N/A N/A code isspace N/A N/A N/A N/A flag_escape None N/A N/A N/A N/A buf append code N/A N/A N/A buf append ,  N/A N/A N/A flag_escape False N/A N/A N/A N/A buf extend N/A N/A self tostrfunc ( code ),  N/A N/A N/A N/A buf extend N/A N/A self escapefunc ( N/A self tostrfunc ( code )),  N/A add_stmt N/A N/A self buf code N/A N/A N/A N/A N/A self newline N/A N/A code N/A N/A code replace N/A N/A N/A buf append code N/A _set_spaces N/A N/A self code lspace mspace N/A N/A N/A lspace N/A N/A N/A mspace N/A N/A code N/A lspace code N/A N/A N/A mspace N/A N/A code N/A N/A lspace code N/A i N/A N/A N/A N/A N/A code rstrip rfind 1 N/A indent 0 N/A n N/A len code N/A ch None N/A N/A i n N/A N/A ch N/A code N/A i N/A N/A ch N/A N/A indent 1 N/A N/A N/A ch N/A N/A indent 8 N/A N/A N/A i 1 N/A ch N/A N/A N/A N/A N/A N/A code rstrip N/A -1 : N/A N/A indent N/A self indent N/A N/A self _spaces N/A indent N/A render N/A N/A self context globals _buf N/A None None None N/A N/A Evaluate python code with context dictionary.
           If _buf is None then return the result of evaluation as str,
           else return None.

           context:dict (=None)
             Context object to evaluate. If None then new dict is created.
           globals:dict (=None)
             Global object. If None then globals() is used.
           _buf:list (=None)
             If None then new list is created.

           ex.
             >>> import tenjin
             >>> from tenjin.helpers import escape, to_str
             >>> template = tenjin.Template('example.pyhtml')
             >>> context = {'items': ['foo','bar','baz'], 'title': 'example'}
             >>> output = template.evaluate(context)
             >>> print output,
         N/A N/A context None N/A N/A locals context N/A N/A N/A N/A N/A self args None N/A N/A locals N/A N/A context copy N/A N/A locals N/A N/A N/A N/A context has_key _engine N/A N/A N/A N/A N/A N/A context get _engine hook_context locals N/A N/A locals N/A _context context N/A N/A globals None N/A N/A globals N/A N/A N/A sys _getframe 1 f_globals N/A bufarg _buf N/A N/A _buf None N/A N/A _buf N/A N/A N/A locals N/A _buf _buf N/A N/A N/A self bytecode N/A N/A N/A N/A self compile N/A N/A self bytecode globals locals N/A N/A bufarg None N/A N/A s N/A N/A join _buf N/A s N/A N/A None N/A compile N/A N/A self N/A N/A N/A compile self.script into self.bytecode N/A N/A self bytecode N/A compile N/A self script N/A N/A self filename (tenjin) exec N/A N/A Preprocessor N/A Template N/A N/A STMT_PATTERN N/A N/A Template compile_stmt_pattern PY stmt_pattern N/A N/A self N/A N/A N/A N/A Preprocessor STMT_PATTERN N/A N/A EXPR_PATTERN N/A N/A re compile ([#$])\{\{(.*?)\}\} N/A re S expr_pattern N/A N/A self N/A N/A N/A N/A Preprocessor EXPR_PATTERN N/A add_expr N/A N/A self buf code flag_escape N/A None N/A N/A N/A N/A code N/A N/A code isspace N/A N/A N/A code N/A _decode_params(%s) code N/A N/A N/A Template add_expr self buf code flag_escape N/A N/A Engine N/A object N/A N/A Engine class of templates.

       ex.
         >>> ## create engine
         >>> import tenjin
         >>> from tenjin.helpers import *
         >>> prefix = 'user_'
         >>> postfix = '.pyhtml'
         >>> layout = 'layout.pyhtml'
         >>> path = ['views']
         >>> engine = tenjin.Engine(prefix=prefix, postfix=postfix,
         ...                        layout=layout, path=path, encoding='utf-8')
         >>> ## evaluate template(='views/user_create.pyhtml') with context object.
         >>> ## (layout template (='views/layout.pyhtml') are used.)
         >>> context = {'title': 'Create User', 'user': user}
         >>> print engine.render(':create', context)
         >>> ## evaluate template without layout template.
         >>> print engine.render(':create', context, layout=False)

       In template file, the followings are available.
       * include(template_name, append_to_buf=True) :
            Include other template
       * _content :
            Result of evaluating template (available only in layout file).

       ex. file 'layout.pyhtml':
         <html>
          <body>
           <div class="sidemenu">
         <?py include(':sidemenu') ?>
           </div>
           <div class="maincontent">
         #{_content}
           </div>
          </body>
         </html>
     N/A prefix N/A postfix N/A layout None N/A templateclass Template N/A path None N/A cache False N/A preprocess False __init__ N/A N/A self prefix postfix layout path cache preprocess templateclass N/A None None None None None None None kwargs N/A N/A Initializer of Engine class.

           prefix:str (='')
             Prefix string used to convert template short name to template filename.
           postfix:str (='')
             Postfix string used to convert template short name to template filename.
           layout:str (=None)
             Default layout template name.
           path:list of str(=None)
             List of directory names which contain template files.
           cache:bool (=True)
             Cache converted python code into file.
           preprocess:bool(=False)
             Activate preprocessing or not.
           templateclass:class (=Template)
             Template class which engine creates automatically.
           kwargs:dict
             Options for Template class constructor.
             See document of Template.__init__() for details.
         N/A prefix N/A N/A N/A self prefix prefix N/A postfix N/A N/A N/A self postfix postfix N/A layout N/A N/A N/A self layout layout N/A templateclass N/A N/A N/A self templateclass templateclass N/A N/A path None N/A N/A N/A self path path N/A N/A cache None N/A N/A N/A self cache cache N/A N/A preprocess None N/A N/A N/A self preprocess preprocess N/A N/A self kwargs kwargs N/A N/A self templates N/A N/A to_filename N/A N/A self template_name N/A N/A N/A Convert template short name to filename.
           ex.
             >>> engine = tenjin.Engine(prefix='user_', postfix='.pyhtml')
             >>> engine.to_filename('list')
             'list'
             >>> engine.to_filename(':list')
             'user_list.pyhtml'
         N/A N/A N/A template_name N/A 0 : N/A N/A N/A N/A N/A self prefix N/A template_name N/A 1 N/A self postfix N/A template_name N/A find_template_file N/A N/A self template_name N/A N/A N/A Find template file and return it's filename.
           When template file is not found, IOError is raised.
         N/A filename N/A N/A self to_filename template_name N/A N/A self path N/A N/A dirname N/A self path N/A N/A filepath N/A N/A dirname N/A N/A os path sep filename N/A N/A N/A N/A os path isfile filepath N/A N/A filepath N/A N/A N/A N/A N/A os path isfile filename N/A N/A filename N/A N/A IOError N/A %s: filename not found (path=%s). N/A filename N/A repr N/A self path N/A register_template N/A N/A self template_name template N/A N/A N/A Register an template object. N/A N/A N/A hasattr template timestamp N/A N/A N/A template timestamp None N/A N/A N/A self templates N/A template_name template N/A load_cachefile N/A N/A self cache_filename template N/A N/A N/A load marshaled cache file N/A dct N/A N/A marshal load N/A open cache_filename rb N/A N/A template args N/A dct N/A args N/A N/A template script N/A dct N/A script N/A N/A template bytecode N/A dct N/A bytecode N/A _load_cachefile_for_script N/A N/A self cache_filename template N/A N/A N/A s N/A N/A N/A open cache_filename read N/A N/A N/A s startswith #@ARGS  N/A N/A pos N/A N/A s find N/A args_str N/A s N/A N/A len #@ARGS  pos N/A N/A template args N/A N/A args_str N/A N/A args_str split ,  N/A N/A s N/A s N/A N/A pos 1 N/A N/A N/A template args None N/A N/A template encoding N/A N/A s N/A N/A s decode utf-8 N/A N/A template script s N/A N/A N/A template compile N/A store_cachefile N/A N/A self cache_filename template N/A N/A N/A store template into marshal file N/A dct N/A args script bytecode N/A template args N/A template script N/A template bytecode N/A N/A _write_file_with_lock cache_filename N/A N/A marshal dumps dct N/A _store_cachefile_for_script N/A N/A self cache_filename template N/A N/A N/A s N/A template script N/A N/A N/A template encoding N/A isinstance s unicode N/A N/A s N/A N/A s encode N/A template encoding N/A N/A N/A template args None N/A N/A s N/A #@ARGS %s
%s N/A N/A N/A ,  join N/A template args s N/A N/A _write_file_with_lock cache_filename s N/A cachename N/A N/A self filename N/A N/A N/A N/A N/A N/A os path join N/A N/A N/A os path expanduser ~ .rst2pdf N/A N/A N/A N/A os path basename filename .cache N/A create_template N/A N/A self filename _context _globals N/A N/A N/A Read template file and create template object. N/A template N/A N/A self templateclass None N/A self kwargs N/A N/A template timestamp N/A N/A time time N/A cache_filename N/A N/A self cachename filename N/A getmtime N/A N/A os path getmtime N/A N/A N/A self cache N/A N/A input N/A N/A self read_template_file filename _context _globals N/A N/A N/A template convert input filename N/A N/A N/A N/A N/A N/A os path exists cache_filename N/A N/A getmtime cache_filename N/A getmtime filename N/A N/A N/A template filename filename N/A N/A N/A self load_cachefile cache_filename template N/A N/A N/A template bytecode None N/A N/A N/A N/A template compile N/A N/A input N/A N/A self read_template_file filename _context _globals N/A N/A N/A template convert input filename N/A N/A N/A template compile N/A N/A N/A self store_cachefile cache_filename template N/A template N/A read_template_file N/A N/A self filename _context _globals N/A N/A N/A N/A N/A self preprocess N/A N/A N/A N/A N/A open filename read N/A N/A _context None N/A N/A _context N/A N/A N/A N/A N/A _context has_key _engine N/A N/A N/A N/A self hook_context _context N/A N/A _globals None N/A N/A _globals N/A N/A N/A sys _getframe 2 f_globals N/A preprocessor N/A Preprocessor filename N/A N/A N/A preprocessor render _context globals _globals N/A get_template N/A N/A self template_name _context _globals N/A None None N/A N/A Return template object.
           If template object has not registered, template engine creates
           and registers template object automatically.
         N/A template N/A N/A N/A self templates get template_name N/A t template N/A N/A N/A t None N/A N/A t timestamp N/A t filename N/A N/A t timestamp N/A N/A N/A os path getmtime N/A t filename N/A N/A filename N/A N/A self find_template_file template_name N/A N/A _globals None N/A N/A _globals N/A N/A N/A sys _getframe 1 f_globals N/A template N/A N/A self create_template filename _context _globals N/A N/A N/A self register_template template_name template N/A template N/A include N/A N/A self template_name append_to_buf N/A True N/A N/A Evaluate template using current local variables as context.

           template_name:str
             Filename (ex. 'user_list.pyhtml') or short name (ex. ':list') of template.
           append_to_buf:boolean (=True)
             If True then append output into _buf and return None,
             else return stirng output.

           ex.
             <?py include('file.pyhtml') ?>
             #{include('file.pyhtml', False)}
             <?py val = include('file.pyhtml', False) ?>
         N/A frame N/A N/A sys _getframe 1 N/A locals N/A frame f_locals N/A globals N/A frame f_globals N/A N/A N/A locals has_key _context N/A context N/A locals N/A _context N/A template N/A N/A self get_template template_name context globals N/A append_to_buf N/A N/A _buf N/A locals N/A _buf N/A N/A _buf None N/A N/A N/A template render context globals _buf _buf N/A render N/A N/A self template_name context globals layout N/A None None True N/A N/A Evaluate template with layout file and return result of evaluation.

           template_name:str
             Filename (ex. 'user_list.pyhtml') or short name (ex. ':list') of template.
           context:dict (=None)
             Context object to evaluate. If None then new dict is used.
           globals:dict (=None)
             Global context to evaluate. If None then globals() is used.
           layout:str or Bool(=True)
             If True, the default layout name specified in constructor is used.
             If False, no layout template is used.
             If str, it is regarded as layout template name.

           If temlate object related with the 'template_name' argument is not exist,
           engine generates a template object and register it automatically.
         N/A N/A context None N/A N/A context N/A N/A N/A globals None N/A N/A globals N/A N/A N/A sys _getframe 1 f_globals N/A N/A N/A self hook_context context N/A True N/A N/A template N/A N/A self get_template template_name context globals N/A content N/A N/A template render context globals N/A layout N/A N/A context pop _layout layout N/A N/A N/A layout True N/A layout None N/A N/A layout N/A self layout N/A N/A layout N/A N/A N/A template_name layout N/A layout False N/A N/A context N/A _content content N/A N/A N/A context pop _content None N/A content N/A hook_context N/A N/A self context N/A N/A N/A N/A context N/A _engine self N/A N/A context N/A include N/A self include N/A N/A