countrynames/__init__.py
def _load_data() -> None:
    """Load known aliases from a YAML file. Internal."""
    data_file = os.path.join(os.path.dirname(__file__), "data.yaml")
    with open(data_file, "r", encoding="utf-8") as fh:
        for code, names in yaml.load(fh, Loader=Loader).items():
            code = code.strip().upper()
            name = _normalize_name(code)
            if name is not None:
                COUNTRY_NAMES[name] = code
            for name in names:
                alias = _normalize_name(name)
                if alias is not None:
                    COUNTRY_NAMES[alias] = code
Load known aliases from a YAML file. Internal.
Load known aliases from a YAML file. Internal.
Load known aliases from a YAML file . Internal .
def _load_data() -> None:
    data_file = os.path.join(os.path.dirname(__file__), "data.yaml")
    with open(data_file, "r", encoding="utf-8") as fh:
        for code, names in yaml.load(fh, Loader=Loader).items():
            code = code.strip().upper()
            name = _normalize_name(code)
            if name is not None:
                COUNTRY_NAMES[name] = code
            for name in names:
                alias = _normalize_name(name)
                if alias is not None:
                    COUNTRY_NAMES[alias] = code
def _load_data ( ) -> None : data_file = os . path . join ( os . path . dirname ( __file__ ) , "data.yaml" ) with open ( data_file , "r" , encoding = "utf-8" ) as fh : for code , names in yaml . load ( fh , Loader = Loader ) . items ( ) : code = code . strip ( ) . upper ( ) name = _normalize_name ( code ) if name is not None : COUNTRY_NAMES [ name ] = code for name in names : alias = _normalize_name ( name ) if alias is not None : COUNTRY_NAMES [ alias ] = code
Load known aliases from a YAML file.
Load known aliases from a YAML file .
"""Load known aliases from a YAML file. Internal."""