<s> """<STR_LIT>""" <EOL> from nuitka import Options <EOL> from nuitka . PythonVersions import python_version <EOL> from . ErrorCodes import getErrorExitBoolCode , getErrorExitCode , getReleaseCodes <EOL> from . Helpers import generateChildExpressionsCode , generateExpressionCode <EOL> def generateBuiltinDictCode ( to_name , expression , emit , context ) : <EOL> if expression . getPositionalArgument ( ) : <EOL> seq_name = context . allocateTempName ( "<STR_LIT>" ) <EOL> generateExpressionCode ( <EOL> to_name = seq_name , <EOL> expression = expression . getPositionalArgument ( ) , <EOL> emit = emit , <EOL> context = context , <EOL> allow_none = True <EOL> ) <EOL> else : <EOL> seq_name = None <EOL> if expression . getNamedArgumentPairs ( ) : <EOL> if seq_name is None : <EOL> getDictionaryCreationCode ( <EOL> to_name = to_name , <EOL> pairs = expression . getNamedArgumentPairs ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> dict_name = None <EOL> else : <EOL> dict_name = context . allocateTempName ( "<STR_LIT>" ) <EOL> getDictionaryCreationCode ( <EOL> to_name = dict_name , <EOL> pairs = expression . getNamedArgumentPairs ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> else : <EOL> dict_name = None <EOL> if seq_name is not None : <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> to_name , <EOL> seq_name , <EOL> "<STR_LIT>" if dict_name is None else dict_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( seq_name , dict_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitCode ( <EOL> check_name = to_name , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> context . addCleanupTempName ( to_name ) <EOL> def generateDictionaryCreationCode ( to_name , expression , emit , context ) : <EOL> getDictionaryCreationCode ( <EOL> to_name = to_name , <EOL> pairs = expression . getPairs ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> def getDictionaryCreationCode ( to_name , pairs , emit , context ) : <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> to_name , <EOL> len ( pairs ) <EOL> ) <EOL> ) <EOL> context . addCleanupTempName ( to_name ) <EOL> def generateValueCode ( dict_value_name , pair ) : <EOL> generateExpressionCode ( <EOL> to_name = dict_value_name , <EOL> expression = pair . getValue ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> def generateKeyCode ( dict_key_name , pair ) : <EOL> generateExpressionCode ( <EOL> to_name = dict_key_name , <EOL> expression = pair . getKey ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> for pair in pairs : <EOL> dict_key_name = context . allocateTempName ( "<STR_LIT>" ) <EOL> dict_value_name = context . allocateTempName ( "<STR_LIT>" ) <EOL> if python_version < <NUM_LIT> : <EOL> generateValueCode ( dict_value_name , pair ) <EOL> generateKeyCode ( dict_key_name , pair ) <EOL> else : <EOL> generateKeyCode ( dict_key_name , pair ) <EOL> generateValueCode ( dict_value_name , pair ) <EOL> if pair . getKey ( ) . isKnownToBeHashable ( ) : <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> to_name , <EOL> dict_key_name , <EOL> dict_value_name <EOL> ) <EOL> ) <EOL> else : <EOL> res_name = context . getIntResName ( ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> res_name , <EOL> to_name , <EOL> dict_key_name , <EOL> dict_value_name <EOL> ) <EOL> ) <EOL> getErrorExitBoolCode ( <EOL> condition = "<STR_LIT>" % res_name , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> if context . needsCleanup ( dict_value_name ) : <EOL> emit ( "<STR_LIT>" % dict_value_name ) <EOL> context . removeCleanupTempName ( dict_value_name ) <EOL> if context . needsCleanup ( dict_key_name ) : <EOL> emit ( "<STR_LIT>" % dict_key_name ) <EOL> context . removeCleanupTempName ( dict_key_name ) <EOL> def generateDictOperationUpdateCode ( statement , emit , context ) : <EOL> value_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = value_arg_name , <EOL> expression = statement . getValue ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> dict_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = dict_arg_name , <EOL> expression = statement . getDict ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> res_name = context . getIntResName ( ) <EOL> emit ( "<STR_LIT>" % dict_arg_name ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> res_name , <EOL> dict_arg_name , <EOL> value_arg_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( dict_arg_name , value_arg_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitBoolCode ( <EOL> condition = "<STR_LIT>" % res_name , <EOL> needs_check = statement . mayRaiseException ( BaseException ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> def generateDictOperationGetCode ( to_name , expression , emit , context ) : <EOL> dict_name , key_name = generateChildExpressionsCode ( <EOL> expression = expression , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> to_name , <EOL> dict_name , <EOL> key_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( dict_name , key_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitCode ( <EOL> check_name = to_name , <EOL> needs_check = expression . mayRaiseException ( BaseException ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> context . addCleanupTempName ( to_name ) <EOL> def generateDictOperationInCode ( to_name , expression , emit , context ) : <EOL> inverted = expression . isExpressionDictOperationNOTIn ( ) <EOL> dict_name , key_name = generateChildExpressionsCode ( <EOL> expression = expression , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> res_name = context . getIntResName ( ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> res_name , <EOL> key_name , <EOL> dict_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( dict_name , key_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitBoolCode ( <EOL> condition = "<STR_LIT>" % res_name , <EOL> needs_check = expression . mayRaiseException ( BaseException ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> to_name , <EOL> res_name , <EOL> '<STR_LIT:1>' if not inverted else '<STR_LIT:0>' <EOL> ) <EOL> ) <EOL> def generateDictOperationSetCode ( statement , emit , context ) : <EOL> value_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = value_arg_name , <EOL> expression = statement . getValue ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> dict_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = dict_arg_name , <EOL> expression = statement . getDict ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> key_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = key_arg_name , <EOL> expression = statement . getKey ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> context . setCurrentSourceCodeReference ( statement . getSourceReference ( ) ) <EOL> res_name = context . getIntResName ( ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> res_name , <EOL> dict_arg_name , <EOL> key_arg_name , <EOL> value_arg_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( value_arg_name , dict_arg_name , key_arg_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitBoolCode ( <EOL> condition = "<STR_LIT>" % res_name , <EOL> emit = emit , <EOL> needs_check = not statement . getKey ( ) . isKnownToBeHashable ( ) , <EOL> context = context <EOL> ) <EOL> def generateDictOperationRemoveCode ( statement , emit , context ) : <EOL> dict_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = dict_arg_name , <EOL> expression = statement . getDict ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> key_arg_name = context . allocateTempName ( "<STR_LIT>" , unique = True ) <EOL> generateExpressionCode ( <EOL> to_name = key_arg_name , <EOL> expression = statement . getKey ( ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> old_source_ref = context . setCurrentSourceCodeReference ( <EOL> statement . getKey ( ) . getSourceReference ( ) <EOL> if Options . isFullCompat ( ) else <EOL> statement . getSourceReference ( ) <EOL> ) <EOL> res_name = context . getBoolResName ( ) <EOL> emit ( <EOL> "<STR_LIT>" % ( <EOL> res_name , <EOL> dict_arg_name , <EOL> key_arg_name <EOL> ) <EOL> ) <EOL> getReleaseCodes ( <EOL> release_names = ( dict_arg_name , key_arg_name ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> getErrorExitBoolCode ( <EOL> condition = "<STR_LIT>" % res_name , <EOL> needs_check = statement . mayRaiseException ( BaseException ) , <EOL> emit = emit , <EOL> context = context <EOL> ) <EOL> context . setCurrentSourceCodeReference ( old_source_ref ) </s>
