mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-04 22:43:17 +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", (PyCFunction)Exists, METH_NOARGS,
|
||||||
"exists() -> bool\n"
|
"exists() -> bool\n"
|
||||||
"\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,
|
{"get_button_name", (PyCFunction)GetButtonName,
|
||||||
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise ops)
|
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise ops)
|
||||||
"get_button_name(button_id: int) -> ba.Lstr\n"
|
"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", (PyCFunction)GetDelegate, METH_VARARGS | METH_KEYWORDS,
|
||||||
"getdelegate(type: type, doraise: bool = False) -> <varies>\n"
|
"getdelegate(type: type, doraise: bool = False) -> <varies>\n"
|
||||||
"\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"
|
"\n"
|
||||||
"If the node has no delegate or it is not an instance of the passed\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"
|
"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", (PyCFunction)ConnectAttr, METH_VARARGS,
|
||||||
"connectattr(srcattr: str, dstnode: Node, dstattr: str) -> None\n"
|
"connectattr(srcattr: str, dstnode: Node, dstattr: str) -> None\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Connect one of this node's attributes to an attribute on another node.\n"
|
"Connect one of this node's attributes to an attribute on another\n"
|
||||||
"This will immediately set the target attribute's value to that of the\n"
|
"node. This will immediately set the target attribute's value to that\n"
|
||||||
"source attribute, and will continue to do so once per step as long as\n"
|
"of the source attribute, and will continue to do so once per step\n"
|
||||||
"the two nodes exist. The connection can be severed by setting the\n"
|
"as long as the two nodes exist. The connection can be severed by\n"
|
||||||
"target attribute to any value or connecting another node attribute\n"
|
"setting the target attribute to any value or connecting another\n"
|
||||||
"to it.\n"
|
"node attribute to it.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example:\n"
|
"Example:\n"
|
||||||
" Create a locator and attach a light to it:\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", (PyCFunction)GetIcon, METH_NOARGS,
|
||||||
"get_icon() -> dict[str, Any]\n"
|
"get_icon() -> dict[str, Any]\n"
|
||||||
"\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", (PyCFunction)GetIconInfo, METH_NOARGS,
|
||||||
"get_icon_info() -> dict[str, Any]\n"
|
"get_icon_info() -> dict[str, Any]\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|||||||
@ -260,9 +260,9 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
|||||||
{"get_widget_type", (PyCFunction)GetWidgetType, METH_NOARGS,
|
{"get_widget_type", (PyCFunction)GetWidgetType, METH_NOARGS,
|
||||||
"get_widget_type() -> str\n"
|
"get_widget_type() -> str\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Return the internal type of the Widget as a string. Note that this is\n"
|
"Return the internal type of the Widget as a string. Note that this\n"
|
||||||
"different from the Python ba.Widget type, which is the same for all\n"
|
"is different from the Python ba.Widget type, which is the same for\n"
|
||||||
"widgets."},
|
"all widgets."},
|
||||||
{"activate", (PyCFunction)Activate, METH_NOARGS,
|
{"activate", (PyCFunction)Activate, METH_NOARGS,
|
||||||
"activate() -> None\n"
|
"activate() -> None\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -274,9 +274,9 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
|||||||
{"get_screen_space_center", (PyCFunction)GetScreenSpaceCenter, METH_NOARGS,
|
{"get_screen_space_center", (PyCFunction)GetScreenSpaceCenter, METH_NOARGS,
|
||||||
"get_screen_space_center() -> tuple[float, float]\n"
|
"get_screen_space_center() -> tuple[float, float]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Returns the coords of the Widget center relative to the center of the\n"
|
"Returns the coords of the ba.Widget center relative to the center\n"
|
||||||
"screen. This can be useful for placing pop-up windows and other special\n"
|
"of the screen. This can be useful for placing pop-up windows and other\n"
|
||||||
"cases."},
|
"special cases."},
|
||||||
{"get_selected_child", (PyCFunction)GetSelectedChild, METH_NOARGS,
|
{"get_selected_child", (PyCFunction)GetSelectedChild, METH_NOARGS,
|
||||||
"get_selected_child() -> Optional[ba.Widget]\n"
|
"get_selected_child() -> Optional[ba.Widget]\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -285,8 +285,8 @@ PyMethodDef PythonClassWidget::tp_methods[] = {
|
|||||||
{"delete", (PyCFunction)Delete, METH_VARARGS | METH_KEYWORDS,
|
{"delete", (PyCFunction)Delete, METH_VARARGS | METH_KEYWORDS,
|
||||||
"delete(ignore_missing: bool = True) -> None\n"
|
"delete(ignore_missing: bool = True) -> None\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Delete the Widget. Ignores already-deleted Widgets if ignore_missing\n"
|
"Delete the Widget. Ignores already-deleted Widgets if ignore_missing\n"
|
||||||
" is True; otherwise an Exception is thrown."},
|
"is True; otherwise an Exception is thrown."},
|
||||||
{"add_delete_callback", (PyCFunction)AddDeleteCallback,
|
{"add_delete_callback", (PyCFunction)AddDeleteCallback,
|
||||||
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise stuff)
|
METH_VARARGS | METH_KEYWORDS, // NOLINT (signed bitwise stuff)
|
||||||
"add_delete_callback(call: Callable) -> None\n"
|
"add_delete_callback(call: Callable) -> None\n"
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from efrotools import get_files_hash
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Sequence, Any
|
from typing import Sequence, Any, Optional
|
||||||
from batools.docs import AttributeInfo
|
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}')
|
f'unknown returns value: {returns} for {funcname}')
|
||||||
returnspc = indstr + ' '
|
returnspc = indstr + ' '
|
||||||
returnstr = ('\n' + returnspc).join(returnstr.strip().splitlines())
|
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'
|
out += spcstr + defsline + docstr_out + f'{returnspc}{returnstr}\n'
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@ -470,10 +470,20 @@ def _special_class_cases(classname: str) -> str:
|
|||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def _formatdoc(docstr: str, indent: int) -> str:
|
def _formatdoc(docstr: str,
|
||||||
|
indent: int,
|
||||||
|
funcname: Optional[str] = None) -> str:
|
||||||
out = ''
|
out = ''
|
||||||
indentstr = indent * ' '
|
indentstr = indent * ' '
|
||||||
docslines = docstr.splitlines()
|
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:
|
if len(docslines) == 1:
|
||||||
out += '\n' + indentstr + '"""' + docslines[0] + '"""\n'
|
out += '\n' + indentstr + '"""' + docslines[0] + '"""\n'
|
||||||
else:
|
else:
|
||||||
@ -503,7 +513,8 @@ def _writeclasses(module: ModuleType, classnames: Sequence[str]) -> str:
|
|||||||
out += f'class {classname}:\n'
|
out += f'class {classname}:\n'
|
||||||
|
|
||||||
docstr = cls.__doc__
|
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.
|
# Create a public constructor if it has one.
|
||||||
# If the first docs line appears to be a function signature
|
# If the first docs line appears to be a function signature
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user