Skip to content

Commit

Permalink
Merge pull request #8 from yahoo/informative_names
Browse files Browse the repository at this point in the history
Informative names
  • Loading branch information
huyng authored Dec 15, 2017
2 parents d7039f8 + dcd3001 commit 708eb1f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions graphkit/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ def __setstate__(self, state):
self.__setattr__(k, state[k])
self._after_init()

def __repr__(self):
"""
Display more informative names for the Operation class
"""
return u"%s(name='%s', needs=%s, provides=%s)" % \
(self.__class__.__name__,
self.name,
self.needs,
self.provides)


class NetworkOperation(Operation):
def __init__(self, **kwargs):
Expand Down
13 changes: 13 additions & 0 deletions graphkit/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ def myadd(a, b):

return FunctionalOperation(**total_kwargs)

def __repr__(self):
"""
Display more informative names for the Operation class
"""
return u"%s(name='%s', needs=%s, provides=%s, fn=%s)" % \
(self.__class__.__name__,
self.name,
self.needs,
self.provides,
self.fn.__name__)




class compose(object):
"""
Expand Down

0 comments on commit 708eb1f

Please sign in to comment.