From 6fddc0988718020554160f967227701adfc0b74f Mon Sep 17 00:00:00 2001 From: Roman Trapeznikov Date: Tue, 22 Feb 2022 22:16:43 +0300 Subject: [PATCH] tidying up docstrings --- assets/src/ba_data/python/._ba_sources_hash | 2 +- assets/src/ba_data/python/_ba.py | 6 +++--- assets/src/ba_data/python/ba/_activity.py | 2 +- assets/src/ba_data/python/ba/_actor.py | 8 ++++---- assets/src/ba_data/python/ba/_player.py | 16 +++++----------- assets/src/ba_data/python/ba/_plugin.py | 2 +- assets/src/ba_data/python/bastd/actor/flag.py | 4 ++-- assets/src/ba_data/python/bastd/actor/spazbot.py | 2 +- src/ballistica/python/class/python_class_node.cc | 2 +- .../python/methods/python_methods_system.cc | 4 ++-- 10 files changed, 21 insertions(+), 27 deletions(-) diff --git a/assets/src/ba_data/python/._ba_sources_hash b/assets/src/ba_data/python/._ba_sources_hash index 48a48da1..51d0de9b 100644 --- a/assets/src/ba_data/python/._ba_sources_hash +++ b/assets/src/ba_data/python/._ba_sources_hash @@ -1 +1 @@ -251300217209184493283326875275347381659 \ No newline at end of file +32362240586742836034231639790863797313 \ No newline at end of file diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py index 2048b45d..7ab61494 100644 --- a/assets/src/ba_data/python/_ba.py +++ b/assets/src/ba_data/python/_ba.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_activity.py b/assets/src/ba_data/python/ba/_activity.py index 78a79f02..50622430 100644 --- a/assets/src/ba_data/python/ba/_activity.py +++ b/assets/src/ba_data/python/ba/_activity.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_actor.py b/assets/src/ba_data/python/ba/_actor.py index 009000f0..d6a7c194 100644 --- a/assets/src/ba_data/python/ba/_actor.py +++ b/assets/src/ba_data/python/ba/_actor.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_player.py b/assets/src/ba_data/python/ba/_player.py index 996bfb66..3da52bd3 100644 --- a/assets/src/ba_data/python/ba/_player.py +++ b/assets/src/ba_data/python/ba/_player.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_plugin.py b/assets/src/ba_data/python/ba/_plugin.py index a56e4a73..6de548a8 100644 --- a/assets/src/ba_data/python/ba/_plugin.py +++ b/assets/src/ba_data/python/ba/_plugin.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/actor/flag.py b/assets/src/ba_data/python/bastd/actor/flag.py index 2d7f2133..6fae9d40 100644 --- a/assets/src/ba_data/python/bastd/actor/flag.py +++ b/assets/src/ba_data/python/bastd/actor/flag.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/actor/spazbot.py b/assets/src/ba_data/python/bastd/actor/spazbot.py index 62b012cd..e9bb4bda 100644 --- a/assets/src/ba_data/python/bastd/actor/spazbot.py +++ b/assets/src/ba_data/python/bastd/actor/spazbot.py @@ -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 diff --git a/src/ballistica/python/class/python_class_node.cc b/src/ballistica/python/class/python_class_node.cc index 751a17a6..0ad9ed7e 100644 --- a/src/ballistica/python/class/python_class_node.cc +++ b/src/ballistica/python/class/python_class_node.cc @@ -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; diff --git a/src/ballistica/python/methods/python_methods_system.cc b/src/ballistica/python/methods/python_methods_system.cc index aa3c28e6..7d748064 100644 --- a/src/ballistica/python/methods/python_methods_system.cc +++ b/src/ballistica/python/methods/python_methods_system.cc @@ -803,7 +803,7 @@ auto PythonMethodsSystem::GetMethods() -> std::vector { "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 { "\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"