From c7d77146563985d3fbc73c0fbce8845b7c3dbd98 Mon Sep 17 00:00:00 2001 From: Marsh Macy Date: Tue, 30 Jan 2024 07:41:02 -1000 Subject: [PATCH] minor party docstring fix --- osrlib/osrlib/party.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/osrlib/osrlib/party.py b/osrlib/osrlib/party.py index 5fd14ef..c167e1b 100644 --- a/osrlib/osrlib/party.py +++ b/osrlib/osrlib/party.py @@ -28,10 +28,9 @@ class CharacterAlreadyInPartyError(Exception): """Raised when attempting to add a player character to a party that already has that character as a member. Example: - Before trying to add a character to a party, check whether the character is already in the party by using the in - operator: ```python + # Check whether the character is in the party before adding them if not party.is_member(some_new_character): party.add_character(some_new_character) ``` @@ -41,14 +40,13 @@ class CharacterAlreadyInPartyError(Exception): class CharacterNotInPartyError(Exception): - """Raised when attempting to remove a player character from a party that does not have the character as a member. + """Raised when attempting to remove a character from a party when that character isn't in the party. Example: - Before trying to remove a character from a party, check whether the character is in the party by using the ``in`` - operator: ```python - if character in party: + # Check for membership before removing a character from the party + if party.is_member(character): party.remove_character(character) ``` """ @@ -238,7 +236,7 @@ def add_character( return character def is_member(self, character: PlayerCharacter) -> bool: - """Returns True if the character is in the party. + """Returns `True` if the character is in the party. Example: @@ -254,7 +252,7 @@ def is_member(self, character: PlayerCharacter) -> bool: character (PlayerCharacter): The character to check for. Returns: - bool: True if the character is in the party, False otherwise. + bool: `True` if the character is in the party, otherwise `False`. """ return character in self.members