(cls, filename)
return cls(module.cfg)
Load a config from a Python source file.
Load a config from a Python source file.
Load a config from a Python source file .
def _load_cfg_py_source(cls, filename):
        """Load a config from a Python source file."""
        module = _load_module_from_file("yacs.config.override", filename)
        _assert_with_logging(
            hasattr(module, "cfg"),
            "Python module from file {} must have 'cfg' attr".format(filename),
        )
        VALID_ATTR_TYPES = {dict, CfgNode}
        _assert_with_logging(
            type(module.cfg) in VALID_ATTR_TYPES,
            "Imported module 'cfg' attr must be in {} but is {} instead".format(
                VALID_ATTR_TYPES, type(module.cfg)
            ),
        )
        return cls(module.cfg)
def _load_cfg_py_source ( cls , filename ) : module = _load_module_from_file ( "yacs.config.override" , filename ) _assert_with_logging ( hasattr ( module , "cfg" ) , "Python module from file {} must have 'cfg' attr" . format ( filename ) , ) VALID_ATTR_TYPES = { dict , CfgNode } _assert_with_logging ( type ( module . cfg ) in VALID_ATTR_TYPES , "Imported module 'cfg' attr must be in {} but is {} instead" . format ( VALID_ATTR_TYPES , type ( module . cfg ) ) , ) return cls ( module . cfg )