arkouda.io_util =============== .. py:module:: arkouda.io_util Functions --------- .. autoapisummary:: arkouda.io_util.delete_directory arkouda.io_util.delimited_file_to_dict arkouda.io_util.dict_to_delimited_file arkouda.io_util.get_directory arkouda.io_util.write_line_to_file Package Contents ---------------- .. py:function:: delete_directory(dir: str) -> None Delete the directory if it exists. :param dir: The path to the directory :type dir: str :raises OSError: Raised if there's an error in deleting the directory. .. py:function:: delimited_file_to_dict(path: str, delimiter: str = ',') -> Dict[str, str] Return a dictionary populated by lines from a file. Return a dictionary populated by lines from a file where the first delimited element of each line is the key and the second delimited element is the value. If the file does not exist, return an empty dictionary. :param path: Path to the file :type path: str :param delimiter: Delimiter separating key and value :type delimiter: str :returns: Dictionary containing key,value pairs derived from each line of delimited strings :rtype: Mapping[str,str] :raises UnsupportedOperation: Raised if there's an error in reading the file :raises ValueError: Raised if a line has more or fewer than two delimited elements .. py:function:: dict_to_delimited_file(path: str, values: Mapping[Any, Any], delimiter: str = ',') -> None Write a dictionary to delimited lines in a file. Write a dictionary to delimited lines in a file where the first delimited element of each line is the dict key and the second delimited element is the dict value. If the file does not exist, it is created and then written to. :param path: Path to the file :type path: str :param delimiter: Delimiter separating key and value :raises OError: Raised if there's an error opening or writing to the specified file :raises ValueError: Raised if the delimiter is not supported .. py:function:: get_directory(path: str) -> pathlib.Path Create the directory if it does not exist and returns the corresponding Path object. :param path: The path to the directory :type path: str :returns: Object corresponding to the directory :rtype: Path :raises ValueError: Raised if there's an error in reading an existing directory or creating a new one .. py:function:: write_line_to_file(path: str, line: str) -> None Write a line to the requested file. Note: if the file does not exist, the file is created first and then the specified line is written to it. :param path: Path to the target file :type path: str :param line: Line to be written to the file :type line: str :raises UnsupportedOption: Raised if there's an error in creating or writing to the file