From 015ef12782def9f3c061850bf3d6d37c99806e58 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sat, 9 Jan 2021 22:33:59 -0500 Subject: [PATCH] Add punctuation to the end of docstrings --- my_project_name/bot_commands.py | 16 ++++++++-------- my_project_name/callbacks.py | 10 +++++----- my_project_name/config.py | 2 +- my_project_name/errors.py | 4 ++-- my_project_name/main.py | 3 ++- my_project_name/message_responses.py | 12 ++++++------ my_project_name/storage.py | 10 +++++----- 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/my_project_name/bot_commands.py b/my_project_name/bot_commands.py index 38cdb00..4286309 100644 --- a/my_project_name/bot_commands.py +++ b/my_project_name/bot_commands.py @@ -15,20 +15,20 @@ class Command: room: MatrixRoom, event: RoomMessageText, ): - """A command made by a user + """A command made by a user. 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.store = store @@ -82,7 +82,7 @@ class Command: if topic == "rules": text = "These are the rules!" elif topic == "commands": - text = "Available commands" + text = "Available commands: ..." else: text = "Unknown help topic!" await send_text_to_room(self.client, self.room.room_id, text) diff --git a/my_project_name/callbacks.py b/my_project_name/callbacks.py index 8c155f3..08bbbc1 100644 --- a/my_project_name/callbacks.py +++ b/my_project_name/callbacks.py @@ -24,11 +24,11 @@ class Callbacks: def __init__(self, client: AsyncClient, store: Storage, config: Config): """ 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.store = store @@ -39,9 +39,9 @@ class Callbacks: """Callback for when a message event is received 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 msg = event.body diff --git a/my_project_name/config.py b/my_project_name/config.py index f7e86bd..3c94d36 100644 --- a/my_project_name/config.py +++ b/my_project_name/config.py @@ -18,7 +18,7 @@ class Config: def __init__(self, filepath: str): """ Args: - filepath: Path to a config file + filepath: Path to a config file. """ if not os.path.isfile(filepath): raise ConfigError(f"Config file '{filepath}' does not exist") diff --git a/my_project_name/errors.py b/my_project_name/errors.py index 70720c9..7ec2414 100644 --- a/my_project_name/errors.py +++ b/my_project_name/errors.py @@ -2,10 +2,10 @@ class ConfigError(RuntimeError): - """An error encountered during reading the config file + """An error encountered during reading the config file. Args: - msg: The message displayed to the user on error + msg: The message displayed to the user on error. """ def __init__(self, msg: str): diff --git a/my_project_name/main.py b/my_project_name/main.py index e00d4a5..812b3b5 100644 --- a/my_project_name/main.py +++ b/my_project_name/main.py @@ -24,8 +24,9 @@ logger = logging.getLogger(__name__) 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 if len(sys.argv) > 1: config_path = sys.argv[1] diff --git a/my_project_name/message_responses.py b/my_project_name/message_responses.py index 654407a..6d016ae 100644 --- a/my_project_name/message_responses.py +++ b/my_project_name/message_responses.py @@ -22,17 +22,17 @@ class Message: """Initialize a new Message 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.store = store diff --git a/my_project_name/storage.py b/my_project_name/storage.py index 01f9c8c..580ebd1 100644 --- a/my_project_name/storage.py +++ b/my_project_name/storage.py @@ -15,16 +15,16 @@ logger = logging.getLogger(__name__) class Storage: 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 - been created + been created. Args: 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 - 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( database_config["type"], database_config["connection_string"] @@ -94,7 +94,7 @@ class Storage: def _run_migrations(self, current_migration_version: int) -> None: """Execute database migrations. Migrates the database to the - `latest_migration_version` + `latest_migration_version`. Args: current_migration_version: The migration version that the database is