You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Javier A Gonzalez Trejo (JIRA)" <ji...@apache.org> on 2018/10/07 00:57:00 UTC

[jira] [Commented] (BEAM-1081) annotations should support custom messages and classes

    [ https://issues.apache.org/jira/browse/BEAM-1081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16640946#comment-16640946 ] 

Javier A Gonzalez Trejo commented on BEAM-1081:
-----------------------------------------------

Hi.

I having trouble on how this issue should be resolved. I modified the annotation test code to use a class as follows.

def test_deprecated_with_since_current_message_class(self):
    with warnings.catch_warnings(record=True) as w:
      @deprecated(since='v.1', current='multiply', extra_message='Do this')
      class class_test_deprecated_with_since_current_message:
        fooo = 'lol'
        def foo(self):
          return 'lol'
      foo = class_test_deprecated_with_since_current_message()
      self.check_annotation(
          warning=w, warning_size=1,
          warning_type=DeprecationWarning,
          fnc_name='class_test_deprecated_with_since_current_message',
          annotation_type='deprecated',
          label_check_list=[('since', True),
                            ('instead', True),
                            ('Do this', True)])

And it seems to work. My question is. How the annotation decorators must behave using them against a class?

> annotations should support custom messages and classes
> ------------------------------------------------------
>
>                 Key: BEAM-1081
>                 URL: https://issues.apache.org/jira/browse/BEAM-1081
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Ahmet Altay
>            Priority: Minor
>              Labels: newbie, starter
>
> Update https://github.com/apache/incubator-beam/blob/python-sdk/sdks/python/apache_beam/utils/annotations.py to add 2 new features:
> 1. ability to customize message
> 2. ability to tag classes (not only functions)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)