Skip to content

Commit 549c7ca

Browse files
committed
try to fix docstring
1 parent ca28e96 commit 549c7ca

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

opto/trace/bundle.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -522,27 +522,22 @@ def generate_comment(self, code: str, comment: str, comment_line_number: int, ba
522522

523523
def get_source(self, obj: Any, bug_mode=False):
524524
""" Get the source code of the function and its line number, excluding the @bundle decorator line.
525-
526-
Allowable two types of usages:
527-
528-
Decorator style:
529-
530-
@blah
531-
...
532-
@bundle # or @ ....bundle()
533-
...
534-
def fun(...): # ...
535-
....
536-
537-
538-
or inline usage
539-
540-
bundle()(fun) # or ....bundle()(fun)
541-
542525
bug_mode=True means
543526
We are in the forward() function, but there is an error during execution.
544527
The error can be caused by a lambda function which does not have `def` in the source code.
545528
We turn off the error raising in the end of this function.
529+
530+
Allowable two types of usages:
531+
532+
Examples:
533+
534+
>>> @blah
535+
>>> ...
536+
>>> @bundle # or @ ....bundle()
537+
>>> def fun(...): # ...
538+
>>> ....
539+
or inline usage
540+
>>> bundle()(fun) # or ....bundle()(fun)
546541
"""
547542
source = inspect.getsource(obj) # the source includes @bundle, or @trace.bundle, etc. we will remove those parts.
548543
line_number = int(inspect.getsourcelines(obj)[1]) # line number of obj

opto/trace/nodes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,11 +2007,11 @@ class MessageNode(Node[T]):
20072007
20082008
Examples:
20092009
>>> MessageNode(node_a, inputs=[node_a],
2010-
description="[identity] This is an identity operator.")
2010+
>>> description="[identity] This is an identity operator.")
20112011
>>> MessageNode(copy_node_a, inputs=[node_a],
2012-
description="[copy] This is a copy operator.")
2012+
>>> description="[copy] This is a copy operator.")
20132013
>>> MessageNode(1, inputs={'a':node_a, 'b':node_b},
2014-
description="[Add] This is an add operator of a and b.")
2014+
>>> description="[Add] This is an add operator of a and b.")
20152015
20162016
Attributes:
20172017
value: The output value of the operator

0 commit comments

Comments
 (0)