Dump to a string.
(self, **kwargs)
| 186 | return "{}({})".format(self.__class__.__name__, super(CfgNode, self).__repr__()) |
| 187 | |
| 188 | def dump(self, **kwargs): |
| 189 | """Dump to a string.""" |
| 190 | |
| 191 | def convert_to_dict(cfg_node, key_list): |
| 192 | if not isinstance(cfg_node, CfgNode): |
| 193 | _assert_with_logging( |
| 194 | _valid_type(cfg_node), |
| 195 | "Key {} with value {} is not a valid type; valid types: {}".format( |
| 196 | ".".join(key_list), type(cfg_node), _VALID_TYPES |
| 197 | ), |
| 198 | ) |
| 199 | return cfg_node |
| 200 | else: |
| 201 | cfg_dict = dict(cfg_node) |
| 202 | for k, v in cfg_dict.items(): |
| 203 | cfg_dict[k] = convert_to_dict(v, key_list + [k]) |
| 204 | return cfg_dict |
| 205 | |
| 206 | self_as_dict = convert_to_dict(self, []) |
| 207 | return yaml.safe_dump(self_as_dict, **kwargs) |
| 208 | |
| 209 | def merge_from_file(self, cfg_filename): |
| 210 | """Load a yaml config file and merge it this CfgNode.""" |
nothing calls this directly
no outgoing calls
no test coverage detected