(cls, file_obj)
Load a config from a YAML file or a Python source file.
Load a config from a YAML file or a Python source file.
Load a config from a YAML file or a Python source file .
def _load_cfg_from_file(cls, file_obj):
        """Load a config from a YAML file or a Python source file."""
        _, file_extension = os.path.splitext(file_obj.name)
        if file_extension in _YAML_EXTS:
            return cls._load_cfg_from_yaml_str(file_obj.read())
        elif file_extension in _PY_EXTS:
            return cls._load_cfg_py_source(file_obj.name)
        else:
            raise Exception(
                "Attempt to load from an unsupported file type {}; "
                "only {} are supported".format(file_obj, _YAML_EXTS.union(_PY_EXTS))
            )
def _load_cfg_from_file ( cls , file_obj ) : _ , file_extension = os . path . splitext ( file_obj . name ) if file_extension in _YAML_EXTS : return cls . _load_cfg_from_yaml_str ( file_obj . read ( ) ) elif file_extension in _PY_EXTS : return cls . _load_cfg_py_source ( file_obj . name ) else : raise Exception ( "Attempt to load from an unsupported file type {}; " "only {} are supported" . format ( file_obj , _YAML_EXTS . union ( _PY_EXTS ) ) )