]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
refactor(copy): rename ConnectionWriter to LibpqWriter
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 12 Jun 2022 22:53:26 +0000 (00:53 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 19 Jul 2022 14:09:53 +0000 (15:09 +0100)
The class takes a cursor as input so the previous name was misleading.

psycopg/psycopg/copy.py
tests/test_copy.py
tests/test_copy_async.py

index 6ac502500c6bdb7f54dc3444bf9230792b80575d..2d891a697ee48c1d4766af1b290d4be5ec362273 100644 (file)
@@ -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.
 
index 78a7ebec71941b05628272fd35c6e7e35888e240..094a7043d932cb9a936ca95725e7bb616d5e68d7 100644 (file)
@@ -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(
index bbaf77aaa5b3a7459933f98f75062552492595cd..ed91c07919ae2b314cc91b5957ef7ebf01b3b1d9 100644 (file)
@@ -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(