def parse(self, file_location): """ Reads in EVIL format from disk, searches the first line of data for clues as to the data type. If there are = or , in the first line it assumes its a list of dict, if . then float, and if none of the above pure bool. If it doesn't work, perhaps use CSV? Args: file_location (str): The location of the file that needs to be read in from the disk. Returns: numpy.ndarray: The data that was parsed from the disk. """ validator = k_read_tests.EVILDataTest() validator.quick_test(file_location) if validator.evil_type == "DictOfArrays": parser = DictOfArrays() elif validator.evil_type == "ListOfFloats": parser = ListOfFloats() elif validator.evil_type == "ListOfBools": parser = ListOfBooleans() return parser.parse(file_location)
def _set_data_type(self): """ Sets self._file_data_type using the validator object. Mostly Accurate. """ validator = k_read_tests.EVILDataTest() validator.quick_test(self._the_file) self._file_data_type = validator.evil_type
def EVILValidator_CheckType_ReturnType(data, expected_value): """ Wrapper around Validator method to reduce code reuse. Args: data (str): The location of the file to parse expected_value (str): The expected data type to be returned from the validator """ evil_validator_test = k_read_tests.EVILDataTest() evil_validator_test.quick_test(data) value = evil_validator_test.evil_type assert value == expected_value
def data_test(): return k_read_tests.EVILDataTest()
def get_plugin_read_test(self): return k_read_tests.EVILDataTest()