def test_yaml_save_load_roundtrip(extension): data = {'some': ['data']} with NamedTemporaryFile() as f: path = Path(f.name).with_suffix(extension) save_to_yaml(data, path) f.flush() data_deserialized = load_yaml(path) assert data == data_deserialized
def to_yaml(self, path: Pathlike): save_to_yaml(asdict(self), path)
def to_yaml(self, path: Pathlike): data = asdict(self.config) data['feature_type'] = self.name # Insert the typename for config readability save_to_yaml(data, path=path)
def to_yaml(self, path: Pathlike): data = [asdict(r) for r in self] save_to_yaml(data, path)
def to_yaml(self, path: Pathlike): data = [asdict_nonull(s) for s in self] save_to_yaml(data, path)
def to_yaml(self, path: Pathlike): data = [{ **asdict_nonull(cut), 'type': type(cut).__name__ } for cut in self] save_to_yaml(data, path)