<s> """<STR_LIT>""" <EOL> from nuitka import Options <EOL> from nuitka . nodes . AssignNodes import ( <EOL> ExpressionTargetVariableRef , <EOL> StatementAssignmentVariable <EOL> ) <EOL> from nuitka . nodes . ImportNodes import ( <EOL> ExpressionImportModule , <EOL> ExpressionImportModuleHard , <EOL> ExpressionImportName , <EOL> StatementImportStar <EOL> ) <EOL> from nuitka . nodes . StatementNodes import StatementsSequence <EOL> from nuitka . PythonVersions import python_version <EOL> from nuitka . tree import SyntaxErrors <EOL> from . Helpers import mangleName <EOL> _future_import_nodes = [ ] <EOL> def checkFutureImportsOnlyAtStart ( body ) : <EOL> for node in body : <EOL> if node in _future_import_nodes : <EOL> _future_import_nodes . remove ( node ) <EOL> else : <EOL> if _future_import_nodes : <EOL> SyntaxErrors . raiseSyntaxError ( <EOL> reason = """<STR_LIT>""" , <EOL> col_offset = <NUM_LIT:1> <EOL> if python_version >= <NUM_LIT> or not Options . isFullCompat ( ) else <EOL> None , <EOL> source_ref = _future_import_nodes [ <NUM_LIT:0> ] . source_ref <EOL> ) <EOL> def buildImportFromNode ( provider , node , source_ref ) : <EOL> module_name = node . module if node . module is not None else "<STR_LIT>" <EOL> level = node . level <EOL> if module_name == "<STR_LIT>" : <EOL> if not provider . isCompiledPythonModule ( ) : <EOL> SyntaxErrors . raiseSyntaxError ( <EOL> reason = """<STR_LIT>""" , <EOL> col_offset = <NUM_LIT:8> <EOL> if python_version >= <NUM_LIT> or not Options . isFullCompat ( ) <EOL> else None , <EOL> source_ref = source_ref <EOL> ) <EOL> for import_desc in node . names : <EOL> object_name , _local_name = import_desc . name , import_desc . asname <EOL> enableFutureFeature ( <EOL> object_name = object_name , <EOL> future_spec = source_ref . getFutureSpec ( ) , <EOL> source_ref = source_ref <EOL> ) <EOL> node . source_ref = source_ref <EOL> _future_import_nodes . append ( node ) <EOL> target_names = [ ] <EOL> import_names = [ ] <EOL> for import_desc in node . names : <EOL> object_name , local_name = import_desc . name , import_desc . asname <EOL> if object_name == '<STR_LIT:*>' : <EOL> target_names . append ( None ) <EOL> else : <EOL> target_names . append ( <EOL> local_name <EOL> if local_name is not None else <EOL> object_name <EOL> ) <EOL> import_names . append ( object_name ) <EOL> if None in target_names : <EOL> assert target_names == [ None ] <EOL> if not provider . isCompiledPythonModule ( ) and python_version >= <NUM_LIT> : <EOL> SyntaxErrors . raiseSyntaxError ( <EOL> "<STR_LIT>" , <EOL> provider . getSourceReference ( ) <EOL> ) <EOL> if provider . isExpressionFunctionBody ( ) : <EOL> provider . markAsStarImportContaining ( ) <EOL> return StatementImportStar ( <EOL> module_import = ExpressionImportModule ( <EOL> module_name = module_name , <EOL> import_list = ( '<STR_LIT:*>' , ) , <EOL> level = level , <EOL> source_ref = source_ref <EOL> ) , <EOL> source_ref = source_ref <EOL> ) <EOL> else : <EOL> def makeImportName ( import_name ) : <EOL> if module_name == "<STR_LIT>" : <EOL> return ExpressionImportModuleHard ( <EOL> module_name = "<STR_LIT>" , <EOL> import_name = import_name , <EOL> source_ref = source_ref <EOL> ) <EOL> else : <EOL> return ExpressionImportName ( <EOL> module = ExpressionImportModule ( <EOL> module_name = module_name , <EOL> import_list = tuple ( import_names ) , <EOL> level = level , <EOL> source_ref = source_ref <EOL> ) , <EOL> import_name = import_name , <EOL> source_ref = source_ref <EOL> ) <EOL> import_nodes = [ ] <EOL> for target_name , import_name in zip ( target_names , import_names ) : <EOL> import_nodes . append ( <EOL> StatementAssignmentVariable ( <EOL> variable_ref = ExpressionTargetVariableRef ( <EOL> variable_name = mangleName ( target_name , provider ) , <EOL> source_ref = source_ref <EOL> ) , <EOL> source = makeImportName ( <EOL> import_name = import_name , <EOL> ) , <EOL> source_ref = source_ref <EOL> ) <EOL> ) <EOL> return StatementsSequence ( <EOL> statements = import_nodes , <EOL> source_ref = source_ref <EOL> ) <EOL> def enableFutureFeature ( object_name , future_spec , source_ref ) : <EOL> if object_name == "<STR_LIT>" : <EOL> future_spec . enableUnicodeLiterals ( ) <EOL> elif object_name == "<STR_LIT>" : <EOL> future_spec . enableAbsoluteImport ( ) <EOL> elif object_name == "<STR_LIT>" : <EOL> future_spec . enableFutureDivision ( ) <EOL> elif object_name == "<STR_LIT>" : <EOL> future_spec . enableFuturePrint ( ) <EOL> elif object_name == "<STR_LIT>" and python_version >= <NUM_LIT> : <EOL> future_spec . enableBarry ( ) <EOL> elif object_name == "<STR_LIT>" : <EOL> future_spec . enableGeneratorStop ( ) <EOL> elif object_name == "<STR_LIT>" : <EOL> SyntaxErrors . raiseSyntaxError ( <EOL> "<STR_LIT>" , <EOL> source_ref <EOL> ) <EOL> elif object_name in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> pass <EOL> else : <EOL> SyntaxErrors . raiseSyntaxError ( <EOL> "<STR_LIT>" % object_name , <EOL> source_ref <EOL> ) </s>
