Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
StatementAssignmentVariable(
variable_ref = ExpressionTargetTempVariableRef(
variable = tmp_source.makeReference( provider ),
source_ref = source_ref
),
source = source,
source_ref = source_ref
)
]
for target in node.targets:
statements.append(
buildAssignmentStatements(
provider = provider,
node = target,
source = ExpressionTempVariableRef(
variable = tmp_source.makeReference( provider ),
source_ref = source_ref
),
source_ref = source_ref
)
)
statements.append(
StatementDelVariable(
variable_ref = ExpressionTargetTempVariableRef(
variable = tmp_source.makeReference( provider ),
source_ref = source_ref
),
tolerant = False,
source_ref = source_ref
)
exception_value = None,
exception_trace = None,
exception_cause = None,
source_ref = source_ref
)
statements = (
makeTryExceptSingleHandlerNode(
tried = makeStatementsSequenceFromStatement(
statement = StatementAssignmentVariable(
variable_ref = ExpressionTargetTempVariableRef(
variable = tmp_item_variable.makeReference( result ),
source_ref = source_ref
),
source = ExpressionBuiltinNext1(
value = ExpressionTempVariableRef(
variable = tmp_iter_variable.makeReference(
result
),
source_ref = source_ref
),
source_ref = source_ref
),
source_ref = source_ref
)
),
exception_name = "StopIteration",
handler_body = makeStatementsSequenceFromStatement(
statement = StatementBreakLoop(source_ref)
),
public_exc = False,
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(),
),
)
if python_version < 300:
variable=tmp_item_variable,
source=ExpressionBuiltinNext1(
value=ExpressionTempVariableRef(
variable=tmp_iter_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
exception_name="StopIteration",
handler_body=StatementLoopBreak(source_ref=internal_source_ref),
source_ref=internal_source_ref,
),
makeStatementConditional(
condition=ExpressionBuiltinIsinstance(
instance=ExpressionTempVariableRef(
variable=tmp_item_variable, source_ref=internal_source_ref
),
classes=makeConstantRefNode(
constant=type, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
yes_branch=type_case,
no_branch=non_type_case,
source_ref=internal_source_ref,
),
)
final = (
StatementReleaseVariable(
variable=args_variable, source_ref=internal_source_ref
function_body = function_body,
assign_provider = assign_provider,
provider = provider,
node = node,
emit_class = emit_class,
outer_iter_ref = outer_iter_ref,
temp_scope = None,
start_value = start_value,
container_tmp = container_tmp,
source_ref = source_ref,
)
if start_value is not None:
statements.append(
StatementReturn(
expression = ExpressionTempVariableRef(
variable = container_tmp.makeReference(function_body),
source_ref = source_ref
),
source_ref = source_ref
)
)
statements = (
makeTryFinallyStatement(
tried = statements,
final = del_statements,
source_ref = source_ref.atInternal()
),
)
function_body.setBody(
variable = tmp_item_variable.makeReference(result),
source_ref = source_ref
),
subscript = ExpressionConstantRef(
constant = 0,
source_ref = source_ref,
user_provided = True
),
source_ref = source_ref
),
source_ref = source_ref
),
StatementConditional(
condition = ExpressionComparison(
comparator = "In",
left = ExpressionTempVariableRef(
variable = tmp_key_variable.makeReference(result),
source_ref = source_ref
),
right = kw_variable_ref.makeCloneAt(source_ref),
source_ref = source_ref
),
yes_branch = makeStatementsSequenceFromStatement(
statement = raise_duplicate,
),
no_branch = None,
source_ref = source_ref
),
StatementAssignmentSubscript(
expression = kw_variable_ref.makeCloneAt(source_ref),
subscript = ExpressionTempVariableRef(
variable = tmp_key_variable.makeReference(result),
statements.append(
StatementLoopBreak(
source_ref = source_ref
)
)
handler_body = makeStatementsSequence(
statements = statements,
allow_none = False,
source_ref = source_ref
)
if sync:
next_node = ExpressionBuiltinNext1(
value = ExpressionTempVariableRef(
variable = tmp_iter_variable,
source_ref = source_ref
),
source_ref = source_ref
)
else:
next_node = ExpressionYieldFromWaitable(
expression = ExpressionAsyncNext(
value = ExpressionTempVariableRef(
variable = tmp_iter_variable,
source_ref = source_ref
),
source_ref = source_ref
),
source_ref = source_ref
)
def _makeStarDictArgumentToDictStatement(result, called_variable, star_dict_variable):
temp_scope = result.allocateTempScope("mapping")
tmp_dict_variable = result.allocateTempVariable(temp_scope, "dict")
tmp_iter_variable = result.allocateTempVariable(temp_scope, "iter")
tmp_keys_variable = result.allocateTempVariable(temp_scope, "keys")
tmp_key_variable = result.allocateTempVariable(temp_scope, "key")
loop_body = (
StatementAssignmentSubscript(
expression=ExpressionTempVariableRef(
variable=tmp_dict_variable, source_ref=internal_source_ref
),
subscript=ExpressionTempVariableRef(
variable=tmp_key_variable, source_ref=internal_source_ref
),
source=ExpressionSubscriptLookup(
subscribed=ExpressionVariableRef(
variable=star_dict_variable, source_ref=internal_source_ref
),
subscript=ExpressionTempVariableRef(
variable=tmp_key_variable, source_ref=internal_source_ref
),
source_ref=internal_source_ref,
),
source_ref=internal_source_ref,
),
variable = tmp_class,
source_ref = source_ref
),
source = ExpressionCallNoKeywords(
called = ExpressionTempVariableRef(
variable = tmp_metaclass,
source_ref = source_ref
),
args = ExpressionMakeTuple(
elements = (
ExpressionConstantRef(
constant = node.name,
source_ref = source_ref,
user_provided = True
),
ExpressionTempVariableRef(
variable = tmp_bases,
source_ref = source_ref
),
ExpressionTempVariableRef(
variable = tmp_class_dict,
source_ref = source_ref
)
),
source_ref = source_ref
),
source_ref = source_ref
),
source_ref = source_ref
),
]
tmp_class_dict = provider.allocateTempVariable(temp_scope, "class_dict")
tmp_metaclass = provider.allocateTempVariable(temp_scope, "metaclass")
tmp_class = provider.allocateTempVariable(temp_scope, "class")
select_metaclass = ExpressionOutlineBody(
provider=provider, name="select_metaclass", body=None, source_ref=source_ref
)
if node.bases:
tmp_base = select_metaclass.allocateTempVariable(temp_scope=None, name="base")
statements = (
StatementAssignmentVariable(
variable=tmp_base,
source=ExpressionSubscriptLookup(
subscribed=ExpressionTempVariableRef(
variable=tmp_bases, source_ref=source_ref
),
subscript=makeConstantRefNode(
constant=0, source_ref=source_ref, user_provided=True
),
source_ref=source_ref,
),
source_ref=source_ref,
),
makeTryFinallyStatement(
provider,
tried=StatementTry(
tried=makeStatementsSequenceFromStatement(
statement=StatementReturn(
expression=ExpressionAttributeLookup(
source=ExpressionTempVariableRef(