Skip to content

Commit

Permalink
Merge pull request #339 from sneakers-the-rat/fix-deprecation-warnings
Browse files Browse the repository at this point in the history
Fix deprecation warning - use model_dump not dict
  • Loading branch information
cmungall authored Aug 29, 2024
2 parents 9fd5a3e + e698170 commit 6ba1b0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linkml_runtime/dumpers/yaml_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def dumps(self, element: Union[BaseModel, YAMLRoot], **kwargs) -> str:
# Internal note: remove_empty_items will also convert Decimals to int/float;
# this is necessary until https://github.com/yaml/pyyaml/pull/372 is merged

dumper_safe_element = element.dict() if isinstance(element, BaseModel) else element
dumper_safe_element = element.model_dump() if isinstance(element, BaseModel) else element
return yaml.dump(remove_empty_items(dumper_safe_element, hide_protected_keys=True),
Dumper=yaml.SafeDumper, sort_keys=False,
allow_unicode=True,
Expand Down

0 comments on commit 6ba1b0b

Please sign in to comment.