From 45f52b940e5de1f4d9a9ab54a8bbf481fcc93183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Thu, 12 Jan 2023 07:46:11 +0100 Subject: [PATCH] Add documentation --- models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models.py b/models.py index a2151e8..f58d85a 100644 --- a/models.py +++ b/models.py @@ -57,6 +57,7 @@ class Instance: pass def apply(self, server, token, block_id=None): + """Applies instance block on the remote server""" headers = { f'Authorization': f'Bearer {token}', } @@ -77,6 +78,7 @@ class Instance: raise ConnectionError(f"Could not apply block ({response.status_code}: {response.reason})") def delete(self, server: str, token: str): + """Deletes the instance from the blocklist on the remote server""" headers = { f'Authorization': f'Bearer {token}', } @@ -86,6 +88,7 @@ class Instance: @staticmethod def list_diffs(local_blocklist, remote_blocklist): + """Compares the local and remote blocklist and returns a list of differences""" diffs = [] for local_instance in local_blocklist: instance_found = False @@ -109,6 +112,7 @@ class Instance: @staticmethod def apply_blocks_from_diff(diffs, server, token, no_delete: bool): + """Uses a diff (list of difference in local an remote instance) to apply instance blocks""" for diff in diffs: if diff["local"] is None: if not no_delete: @@ -126,6 +130,7 @@ class Instance: @staticmethod def show_diffs(local_blocklist, remote_blocklist): + """Shows a table in the CLI comparing the local and remote blocklist""" from rich.table import Table from rich.console import Console table = Table(title="Differences", expand=True, show_lines=True)