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
"outputs": {
"format": "JSON (Javascript Serialized Object Notion) pretty printed and indented",
"content_type": "application/json; charset=utf-8"
},
"inputs": {
"number": {
"type": "int(x=0) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4"
},
"source": {
"type": "Basic text / string value"
}
}
See "Extending and creating new hug types" in Type annotations in hug and maybe take a look in the types source for more examples.
If you just want to modify the docs
If you simply want to perform additional conversion after a base type is finished, or modify its documentation, the most succinct way is the hug.type decorator:
importhug@hug.type(extend=hug.types.number)defthe_answer(value):
"""My new documentation"""ifvalue!=42:
raiseValueError('Value is not the answer to everything.')
$ python test.py -h
usage: test.py [-h] begin
positional arguments:
begin ISO timestamp to start from
optional arguments:
-h, --help show this help message and exit
Is there any way to simplify this output?
Something like this:
The text was updated successfully, but these errors were encountered: