# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Data.TextLoader
"""


from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist


def data_textloader(
        input_file,
        arguments=0,
        data=None,
        **params):
    """
    **Description**
        Import a dataset from a text file

    :param input_file: Location of the input file (inputs).
    :param arguments: Arguments (inputs).
    :param data: The resulting data view (outputs).
    """

    entrypoint_name = 'Data.TextLoader'
    inputs = {}
    outputs = {}

    if input_file is not None:
        inputs['InputFile'] = try_set(
            obj=input_file,
            none_acceptable=False,
            is_of_type=str)
    if arguments is not None:
        inputs['Arguments'] = try_set(
            obj=arguments,
            none_acceptable=False,
            is_of_type=dict,
            field_names=[
                'Column',
                'UseThreads',
                'HeaderFile',
                'MaxRows',
                'AllowQuoting',
                'AllowSparse',
                'InputSize',
                'Separator',
                'TrimWhitespace',
                'HasHeader'])
    if data is not None:
        outputs['Data'] = try_set(
            obj=data,
            none_acceptable=False,
            is_of_type=str)

    input_variables = {
        x for x in unlist(inputs.values())
        if isinstance(x, str) and x.startswith("$")}
    output_variables = {
        x for x in unlist(outputs.values())
        if isinstance(x, str) and x.startswith("$")}

    entrypoint = EntryPoint(
        name=entrypoint_name, inputs=inputs, outputs=outputs,
        input_variables=input_variables,
        output_variables=output_variables)
    return entrypoint
