Skip to content

Commit

Permalink
Merge pull request #46 from mmacy/party-doc-fix
Browse files Browse the repository at this point in the history
minor party docstring fix
  • Loading branch information
mmacy committed Jan 30, 2024
2 parents ab25d2f + c7d7714 commit 8d0a28a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions osrlib/osrlib/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand All @@ -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)
```
"""
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit 8d0a28a

Please sign in to comment.