Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python eossdk_utils.py debug_fn to return function values #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpsenior
Copy link
Contributor

A @debug_fn wrapped function should also return the result of the function it executes, otherwise it returns None.

class SomeAgent(eossdk.IntfHandler):
    def __init__(self, sdk):
        self.intf_mgr = sdk.get_intf_mgr()
        self.tracer = eossdk.Tracer('debug_fn_sample')
        eossdk.IntfHandler.__init__(self, self.intf_mgr)

    @debug_fn
    def get_value(self):
        return 'foo'

    def on_oper_status(self, intf_id_t, oper_status_t):
        value = self.get_value()  # returns None.
        assert value == 'foo'

A @debug_fn wrapped function should also return the result of the function it executes, otherwise it returns None.

class SomeAgent(eossdk.IntfHandler):
    def __init__(self, sdk):
        self.intf_mgr = sdk.get_intf_mgr()
        self.tracer = eossdk.Tracer('debug_fn_sample')
        eossdk.IntfHandler.__init__(self, self.intf_mgr)

    @debug_fn
    def get_value(self):
        return 'foo'

    def on_oper_status(self, intf_id_t, oper_status_t):
        value = self.get_value()  # returns None.
        assert value == 'foo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant