From 741f8234edde84dccefcbf5dc0ba3b70c0e016e2 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 29 Dec 2021 19:21:45 +0100 Subject: Add docstrings to all modules Signed-off-by: Olivier Gayot --- swiftstory/status.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'swiftstory/status.py') diff --git a/swiftstory/status.py b/swiftstory/status.py index d794580..a35f66a 100644 --- a/swiftstory/status.py +++ b/swiftstory/status.py @@ -1,9 +1,13 @@ +""" Module defining helpers to craft answers to be sent to clients. """ + from typing import Any import json def error(msg: str, code: int = 255) -> str: + """ Generate an error. """ return json.dumps({'type': 'response', 'content': {'status': code, 'info': msg}}) def success(obj: Any) -> str: + """ Generate a success message. """ return json.dumps({'type': 'response', 'content': {'status': 0, 'result': obj}}) -- cgit v1.2.3