def createPathAssignment(source_ref): if Options.getFileReferenceMode() == "original": path_value = ExpressionConstantRef( constant=[dirname(source_ref.getFilename())], source_ref=source_ref, user_provided=True) else: path_value = ExpressionMakeList(elements=(ExpressionCallNoKeywords( called=ExpressionAttributeLookup(source=ExpressionImportModuleHard( module_name="os", import_name="path", source_ref=source_ref), attribute_name="dirname", source_ref=source_ref), args=ExpressionMakeTuple( elements=(ExpressionModuleFileAttributeRef( source_ref=source_ref, ), ), source_ref=source_ref, ), source_ref=source_ref, ), ), source_ref=source_ref) return StatementAssignmentVariable( variable_ref=ExpressionTargetVariableRef(variable_name="__path__", source_ref=source_ref), source=path_value, source_ref=source_ref)
def createPathAssignment(source_ref): if Options.getFileReferenceMode() == "original": path_value = ExpressionConstantRef( constant = [ dirname(source_ref.getFilename()) ], source_ref = source_ref, user_provided = True ) else: path_value = ExpressionMakeList( elements = ( ExpressionCallNoKeywords( called = ExpressionAttributeLookup( source = ExpressionImportModuleHard( module_name = "os", import_name = "path", source_ref = source_ref ), attribute_name = "dirname", source_ref = source_ref ), args = ExpressionMakeTuple( elements = ( ExpressionModuleFileAttributeRef( source_ref = source_ref, ), ), source_ref = source_ref, ), source_ref = source_ref, ), ), source_ref = source_ref ) return StatementAssignmentVariable( variable_ref = ExpressionTargetVariableRef( variable_name = "__path__", source_ref = source_ref ), source = path_value, source_ref = source_ref )