You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep filtering out single newlines (which are used to wrap a single line in the Python docstring), but treat double newlines as a newline in the JSON doc string. For example, given the following Python function:
defexample1():
"""This is an example docstring. This first line wraps since it's too long to fit in a single line of source code. This is a second line. """pass
We should produce this JSON string:
"This is an example docstring. This first line wraps since it's too long to fit in a single line of source code.\nThis is a second line."
Right now, there is no way to populate the description fields of arguments or return values. I propose that we adopt some way to parse a Python docstring and extract information about these fields, using the existing Python docstring conventions. For example, given the following Python function:
defexample2(a: abi.Uint8, b: abi.Uint32, *, output: abi.Uint64):
"""This is a second example docstring. Args: a: A description for the first argument. b: A description for the second argument. Returns: A description for the return value. """pass
We should produce the following method JSON:
{
"name": "example2",
"args": [
{
"type": "uint8",
"name": "a",
"desc": "A description for the first argument."
},
{
"type": "uint32",
"name": "b",
"desc": "A description for the second argument."
}
],
"returns": {
"type": "uint64",
"desc": "A description for the return value."
},
"desc": "This is a second example docstring."
}
The text was updated successfully, but these errors were encountered:
Currently, the JSON description field for an ABI method is simply the method's Python docstring, with all newlines turned into spaces:
pyteal/pyteal/ast/subroutine.py
Lines 630 to 637 in a66907e
This can be improved in a few ways:
We should produce this JSON string:
"This is an example docstring. This first line wraps since it's too long to fit in a single line of source code.\nThis is a second line."
We should produce the following method JSON:
The text was updated successfully, but these errors were encountered: