From: Daniele Varrazzo Date: Sun, 8 Oct 2023 09:55:58 +0000 (+0200) Subject: style: more care in the docstring mentioning sync/async versions of the code X-Git-Tag: pool-3.2.0~12^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c340ea7270b5eeb6e81a6bd816b3311ff7f83c4;p=thirdparty%2Fpsycopg.git style: more care in the docstring mentioning sync/async versions of the code --- diff --git a/psycopg/psycopg/_copy.py b/psycopg/psycopg/_copy.py index 57133891d..28d85eb35 100644 --- a/psycopg/psycopg/_copy.py +++ b/psycopg/psycopg/_copy.py @@ -2,7 +2,7 @@ # from the original file '_copy_async.py' # DO NOT CHANGE! Change the original file instead. """ -Psycopg Copy and related objects. +Objects to support the COPY protocol (sync version). """ # Copyright (C) 2023 The Psycopg Team diff --git a/psycopg/psycopg/_copy_async.py b/psycopg/psycopg/_copy_async.py index 248335300..5f66dbf29 100644 --- a/psycopg/psycopg/_copy_async.py +++ b/psycopg/psycopg/_copy_async.py @@ -1,5 +1,5 @@ """ -Psycopg AsyncCopy and related objects. +Objects to support the COPY protocol (async version). """ # Copyright (C) 2023 The Psycopg Team diff --git a/psycopg/psycopg/connection.py b/psycopg/psycopg/connection.py index 37086cc04..a5adf2a92 100644 --- a/psycopg/psycopg/connection.py +++ b/psycopg/psycopg/connection.py @@ -2,7 +2,7 @@ # from the original file 'connection_async.py' # DO NOT CHANGE! Change the original file instead. """ -psycopg async connection objects +Psycopg connection object (sync version) """ # Copyright (C) 2020 The Psycopg Team diff --git a/psycopg/psycopg/connection_async.py b/psycopg/psycopg/connection_async.py index 70fa198e8..862a1ebe0 100644 --- a/psycopg/psycopg/connection_async.py +++ b/psycopg/psycopg/connection_async.py @@ -1,5 +1,5 @@ """ -psycopg async connection objects +Psycopg connection object (async version) """ # Copyright (C) 2020 The Psycopg Team diff --git a/psycopg_pool/psycopg_pool/null_pool.py b/psycopg_pool/psycopg_pool/null_pool.py index f8cdb9f55..1ffeceae4 100644 --- a/psycopg_pool/psycopg_pool/null_pool.py +++ b/psycopg_pool/psycopg_pool/null_pool.py @@ -2,7 +2,7 @@ # from the original file 'null_pool_async.py' # DO NOT CHANGE! Change the original file instead. """ -Psycopg null connection pool module. +Psycopg null connection pool module (sync version). """ # Copyright (C) 2022 The Psycopg Team diff --git a/psycopg_pool/psycopg_pool/null_pool_async.py b/psycopg_pool/psycopg_pool/null_pool_async.py index bc3931c98..8db9ca7ae 100644 --- a/psycopg_pool/psycopg_pool/null_pool_async.py +++ b/psycopg_pool/psycopg_pool/null_pool_async.py @@ -1,5 +1,5 @@ """ -Psycopg null connection pool module. +Psycopg null connection pool module (async version). """ # Copyright (C) 2022 The Psycopg Team diff --git a/psycopg_pool/psycopg_pool/pool.py b/psycopg_pool/psycopg_pool/pool.py index f96eab00e..f2fab5d26 100644 --- a/psycopg_pool/psycopg_pool/pool.py +++ b/psycopg_pool/psycopg_pool/pool.py @@ -2,7 +2,7 @@ # from the original file 'pool_async.py' # DO NOT CHANGE! Change the original file instead. """ -Psycopg connection pool module. +Psycopg connection pool module (sync version). """ # Copyright (C) 2021 The Psycopg Team diff --git a/psycopg_pool/psycopg_pool/pool_async.py b/psycopg_pool/psycopg_pool/pool_async.py index aa34df36b..cbafa9c85 100644 --- a/psycopg_pool/psycopg_pool/pool_async.py +++ b/psycopg_pool/psycopg_pool/pool_async.py @@ -1,5 +1,5 @@ """ -Psycopg connection pool module. +Psycopg connection pool module (async version). """ # Copyright (C) 2021 The Psycopg Team diff --git a/psycopg_pool/psycopg_pool/sched.py b/psycopg_pool/psycopg_pool/sched.py index 6b36f4b6c..58cadc36d 100644 --- a/psycopg_pool/psycopg_pool/sched.py +++ b/psycopg_pool/psycopg_pool/sched.py @@ -2,12 +2,12 @@ # from the original file 'sched_async.py' # DO NOT CHANGE! Change the original file instead. """ -A minimal scheduler to schedule tasks to run in the future. +A minimal scheduler to schedule tasks to run in the future (sync version). Inspired to the standard library `sched.scheduler`, but designed for -multi-thread usage from the ground up, not as an afterthought. Tasks can be scheduled in -front of the one currently running and `Scheduler.run()` can be left running -without any tasks scheduled. +multi-thread usage from the ground up, not as an afterthought. Tasks can be +scheduled in front of the one currently running and `Scheduler.run()` can be +left running without any tasks scheduled. Tasks are called "Task", not "Event", here, because we actually make use of `[threading/asyncio].Event` and the two would be confusing. diff --git a/psycopg_pool/psycopg_pool/sched_async.py b/psycopg_pool/psycopg_pool/sched_async.py index d69a0b0a3..c9fdbad79 100644 --- a/psycopg_pool/psycopg_pool/sched_async.py +++ b/psycopg_pool/psycopg_pool/sched_async.py @@ -1,5 +1,5 @@ """ -A minimal scheduler to schedule tasks to run in the future. +A minimal scheduler to schedule tasks to run in the future (async version). Inspired to the standard library `sched.scheduler`, but designed for multi-thread usage from the ground up, not as an afterthought. Tasks can be diff --git a/tools/async_to_sync.py b/tools/async_to_sync.py index 02758d391..7b949d137 100755 --- a/tools/async_to_sync.py +++ b/tools/async_to_sync.py @@ -241,6 +241,7 @@ class RenameAsyncToSync(ast.NodeTransformer): and isinstance(body[0].value.value, str) ): body[0].value.value = body[0].value.value.replace("Async", "") + body[0].value.value = body[0].value.value.replace("(async", "(sync") def visit_Call(self, node: ast.Call) -> ast.AST: if isinstance(node.func, ast.Name) and node.func.id == "TypeVar":