beam
beam copied to clipboard
annotations should support custom messages and classes
Update https://github.com/apache/incubator-beam/blob/python-sdk/sdks/python/apache_beam/utils/annotations.py to add 2 new features:
- ability to customize message
- ability to tag classes (not only functions)
Imported from Jira BEAM-1081. Original Jira may contain additional context. Reported by: altay.
Both parts of this seem to be done already, by #6670 ("[BEAM-1081] Annotations custom message support and classes tests", merged 2018-10-17):
- Custom messages:
annotate()anddeprecated()inapache_beam/utils/annotations.pytakecustom_message, with%name%,%since%,%current%and%extra%placeholders. - Classes: the decorator patches
__new__when the target is a class, so creating an instance emits the warning. It also adds the deprecation notice to the class docstring.
annotations_test.py covers both, for example test_deprecated_with_class and the custom_message tests. It passes on master at d8eb82acf2c (10 passed). Leaving this here in case it can be closed.
Closing as resolved by #6670 (commit 8142643373).