tidying up docstrings

This commit is contained in:
Roman Trapeznikov 2022-02-22 22:16:43 +03:00
parent 80756a1444
commit 6fddc09887
No known key found for this signature in database
GPG Key ID: 89BED52F1E290F8D
10 changed files with 21 additions and 27 deletions

View File

@ -1 +1 @@
251300217209184493283326875275347381659
32362240586742836034231639790863797313

View File

@ -511,7 +511,7 @@ class Node:
ba.Node.exists() can be used to determine if a Node still points to
a live node in the game.
You can use ba.Node(None) to instantiate an invalid
You can use `ba.Node(None)` to instantiate an invalid
Node reference (sometimes used as attr values/etc).
"""
@ -1330,7 +1330,7 @@ def clipboard_has_text() -> bool:
Category: **General Utility Functions**
This will return False if no system clipboard is available; no need
to call ba.clipboard_available() separately.
to call ba.clipboard_is_supported() separately.
"""
return bool()
@ -1351,7 +1351,7 @@ def clipboard_set_text(value: str) -> None:
Category: **General Utility Functions**
Ensure that ba.clipboard_available() returns True before adding
Ensure that ba.clipboard_is_supported() returns True before adding
buttons/etc. that make use of this functionality.
"""
return None

View File

@ -356,7 +356,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
Upon this call, the Activity should fade in backgrounds,
start playing music, etc. It does not yet have access to players
or teams, however. They remain owned by the previous Activity
up until ba.Activity.on_begin is called.
up until ba.Activity.on_begin() is called.
"""
def on_transition_out(self) -> None:

View File

@ -52,9 +52,9 @@ class Actor:
if you want an Actor to stick around until explicitly killed
regardless of references.
Another key feature of ba.Actor is its ba.Actor.handlemessage() method, which
takes a single arbitrary object as an argument. This provides a safe way
to communicate between ba.Actor, ba.Activity, ba.Session, and any other
Another key feature of ba.Actor is its ba.Actor.handlemessage() method,
which takes a single arbitrary object as an argument. This provides a safe
way to communicate between ba.Actor, ba.Activity, ba.Session, and any other
class providing a handlemessage() method. The most universally handled
message type for Actors is the ba.DieMessage.
@ -113,7 +113,7 @@ class Actor:
return self
def on_expire(self) -> None:
"""Called for remaining ba.Actor-s when their ba.Activity shuts down.
"""Called for remaining `ba.Actor`s when their ba.Activity shuts down.
Actors can use this opportunity to clear callbacks or other
references which have the potential of keeping the ba.Activity

View File

@ -222,8 +222,7 @@ class Player(Generic[TeamType]):
return self._sessionplayer.exists() and not self._expired
def getname(self, full: bool = False, icon: bool = True) -> str:
"""getname(full: bool = False, icon: bool = True) -> str
"""
Returns the player's name. If icon is True, the long version of the
name may include an icon.
"""
@ -232,8 +231,7 @@ class Player(Generic[TeamType]):
return self._sessionplayer.getname(full=full, icon=icon)
def is_alive(self) -> bool:
"""is_alive() -> bool
"""
Returns True if the player has a ba.Actor assigned and its
is_alive() method return True. False is returned otherwise.
"""
@ -242,8 +240,7 @@ class Player(Generic[TeamType]):
return self.actor is not None and self.actor.is_alive()
def get_icon(self) -> dict[str, Any]:
"""get_icon() -> dict[str, Any]
"""
Returns the character's icon (images, colors, etc contained in a dict)
"""
assert self._postinited
@ -253,9 +250,7 @@ class Player(Generic[TeamType]):
def assigninput(self, inputtype: Union[ba.InputType, tuple[ba.InputType,
...]],
call: Callable) -> None:
"""assigninput(type: Union[ba.InputType, Tuple[ba.InputType, ...]],
call: Callable) -> None
"""
Set the python callable to be run for one or more types of input.
"""
assert self._postinited
@ -263,8 +258,7 @@ class Player(Generic[TeamType]):
return self._sessionplayer.assigninput(type=inputtype, call=call)
def resetinput(self) -> None:
"""resetinput() -> None
"""
Clears out the player's assigned input actions.
"""
assert self._postinited

View File

@ -18,7 +18,7 @@ class PluginSubsystem:
Category: **App Classes**
Access the single shared instance of this class at 'ba.app.plugins'.
Access the single shared instance of this class at `ba.app.plugins`.
"""
def __init__(self) -> None:

View File

@ -249,8 +249,8 @@ class Flag(ba.Actor):
if not self._has_moved:
nodepos = self.node.position
if (max(
abs(nodepos[i] - self._initial_position[i])
for i in list(range(3))) > 1.0):
abs(nodepos[i] - self._initial_position[i])
for i in list(range(3))) > 1.0):
self._has_moved = True
if self._held_count > 0 or not self._has_moved:

View File

@ -51,7 +51,7 @@ class SpazBotDiedMessage:
spazbot: SpazBot
"""The SpazBot that was killed."""
killerplayer: ba.Player
killerplayer: Optional[ba.Player]
"""The ba.Player that killed it (or None)."""
how: ba.DeathType

View File

@ -38,7 +38,7 @@ void PythonClassNode::SetupType(PyTypeObject* obj) {
"ba.Node.exists() can be used to determine if a Node still points to\n"
"a live node in the game.\n"
"\n"
"You can use ba.Node(None) to instantiate an invalid\n"
"You can use `ba.Node(None)` to instantiate an invalid\n"
"Node reference (sometimes used as attr values/etc).";
obj->tp_new = tp_new;
obj->tp_dealloc = (destructor)tp_dealloc;

View File

@ -803,7 +803,7 @@ auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
"Category: **General Utility Functions**\n"
"\n"
"This will return False if no system clipboard is available; no need\n"
" to call ba.clipboard_available() separately."},
" to call ba.clipboard_is_supported() separately."},
{"clipboard_set_text", (PyCFunction)PyClipboardSetText,
METH_VARARGS | METH_KEYWORDS,
"clipboard_set_text(value: str) -> None\n"
@ -812,7 +812,7 @@ auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
"\n"
"Category: **General Utility Functions**\n"
"\n"
"Ensure that ba.clipboard_available() returns True before adding\n"
"Ensure that ba.clipboard_is_supported() returns True before adding\n"
" buttons/etc. that make use of this functionality."},
{"clipboard_get_text", (PyCFunction)PyClipboardGetText, METH_NOARGS,
"clipboard_get_text() -> str\n"