Example #1
0
def resources(tmpdir_factory):
    """Set up."""
    r = namedtuple("resources", "data_root")
    r.data_root = "./data"
    r.raw_root = "%s/raw/" % r.data_root
    r.dataset_list = list(
        collect_tools.find_all_files_by_name("data/raw/", "*", depth=1))
    return r
Example #2
0
 def _files_exists(self, directory_path, file_pattern):
     """Verify if a file exists and is the unique file of that kind in the folder."""
     file_search = find_all_files_by_name(directory_path, file_pattern)
     if len(file_search) == 0:
         return False
     elif len(file_search) == 1:
         return file_search[0]
     else:
         return file_search
         warnings.warn("There are more than one %s file in this site." % file_pattern)
Example #3
0
 def _files_exists(self, directory_path, file_pattern):
     """Verify if a file exists and is the unique file of that kind in the folder."""
     file_search = find_all_files_by_name(directory_path, file_pattern)
     if len(file_search) == 0:
         return False
     elif len(file_search) == 1:
         return file_search[0]
     elif len(file_search) >= 1:
         error_str = "\n".join([str(p) for p in file_search])
         warnings.warn(
             f"There are multiple mclf*.csv files at {directory_path}.\n"
             "Rename undesired mclf files you want to ignore or specify mclf_path.\n"
             f"MCLF files found:\n{error_str}\nUsing: {file_search[0]}")
         return file_search[0]