(cls, file_path: Union[str, Path])
Instantiate the config from the given file path

        Files ending in `.json` will be parsed as JSON, otherwise the
        file will be parsed as YAML.
Instantiate the config from the given file path
Instantiate the config from the given file path
def load_file(cls, file_path: Union[str, Path]):
        """Instantiate the config from the given file path

        Files ending in `.json` will be parsed as JSON, otherwise the
        file will be parsed as YAML.
        """

        if str(file_path).startswith("http://") or str(file_path).startswith("https://"):
            response = urllib.request.urlopen(file_path, timeout=5)
            encoded_config = response.read()
            if "json" in response.headers.get("Content-Type") or file_path.endswith(".json"):
                return cls.load_json(encoded_config)
            else:
                return cls.load_yaml(encoded_config)
        else:
            file_path = Path(file_path)
            encoded_config = file_path.read_text(encoding="utf8")

            if file_path.name.endswith(".json"):
                return cls.load_json(encoded_config)
            else:
                return cls.load_yaml(encoded_config)
def load_file ( cls , file_path : Union [ str , Path ] ) : if str ( file_path ) . startswith ( "http://" ) or str ( file_path ) . startswith ( "https://" ) : response = urllib . request . urlopen ( file_path , timeout = 5 ) encoded_config = response . read ( ) if "json" in response . headers . get ( "Content-Type" ) or file_path . endswith ( ".json" ) : return cls . load_json ( encoded_config ) else : return cls . load_yaml ( encoded_config ) else : file_path = Path ( file_path ) encoded_config = file_path . read_text ( encoding = "utf8" ) if file_path . name . endswith ( ".json" ) : return cls . load_json ( encoded_config ) else : return cls . load_yaml ( encoded_config )