Skip to content

Commit

Permalink
feat(framework) Introduce a new deprecation function that warns users…
Browse files Browse the repository at this point in the history
… and provides an code example (#3776)

Co-authored-by: Daniel J. Beutel <[email protected]>
  • Loading branch information
jafermarq and danieljanes authored Jul 11, 2024
1 parent 2f2e346 commit ac98491
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/py/flwr/common/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,31 @@ def warn_deprecated_feature(name: str) -> None:
)


def warn_deprecated_feature_with_example(
deprecation_message: str, example_message: str, code_example: str
) -> None:
"""Warn if a feature is deprecated and show code example."""
log(
WARN,
"""DEPRECATED FEATURE: %s
Check the following `FEATURE UPDATE` warning message for the preferred
new mechanism to use this feature in Flower.
""",
deprecation_message,
)
log(
WARN,
"""FEATURE UPDATE: %s
------------------------------------------------------------
%s
------------------------------------------------------------
""",
example_message,
code_example,
)


def warn_unsupported_feature(name: str) -> None:
"""Warn the user when they use an unsupported feature."""
log(
Expand Down

0 comments on commit ac98491

Please sign in to comment.