def get_exiobase_files(path, coefficients=True):
    """ Gets the EXIOBASE files in path (which can be a zip file)

    Parameters
    ----------
    path: str or pathlib.Path
        Path to exiobase files or zip file
    coefficients: boolean, optional
        If True (default), considers the mrIot file as A matrix,
        and the extensions as S matrices. Otherwise as Z and F, respectively

    Returns
    -------
    dict of dict
    """
    path = os.path.normpath(str(path))
    if coefficients:
        exio_core_regex = dict(
            # don’t match file if starting with _
            A=re.compile('(?<!\_)mrIot.*txt'),
            Y=re.compile('(?<!\_)mrFinalDemand.*txt'),
            S_factor_inputs=re.compile('(?<!\_)mrFactorInputs.*txt'),
            S_emissions=re.compile('(?<!\_)mrEmissions.*txt'),
            S_materials=re.compile('(?<!\_)mrMaterials.*txt'),
            S_resources=re.compile('(?<!\_)mrResources.*txt'),
            FY_resources=re.compile('(?<!\_)mrFDResources.*txt'),
            FY_emissions=re.compile('(?<!\_)mrFDEmissions.*txt'),
            FY_materials=re.compile('(?<!\_)mrFDMaterials.*txt'),
            )
    else:
        exio_core_regex = dict(
            # don’t match file if starting with _
            Z=re.compile('(?<!\_)mrIot.*txt'),
            Y=re.compile('(?<!\_)mrFinalDemand.*txt'),
            F_fac=re.compile('(?<!\_)mrFactorInputs.*txt'),
            F_emissions=re.compile('(?<!\_)mrEmissions.*txt'),
            F_materials=re.compile('(?<!\_)mrMaterials.*txt'),
            F_resources=re.compile('(?<!\_)mrResources.*txt'),
            FY_emissions=re.compile('(?<!\_)mrFDEmissions.*txt'),
            FY_materials=re.compile('(?<!\_)mrFDMaterials.*txt'),
            )

    repo_content = get_repo_content(path)

    exio_files = dict()
    for kk, vv in exio_core_regex.items():
        found_file = [vv.search(ff).string for ff in repo_content.filelist
                      if vv.search(ff)]
        if len(found_file) > 1:
            logging.warning(
                "Multiple files found for {}: {}"
                " - USING THE FIRST ONE".format(kk, found_file))
            found_file = found_file[0:1]
        elif len(found_file) == 0:
            continue
        else:
            if repo_content.iszip:
                format_para = sniff_csv_format(found_file[0],
                                               zip_file=path)
            else:
                format_para = sniff_csv_format(os.path.join(path,
                                                            found_file[0]))
            exio_files[kk] = dict(
                root_repo=path,
                file_path=found_file[0],
                version=get_exiobase12_version(
                    os.path.basename(found_file[0])),
                index_rows=format_para['nr_header_row'],
                index_col=format_para['nr_index_col'],
                unit_col=format_para['nr_index_col'] - 1,
                sep=format_para['sep'])

    return exio_files
def get_exiobase_files ( path , coefficients = True ) : path = os . path . normpath ( str ( path ) ) if coefficients : exio_core_regex = dict ( A = re . compile ( '(?<!\_)mrIot.*txt' ) , Y = re . compile ( '(?<!\_)mrFinalDemand.*txt' ) , S_factor_inputs = re . compile ( '(?<!\_)mrFactorInputs.*txt' ) , S_emissions = re . compile ( '(?<!\_)mrEmissions.*txt' ) , S_materials = re . compile ( '(?<!\_)mrMaterials.*txt' ) , S_resources = re . compile ( '(?<!\_)mrResources.*txt' ) , FY_resources = re . compile ( '(?<!\_)mrFDResources.*txt' ) , FY_emissions = re . compile ( '(?<!\_)mrFDEmissions.*txt' ) , FY_materials = re . compile ( '(?<!\_)mrFDMaterials.*txt' ) , ) else : exio_core_regex = dict ( Z = re . compile ( '(?<!\_)mrIot.*txt' ) , Y = re . compile ( '(?<!\_)mrFinalDemand.*txt' ) , F_fac = re . compile ( '(?<!\_)mrFactorInputs.*txt' ) , F_emissions = re . compile ( '(?<!\_)mrEmissions.*txt' ) , F_materials = re . compile ( '(?<!\_)mrMaterials.*txt' ) , F_resources = re . compile ( '(?<!\_)mrResources.*txt' ) , FY_emissions = re . compile ( '(?<!\_)mrFDEmissions.*txt' ) , FY_materials = re . compile ( '(?<!\_)mrFDMaterials.*txt' ) , ) repo_content = get_repo_content ( path ) exio_files = dict ( ) for kk , vv in exio_core_regex . items ( ) : found_file = [ vv . search ( ff ) . string for ff in repo_content . filelist if vv . search ( ff ) ] if len ( found_file ) > 1 : logging . warning ( "Multiple files found for {}: {}" " - USING THE FIRST ONE" . format ( kk , found_file ) ) found_file = found_file [ 0 : 1 ] elif len ( found_file ) == 0 : continue else : if repo_content . iszip : format_para = sniff_csv_format ( found_file [ 0 ] , zip_file = path ) else : format_para = sniff_csv_format ( os . path . join ( path , found_file [ 0 ] ) ) exio_files [ kk ] = dict ( root_repo = path , file_path = found_file [ 0 ] , version = get_exiobase12_version ( os . path . basename ( found_file [ 0 ] ) ) , index_rows = format_para [ 'nr_header_row' ] , index_col = format_para [ 'nr_index_col' ] , unit_col = format_para [ 'nr_index_col' ] - 1 , sep = format_para [ 'sep' ] ) return exio_files
Gets the EXIOBASE files in path (which can be a zip file)

    Parameters
    ----------
    path: str or pathlib.Path
        Path to exiobase files or zip file
    coefficients: boolean, optional
        If True (default), considers the mrIot file as A matrix,
        and the extensions as S matrices. Otherwise as Z and F, respectively

    Returns
    -------
    dict of dict