Skip to content

Commit 1cbe14e

Browse files
author
James William Pye
committed
Rewrite using map and compose.
1 parent a4ee20e commit 1cbe14e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

postgresql/protocol/typio.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,13 @@ def decodes(self, iter):
596596
"""
597597
Decode the items in the iterable from the configured encoding.
598598
"""
599-
for k in iter:
600-
yield self._decode(k)[0]
599+
return map(compose((self._decode, get0)), iter)
601600

602601
def encodes(self, iter):
603602
"""
604603
Encode the items in the iterable in the configured encoding.
605604
"""
606-
for k in iter:
607-
yield self._encode(k)[0]
605+
return map(compose((self._encode, get0)), iter)
608606

609607
def resolve_pack(self, typid):
610608
return self.resolve(typid)[0] or self.encode

0 commit comments

Comments
 (0)