mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-24 07:53:30 +08:00
update dummymodule.py
This commit is contained in:
parent
edf35e2d59
commit
45cf54fda9
@ -1 +1 @@
|
||||
144616568017325747730083301686242056706
|
||||
191473689765959071642564573343309028448
|
||||
File diff suppressed because it is too large
Load Diff
@ -417,7 +417,8 @@ PyMethodDef PythonClassInputDevice::tp_methods[] = {
|
||||
{"exists", (PyCFunction)Exists, METH_NOARGS,
|
||||
"exists() -> bool\n"
|
||||
"\n"
|
||||
"Return whether the underlying device for this object is still present."},
|
||||
"Return whether the underlying device for this object is\n"
|
||||
"still present.\n"},
|
||||
{"get_button_name", (PyCFunction)GetButtonName,
|
||||
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise ops)
|
||||
"get_button_name(button_id: int) -> ba.Lstr\n"
|
||||
|
||||
@ -404,7 +404,8 @@ PyMethodDef PythonClassNode::tp_methods[] = {
|
||||
{"getdelegate", (PyCFunction)GetDelegate, METH_VARARGS | METH_KEYWORDS,
|
||||
"getdelegate(type: type, doraise: bool = False) -> <varies>\n"
|
||||
"\n"
|
||||
"Return the node's current delegate object if it matches a certain type.\n"
|
||||
"Return the node's current delegate object if it matches\n"
|
||||
"a certain type.\n"
|
||||
"\n"
|
||||
"If the node has no delegate or it is not an instance of the passed\n"
|
||||
"type, then None will be returned. If 'doraise' is True, then an\n"
|
||||
@ -437,12 +438,12 @@ PyMethodDef PythonClassNode::tp_methods[] = {
|
||||
{"connectattr", (PyCFunction)ConnectAttr, METH_VARARGS,
|
||||
"connectattr(srcattr: str, dstnode: Node, dstattr: str) -> None\n"
|
||||
"\n"
|
||||
"Connect one of this node's attributes to an attribute on another node.\n"
|
||||
"This will immediately set the target attribute's value to that of the\n"
|
||||
"source attribute, and will continue to do so once per step as long as\n"
|
||||
"the two nodes exist. The connection can be severed by setting the\n"
|
||||
"target attribute to any value or connecting another node attribute\n"
|
||||
"to it.\n"
|
||||
"Connect one of this node's attributes to an attribute on another\n"
|
||||
"node. This will immediately set the target attribute's value to that\n"
|
||||
"of the source attribute, and will continue to do so once per step\n"
|
||||
"as long as the two nodes exist. The connection can be severed by\n"
|
||||
"setting the target attribute to any value or connecting another\n"
|
||||
"node attribute to it.\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
" Create a locator and attach a light to it:\n"
|
||||
|
||||
@ -733,7 +733,8 @@ PyMethodDef PythonClassSessionPlayer::tp_methods[] = {
|
||||
{"get_icon", (PyCFunction)GetIcon, METH_NOARGS,
|
||||
"get_icon() -> dict[str, Any]\n"
|
||||
"\n"
|
||||
"Returns the character's icon (images, colors, etc contained in a dict)"},
|
||||
"Returns the character's icon (images, colors, etc contained\n"
|
||||
"in a dict."},
|
||||
{"get_icon_info", (PyCFunction)GetIconInfo, METH_NOARGS,
|
||||
"get_icon_info() -> dict[str, Any]\n"
|
||||
"\n"
|
||||
|
||||
@ -260,9 +260,9 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
||||
{"get_widget_type", (PyCFunction)GetWidgetType, METH_NOARGS,
|
||||
"get_widget_type() -> str\n"
|
||||
"\n"
|
||||
"Return the internal type of the Widget as a string. Note that this is\n"
|
||||
"different from the Python ba.Widget type, which is the same for all\n"
|
||||
"widgets."},
|
||||
"Return the internal type of the Widget as a string. Note that this\n"
|
||||
"is different from the Python ba.Widget type, which is the same for\n"
|
||||
"all widgets."},
|
||||
{"activate", (PyCFunction)Activate, METH_NOARGS,
|
||||
"activate() -> None\n"
|
||||
"\n"
|
||||
@ -274,9 +274,9 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
||||
{"get_screen_space_center", (PyCFunction)GetScreenSpaceCenter, METH_NOARGS,
|
||||
"get_screen_space_center() -> tuple[float, float]\n"
|
||||
"\n"
|
||||
"Returns the coords of the Widget center relative to the center of the\n"
|
||||
"screen. This can be useful for placing pop-up windows and other special\n"
|
||||
"cases."},
|
||||
"Returns the coords of the ba.Widget center relative to the center\n"
|
||||
"of the screen. This can be useful for placing pop-up windows and other\n"
|
||||
"special cases."},
|
||||
{"get_selected_child", (PyCFunction)GetSelectedChild, METH_NOARGS,
|
||||
"get_selected_child() -> Optional[ba.Widget]\n"
|
||||
"\n"
|
||||
@ -285,8 +285,8 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
||||
{"delete", (PyCFunction)Delete, METH_VARARGS | METH_KEYWORDS,
|
||||
"delete(ignore_missing: bool = True) -> None\n"
|
||||
"\n"
|
||||
"Delete the Widget. Ignores already-deleted Widgets if ignore_missing\n"
|
||||
" is True; otherwise an Exception is thrown."},
|
||||
"Delete the Widget. Ignores already-deleted Widgets if ignore_missing\n"
|
||||
"is True; otherwise an Exception is thrown."},
|
||||
{"add_delete_callback", (PyCFunction)AddDeleteCallback,
|
||||
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise stuff)
|
||||
"add_delete_callback(call: Callable) -> None\n"
|
||||
|
||||
@ -21,7 +21,7 @@ from efrotools import get_files_hash
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from types import ModuleType
|
||||
from typing import Sequence, Any
|
||||
from typing import Sequence, Any, Optional
|
||||
from batools.docs import AttributeInfo
|
||||
|
||||
|
||||
@ -252,7 +252,7 @@ def _writefuncs(parent: Any, funcnames: Sequence[str], indent: int,
|
||||
f'unknown returns value: {returns} for {funcname}')
|
||||
returnspc = indstr + ' '
|
||||
returnstr = ('\n' + returnspc).join(returnstr.strip().splitlines())
|
||||
docstr_out = _formatdoc(docstr, indent + 4)
|
||||
docstr_out = _formatdoc(docstr, indent + 4, funcname=funcname)
|
||||
out += spcstr + defsline + docstr_out + f'{returnspc}{returnstr}\n'
|
||||
return out
|
||||
|
||||
@ -470,10 +470,20 @@ def _special_class_cases(classname: str) -> str:
|
||||
return out
|
||||
|
||||
|
||||
def _formatdoc(docstr: str, indent: int) -> str:
|
||||
def _formatdoc(docstr: str,
|
||||
indent: int,
|
||||
funcname: Optional[str] = None) -> str:
|
||||
out = ''
|
||||
indentstr = indent * ' '
|
||||
docslines = docstr.splitlines()
|
||||
|
||||
if (funcname and docslines and docslines[0]
|
||||
and docslines[0].startswith(funcname)):
|
||||
# Remove this signature from python docstring
|
||||
# as not to repeat ourselves.
|
||||
_, docstr = docstr.split('\n\n', maxsplit=1)
|
||||
docslines = docstr.splitlines()
|
||||
|
||||
if len(docslines) == 1:
|
||||
out += '\n' + indentstr + '"""' + docslines[0] + '"""\n'
|
||||
else:
|
||||
@ -503,7 +513,8 @@ def _writeclasses(module: ModuleType, classnames: Sequence[str]) -> str:
|
||||
out += f'class {classname}:\n'
|
||||
|
||||
docstr = cls.__doc__
|
||||
out += _formatdoc(docstr, 4)
|
||||
# classname is constructor name
|
||||
out += _formatdoc(docstr, 4, funcname=classname)
|
||||
|
||||
# Create a public constructor if it has one.
|
||||
# If the first docs line appears to be a function signature
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user