From b0f881f422d8a194113d39c1f972c94a01203d84 Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 20 Mar 2019 17:27:35 -0300 Subject: [PATCH] utils: docstring arrangements --- litecord/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/litecord/utils.py b/litecord/utils.py index d19df06..db34b28 100644 --- a/litecord/utils.py +++ b/litecord/utils.py @@ -39,6 +39,7 @@ async def async_map(function, iterable: Iterable) -> list: async def task_wrapper(name: str, coro): + """Wrap a given coroutine in a task.""" try: await coro except asyncio.CancelledError: @@ -136,7 +137,10 @@ def mmh3(inp_str: str, seed: int = 0): class LitecordJSONEncoder(JSONEncoder): + """Custom JSON encoder for Litecord.""" def default(self, value: Any): + """By default, this will try to get the to_json attribute of a given + value being JSON encoded.""" try: return value.to_json except AttributeError: @@ -144,8 +148,7 @@ class LitecordJSONEncoder(JSONEncoder): async def pg_set_json(con): - """Set JSON and JSONB codecs for an - asyncpg connection.""" + """Set JSON and JSONB codecs for an asyncpg connection.""" await con.set_type_codec( 'json', encoder=lambda v: json.dumps(v, cls=LitecordJSONEncoder),