Add punctuation to the end of docstrings

This commit is contained in:
Andrew Morgan 2021-01-09 22:33:59 -05:00
parent 2b03c03891
commit 015ef12782
7 changed files with 29 additions and 28 deletions

View file

@ -15,20 +15,20 @@ class Command:
room: MatrixRoom, room: MatrixRoom,
event: RoomMessageText, event: RoomMessageText,
): ):
"""A command made by a user """A command made by a user.
Args: Args:
client: The client to communicate to matrix with client: The client to communicate to matrix with.
store: Bot storage store: Bot storage.
config: Bot configuration parameters config: Bot configuration parameters.
command: The command and arguments command: The command and arguments.
room: The room the command was sent in room: The room the command was sent in.
event: The event describing the command event: The event describing the command.
""" """
self.client = client self.client = client
self.store = store self.store = store
@ -82,7 +82,7 @@ class Command:
if topic == "rules": if topic == "rules":
text = "These are the rules!" text = "These are the rules!"
elif topic == "commands": elif topic == "commands":
text = "Available commands" text = "Available commands: ..."
else: else:
text = "Unknown help topic!" text = "Unknown help topic!"
await send_text_to_room(self.client, self.room.room_id, text) await send_text_to_room(self.client, self.room.room_id, text)

View file

@ -24,11 +24,11 @@ class Callbacks:
def __init__(self, client: AsyncClient, store: Storage, config: Config): def __init__(self, client: AsyncClient, store: Storage, config: Config):
""" """
Args: Args:
client: nio client used to interact with matrix client: nio client used to interact with matrix.
store: Bot storage store: Bot storage.
config: Bot configuration parameters config: Bot configuration parameters.
""" """
self.client = client self.client = client
self.store = store self.store = store
@ -39,9 +39,9 @@ class Callbacks:
"""Callback for when a message event is received """Callback for when a message event is received
Args: Args:
room: The room the event came from room: The room the event came from.
event: The event defining the message event: The event defining the message.
""" """
# Extract the message text # Extract the message text
msg = event.body msg = event.body

View file

@ -18,7 +18,7 @@ class Config:
def __init__(self, filepath: str): def __init__(self, filepath: str):
""" """
Args: Args:
filepath: Path to a config file filepath: Path to a config file.
""" """
if not os.path.isfile(filepath): if not os.path.isfile(filepath):
raise ConfigError(f"Config file '{filepath}' does not exist") raise ConfigError(f"Config file '{filepath}' does not exist")

View file

@ -2,10 +2,10 @@
class ConfigError(RuntimeError): class ConfigError(RuntimeError):
"""An error encountered during reading the config file """An error encountered during reading the config file.
Args: Args:
msg: The message displayed to the user on error msg: The message displayed to the user on error.
""" """
def __init__(self, msg: str): def __init__(self, msg: str):

View file

@ -24,8 +24,9 @@ logger = logging.getLogger(__name__)
async def main(): async def main():
# Read config file """The first function that is run when starting the bot"""
# Read user-configured options from a config file.
# A different config file path can be specified as the first command line argument # A different config file path can be specified as the first command line argument
if len(sys.argv) > 1: if len(sys.argv) > 1:
config_path = sys.argv[1] config_path = sys.argv[1]

View file

@ -22,17 +22,17 @@ class Message:
"""Initialize a new Message """Initialize a new Message
Args: Args:
client: nio client used to interact with matrix client: nio client used to interact with matrix.
store: Bot storage store: Bot storage.
config: Bot configuration parameters config: Bot configuration parameters.
message_content: The body of the message message_content: The body of the message.
room: The room the event came from room: The room the event came from.
event: The event defining the message event: The event defining the message.
""" """
self.client = client self.client = client
self.store = store self.store = store

View file

@ -15,16 +15,16 @@ logger = logging.getLogger(__name__)
class Storage: class Storage:
def __init__(self, database_config: Dict[str, str]): def __init__(self, database_config: Dict[str, str]):
"""Setup the database """Setup the database.
Runs an initial setup or migrations depending on whether a database file has already Runs an initial setup or migrations depending on whether a database file has already
been created been created.
Args: Args:
database_config: a dictionary containing the following keys: database_config: a dictionary containing the following keys:
* type: A string, one of "sqlite" or "postgres" * type: A string, one of "sqlite" or "postgres".
* connection_string: A string, featuring a connection string that * connection_string: A string, featuring a connection string that
be fed to each respective db library's `connect` method be fed to each respective db library's `connect` method.
""" """
self.conn = self._get_database_connection( self.conn = self._get_database_connection(
database_config["type"], database_config["connection_string"] database_config["type"], database_config["connection_string"]
@ -94,7 +94,7 @@ class Storage:
def _run_migrations(self, current_migration_version: int) -> None: def _run_migrations(self, current_migration_version: int) -> None:
"""Execute database migrations. Migrates the database to the """Execute database migrations. Migrates the database to the
`latest_migration_version` `latest_migration_version`.
Args: Args:
current_migration_version: The migration version that the database is current_migration_version: The migration version that the database is