From: Daniele Varrazzo Date: Sun, 12 Jun 2022 22:53:26 +0000 (+0200) Subject: refactor(copy): rename ConnectionWriter to LibpqWriter X-Git-Tag: 3.1~44^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d9b516dac4f1064bc0a4c491ac13bd9a054d0a7;p=thirdparty%2Fpsycopg.git refactor(copy): rename ConnectionWriter to LibpqWriter The class takes a cursor as input so the previous name was misleading. --- diff --git a/psycopg/psycopg/copy.py b/psycopg/psycopg/copy.py index 6ac502500..2d891a697 100644 --- a/psycopg/psycopg/copy.py +++ b/psycopg/psycopg/copy.py @@ -311,7 +311,7 @@ class Writer(ABC): pass -class ConnectionWriter(Writer): +class LibpqWriter(Writer): def __init__(self, cursor: "Cursor[Any]"): self.cursor = cursor self.connection = cursor.connection @@ -343,7 +343,7 @@ class ConnectionWriter(Writer): self.cursor._rowcount = nrows if nrows is not None else -1 -class QueueWriter(ConnectionWriter): +class QueueWriter(LibpqWriter): """ A writer using a buffer to queue data to write. @@ -502,7 +502,7 @@ class AsyncWriter(ABC): pass -class AsyncConnectionWriter(AsyncWriter): +class AsyncLibpqWriter(AsyncWriter): def __init__(self, cursor: "AsyncCursor[Any]"): self.cursor = cursor self.connection = cursor.connection @@ -534,7 +534,7 @@ class AsyncConnectionWriter(AsyncWriter): self.cursor._rowcount = nrows if nrows is not None else -1 -class AsyncQueueWriter(AsyncConnectionWriter): +class AsyncQueueWriter(AsyncLibpqWriter): """ A writer using a buffer to queue data to write. diff --git a/tests/test_copy.py b/tests/test_copy.py index 78a7ebec7..094a7043d 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -645,7 +645,7 @@ def test_worker_error_propagated(conn, monkeypatch): ) def test_connection_writer(conn, format, buffer): cur = conn.cursor() - writer = psycopg.copy.ConnectionWriter(cur) + writer = psycopg.copy.LibpqWriter(cur) ensure_table(cur, sample_tabledef) with cur.copy( diff --git a/tests/test_copy_async.py b/tests/test_copy_async.py index bbaf77aaa..ed91c0791 100644 --- a/tests/test_copy_async.py +++ b/tests/test_copy_async.py @@ -648,7 +648,7 @@ async def test_worker_error_propagated(aconn, monkeypatch): ) async def test_connection_writer(aconn, format, buffer): cur = aconn.cursor() - writer = psycopg.copy.AsyncConnectionWriter(cur) + writer = psycopg.copy.AsyncLibpqWriter(cur) await ensure_table(cur, sample_tabledef) async with cur.copy(