def __init__(self,  # pylint: disable=too-many-arguments
                 output_dir: str, output_file: str="training.csv", delimiter: str=',',
                 default_value: str='', variables: Optional[Iterable[str]]=None, on_unknown_type: str='default',
                 on_missing_variable: str='error', **kwargs):
        """
        :param output_dir: directory to save the output CSV
        :param output_file: name of the output CSV file
        :param delimiter: CSV delimiter
        :param default_value: default value to supplement missing variables
        :param variables: subset of variable names to be written (all the variables are written by default)
        :param on_unknown_type: an action to be taken if the variable value type is not supported (e.g. a list)
        :param on_missing_variable: an action to be taken if the variable is specified but not provided
        """
        super().__init__(**kwargs)

        assert on_unknown_type in WriteCSV.UNKNOWN_TYPE_ACTIONS
        assert on_missing_variable in WriteCSV.MISSING_VARIABLE_ACTIONS

        self._variables = variables
        self._streams = None
        self._on_unknown_type = on_unknown_type
        self._on_missing_variable = on_missing_variable
        self._delimiter = delimiter
        self._default_value = default_value
        self._header_written = False

        self._file_path = path.join(output_dir, output_file)
        logging.debug('CSV output file "%s"', self._file_path)
def __init__ ( self , output_dir : str , output_file : str = "training.csv" , delimiter : str = ',' , default_value : str = '' , variables : Optional [ Iterable [ str ] ] = None , on_unknown_type : str = 'default' , on_missing_variable : str = 'error' , ** kwargs ) : super ( ) . __init__ ( ** kwargs ) assert on_unknown_type in WriteCSV . UNKNOWN_TYPE_ACTIONS assert on_missing_variable in WriteCSV . MISSING_VARIABLE_ACTIONS self . _variables = variables self . _streams = None self . _on_unknown_type = on_unknown_type self . _on_missing_variable = on_missing_variable self . _delimiter = delimiter self . _default_value = default_value self . _header_written = False self . _file_path = path . join ( output_dir , output_file ) logging . debug ( 'CSV output file "%s"' , self . _file_path )
:param output_dir: directory to save the output CSV
        :param output_file: name of the output CSV file
        :param delimiter: CSV delimiter
        :param default_value: default value to supplement missing variables
        :param variables: subset of variable names to be written (all the variables are written by default)
        :param on_unknown_type: an action to be taken if the variable value type is not supported (e.g. a list)
        :param on_missing_variable: an action to be taken if the variable is specified but not provided