Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
variable_ref = ExpressionTargetTempVariableRef(
variable = tmp_return_value,
source_ref = source_ref,
),
tolerant = True,
source_ref = source_ref
),
source_ref = source_ref
)
else:
body = StatementExpressionOnly(
expression = body,
source_ref = source_ref
)
else:
body = StatementReturn(
expression = body,
source_ref = source_ref
)
body = StatementsFrame(
statements = mergeStatements(
(body,)
),
guard_mode = "generator" if function_body.isGenerator() else "full",
var_names = parameters.getCoArgNames(),
arg_count = parameters.getArgumentCount(),
kw_only_count = parameters.getKwOnlyParameterCount(),
has_starlist = parameters.getStarListArgumentName() is not None,
has_stardict = parameters.getStarDictArgumentName() is not None,
code_name = "",
source_ref = body.getSourceReference()
provider,
tried=StatementTry(
tried=makeStatementsSequenceFromStatement(
statement=StatementReturn(
expression=ExpressionAttributeLookup(
source=ExpressionTempVariableRef(
variable=tmp_base, source_ref=source_ref
),
attribute_name="__class__",
source_ref=source_ref,
),
source_ref=source_ref,
)
),
except_handler=makeStatementsSequenceFromStatement(
statement=StatementReturn(
expression=ExpressionBuiltinType1(
value=ExpressionTempVariableRef(
variable=tmp_base, source_ref=source_ref
),
source_ref=source_ref,
),
source_ref=source_ref,
)
),
break_handler=None,
continue_handler=None,
return_handler=None,
source_ref=source_ref,
),
final=StatementReleaseVariable(
variable=tmp_base, source_ref=source_ref
variable_name = "called",
variable = called_variable,
source_ref = source_ref
),
star_list_variable_ref = ExpressionVariableRef(
variable_name = "star_arg_list",
variable = star_arg_list_variable,
source_ref = source_ref
),
star_list_target_variable_ref = ExpressionTargetVariableRef(
variable_name = "star_arg_list",
variable = star_arg_list_variable,
source_ref = source_ref
)
),
StatementReturn(
expression = ExpressionCall(
called = ExpressionVariableRef(
variable_name = "called",
variable = called_variable,
source_ref = source_ref
),
args = ExpressionVariableRef(
variable_name = "star_arg_list",
variable = star_arg_list_variable,
source_ref = source_ref
),
kw = ExpressionVariableRef(
variable_name = "star_arg_dict",
variable = star_arg_dict_variable,
source_ref = source_ref
),
variable=tmp_iter_variable,
source=ExpressionBuiltinIter1(
value=ExpressionVariableRef(
variable=args_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
StatementAssignmentVariable(
variable=tmp_result_variable,
source=makeConstantRefNode(constant={}, source_ref=internal_source_ref),
source_ref=internal_source_ref,
),
StatementLoop(body=loop_body, source_ref=internal_source_ref),
StatementReturn(
expression=ExpressionTempVariableRef(
variable=tmp_result_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
)
result.setBody(
makeStatementsSequenceFromStatement(
makeTryFinallyStatement(
provider=result,
tried=tried,
final=final,
source_ref=internal_source_ref,
)
)
),
left=_makeNameAttributeLookup(
ExpressionBuiltinType1(
value=ExpressionVariableRef(
variable=called_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
)
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
)
if python_version < 300:
instance_case = StatementReturn(
expression=makeBinaryOperationNode(
operator="Add",
right=makeConstantRefNode(
constant=" instance",
source_ref=internal_source_ref,
user_provided=True,
),
left=_makeNameAttributeLookup(
_makeNameAttributeLookup(
ExpressionVariableRef(
variable=called_variable, source_ref=internal_source_ref
),
attribute_name="__class__",
)
),
source_ref=internal_source_ref,
variable=tmp_iter_variable,
source=ExpressionBuiltinIter1(
value=ExpressionVariableRef(
variable=args_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
StatementAssignmentVariable(
variable=tmp_result_variable,
source=makeConstantRefNode(constant=[], source_ref=internal_source_ref),
source_ref=internal_source_ref,
),
StatementLoop(body=loop_body, source_ref=internal_source_ref),
StatementReturn(
expression=ExpressionBuiltinTuple(
value=ExpressionTempVariableRef(
variable=tmp_result_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
)
result.setBody(
makeStatementsSequenceFromStatement(
makeTryFinallyStatement(
provider=result,
tried=tried,
final=final,
),
ExpressionBuiltinLocals(
source_ref = source_ref
)
),
source_ref = source_ref
),
kw = ExpressionTempVariableRef(
variable = tmp_class_decl_dict,
source_ref = source_ref
),
source_ref = source_ref
),
source_ref = source_ref
),
StatementReturn(
expression = class_variable_ref,
source_ref = source_ref
)
]
body = makeStatementsSequence(
statements = statements,
allow_none = True,
source_ref = source_ref
)
# The class body is basically a function that implicitely, at the end
# returns its locals and cannot have other return statements contained.
class_creation_function.setBody(body)
),
)
called_variable = result.getVariableForAssignment(variable_name="called")
args_variable = result.getVariableForAssignment(variable_name="args")
star_arg_list_variable = result.getVariableForAssignment(
variable_name="star_arg_list"
)
statements = (
_makeStarListArgumentToTupleStatement(
called_variable=called_variable, star_list_variable=star_arg_list_variable
),
StatementReturn(
expression=makeExpressionCall(
called=ExpressionVariableRef(
variable=called_variable, source_ref=internal_source_ref
),
args=makeBinaryOperationNode(
operator="Add",
left=ExpressionVariableRef(
variable=args_variable, source_ref=internal_source_ref
),
right=ExpressionVariableRef(
variable=star_arg_list_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
kw=None,
source_ref=internal_source_ref,
variable=tmp_iter_variable,
source=ExpressionBuiltinIter1(
value=ExpressionVariableRef(
variable=args_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
StatementAssignmentVariable(
variable=tmp_result_variable,
source=makeConstantRefNode(constant=[], source_ref=internal_source_ref),
source_ref=internal_source_ref,
),
StatementLoop(body=loop_body, source_ref=internal_source_ref),
StatementReturn(
expression=ExpressionTempVariableRef(
variable=tmp_result_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
)
result.setBody(
makeStatementsSequenceFromStatement(
makeTryFinallyStatement(
provider=result,
tried=tried,
final=final,
source_ref=internal_source_ref,
)
)
source_ref=source_ref,
)
assign_iter_statement = StatementAssignmentVariable(
source=_makeIteratorCreation(
provider=provider,
qual=node.generators[0],
for_asyncgen=False,
source_ref=source_ref,
),
variable=iter_tmp,
source_ref=source_ref,
)
statements.append(
StatementReturn(
expression=ExpressionTempVariableRef(
variable=container_tmp, source_ref=source_ref
),
source_ref=source_ref,
)
)
statements = (
makeTryFinallyStatement(
provider=function_body,
tried=statements,
final=release_statements,
source_ref=source_ref.atInternal(),
),
)