]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Dropped Transformer.load()
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 7 Aug 2020 02:49:20 +0000 (03:49 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 23 Aug 2020 18:24:02 +0000 (19:24 +0100)
psycopg3/psycopg3/proto.py
psycopg3/psycopg3/transform.py
psycopg3_c/psycopg3_c/_psycopg3.pyi
psycopg3_c/psycopg3_c/transform.pyx
tests/test_adapt.py

index 84601a4f7d125e621f04df8be80fa08007179850..c54075c479de8aedc20e55506354e956b9b47672 100644 (file)
@@ -90,9 +90,6 @@ class Transformer(Protocol):
     ) -> Tuple[Any, ...]:
         ...
 
-    def load(self, data: bytes, oid: int, format: Format = Format.TEXT) -> Any:
-        ...
-
     def get_load_function(self, oid: int, format: Format) -> LoadFunc:
         ...
 
index c8ca9272757619437a19b842ac75ec892826bec7..15cf937f62ac3febdfcc437c7bf5e48d3b64e88e 100644 (file)
@@ -187,13 +187,6 @@ class Transformer:
             for i, val in enumerate(record)
         )
 
-    def load(self, data: bytes, oid: int, format: Format = Format.TEXT) -> Any:
-        if data is not None:
-            f = self.get_load_function(oid, format)
-            return f(data)
-        else:
-            return None
-
     def get_load_function(self, oid: int, format: Format) -> LoadFunc:
         key = (oid, format)
         try:
index 50bf51bc5db2a472d0c3657908f01a90398564b1..e6306040894fdf6306097b8460643deadffa08f6 100644 (file)
@@ -39,9 +39,6 @@ class Transformer:
     def load_sequence(
         self, record: Sequence[Optional[bytes]]
     ) -> Tuple[Any, ...]: ...
-    def load(
-        self, data: bytes, oid: int, format: pq.Format = pq.Format.TEXT
-    ) -> Any: ...
     def get_load_function(self, oid: int, format: pq.Format) -> LoadFunc: ...
     def lookup_loader(self, oid: int, format: pq.Format) -> LoaderType: ...
 
index bc6898bc00b0d238c3aaf0faf04a99927c39ba7c..460e7ac100feb3830f1c26f8907dd014a1b391a8 100644 (file)
@@ -250,13 +250,6 @@ cdef class Transformer:
 
         return tuple(rv)
 
-    def load(self, data: bytes, oid: int, format: Format = Format.TEXT) -> Any:
-        if data is not None:
-            f = self.get_load_function(oid, format)
-            return f(data)
-        else:
-            return None
-
     def get_load_function(self, oid: int, format: Format) -> "LoadFunc":
         key = (oid, format)
         try:
index 5f01a97c45f53b39915fddb86db3a8a7667c9023..9bb0745531caed90dcbb0bfd7b849e046cd05597 100644 (file)
@@ -48,8 +48,6 @@ def test_dump_cursor_ctx(conn):
 @pytest.mark.parametrize(
     "data, format, type, result",
     [
-        (None, Format.TEXT, "text", None),
-        (None, Format.BINARY, "text", None),
         (b"1", Format.TEXT, "int4", 1),
         (b"hello", Format.TEXT, "text", "hello"),
         (b"hello", Format.BINARY, "text", "hello"),
@@ -57,7 +55,7 @@ def test_dump_cursor_ctx(conn):
 )
 def test_cast(data, format, type, result):
     t = Transformer()
-    rv = t.load(data, builtins[type].oid, format)
+    rv = t.get_loader(builtins[type].oid, format).load(data)
     assert rv == result