geopop.py
def parse_ini(region=None):
    """Parse configurations from .ini file."""
    logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}")
    hexpop.initialize_logging(logger)
    ini = configparser.ConfigParser()
    ini.read(pathlib.Path(__file__).with_suffix('.ini'))
    if not region:
        return ini.sections()
    params = SimpleNamespace()
    try:
        params.geo_query = ini.get(region, 'geo_query')
    except (configparser.NoSectionError, configparser.NoOptionError):
        logger.critical("no valid geo_query for region %s", region)
    try:
        params.sem_admin = ini.get(region, 'sem_admin')
        params.sem_code = ini.get(region, 'sem_code')
        params.sem_name = ini.get(region, 'sem_name')
        params.sem_geom = ini.get(region, 'sem_geom')
        params.sem_geom_include = ini.getboolean(region, 'sem_geom_include')
        params.sem_source = ini.get(region, 'sem_source')
        params.bis_admin = ini.get(region, 'bis_admin')
        params.bis_code = ini.get(region, 'bis_code')
        params.bis_name = ini.get(region, 'bis_name')
        params.bis_geom = ini.get(region, 'bis_geom')
        params.bis_geom_include = ini.getboolean(region, 'bis_geom_include')
        params.bis_source = ini.get(region, 'bis_source')
    except (configparser.NoSectionError, configparser.NoOptionError):
        logger.critical("no valid sem/bis for region %s", region)
    return params
Parse configurations from .ini file.
Parse configurations from .ini file.
Parse configurations from . ini file .
def parse_ini(region=None):
    logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}")
    hexpop.initialize_logging(logger)
    ini = configparser.ConfigParser()
    ini.read(pathlib.Path(__file__).with_suffix('.ini'))
    if not region:
        return ini.sections()
    params = SimpleNamespace()
    try:
        params.geo_query = ini.get(region, 'geo_query')
    except (configparser.NoSectionError, configparser.NoOptionError):
        logger.critical("no valid geo_query for region %s", region)
    try:
        params.sem_admin = ini.get(region, 'sem_admin')
        params.sem_code = ini.get(region, 'sem_code')
        params.sem_name = ini.get(region, 'sem_name')
        params.sem_geom = ini.get(region, 'sem_geom')
        params.sem_geom_include = ini.getboolean(region, 'sem_geom_include')
        params.sem_source = ini.get(region, 'sem_source')
        params.bis_admin = ini.get(region, 'bis_admin')
        params.bis_code = ini.get(region, 'bis_code')
        params.bis_name = ini.get(region, 'bis_name')
        params.bis_geom = ini.get(region, 'bis_geom')
        params.bis_geom_include = ini.getboolean(region, 'bis_geom_include')
        params.bis_source = ini.get(region, 'bis_source')
    except (configparser.NoSectionError, configparser.NoOptionError):
        logger.critical("no valid sem/bis for region %s", region)
    return params
def parse_ini ( region = None ) : logger = logging . getLogger ( f"{__name__}.{sys._getframe().f_code.co_name}" ) hexpop . initialize_logging ( logger ) ini = configparser . ConfigParser ( ) ini . read ( pathlib . Path ( __file__ ) . with_suffix ( '.ini' ) ) if not region : return ini . sections ( ) params = SimpleNamespace ( ) try : params . geo_query = ini . get ( region , 'geo_query' ) except ( configparser . NoSectionError , configparser . NoOptionError ) : logger . critical ( "no valid geo_query for region %s" , region ) try : params . sem_admin = ini . get ( region , 'sem_admin' ) params . sem_code = ini . get ( region , 'sem_code' ) params . sem_name = ini . get ( region , 'sem_name' ) params . sem_geom = ini . get ( region , 'sem_geom' ) params . sem_geom_include = ini . getboolean ( region , 'sem_geom_include' ) params . sem_source = ini . get ( region , 'sem_source' ) params . bis_admin = ini . get ( region , 'bis_admin' ) params . bis_code = ini . get ( region , 'bis_code' ) params . bis_name = ini . get ( region , 'bis_name' ) params . bis_geom = ini . get ( region , 'bis_geom' ) params . bis_geom_include = ini . getboolean ( region , 'bis_geom_include' ) params . bis_source = ini . get ( region , 'bis_source' ) except ( configparser . NoSectionError , configparser . NoOptionError ) : logger . critical ( "no valid sem/bis for region %s" , region ) return params
Parse configurations from .ini file.
Parse configurations from . ini file .
"""Parse configurations from .ini file."""
region