Skip to content

Commit 5e65e8e

Browse files
author
James William Pye
committed
Rename __call__ to transmit.
It lends to its purpose.
1 parent 1b6c239 commit 5e65e8e

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

postgresql/copyman.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, manager, reason = None, faults = None):
5252
self.faults = faults or {}
5353

5454
def __str__(self):
55-
return self.reason or 'copy '
55+
return self.reason or 'copy aborted'
5656

5757
# The identifier for PQv3 copy data.
5858
PROTOCOL_PQv3 = "PQv3"
@@ -277,9 +277,9 @@ class Receiver(Fitting):
277277
_e_label = 'RECEIVER'
278278

279279
@abstractmethod
280-
def __call__(self):
280+
def transmit(self):
281281
"""
282-
Finish the reception of data.
282+
Finish the reception of the accepted data.
283283
"""
284284

285285
@abstractmethod
@@ -508,7 +508,7 @@ class NullReceiver(Receiver):
508508
protocol = PROTOCOL_NULL
509509
state = 'null'
510510

511-
def __call__(self):
511+
def transmit(self):
512512
# Nothing to do.
513513
pass
514514

@@ -530,7 +530,7 @@ def __init__(self, send):
530530
def accept(self, data):
531531
self.view = data
532532

533-
def __call__(self):
533+
def transmit(self):
534534
while self.view:
535535
self.view = self.view[self.send(self.view):]
536536

@@ -626,7 +626,7 @@ def __init__(self, callable):
626626
self.lines = None
627627
super().__init__()
628628

629-
def __call__(self):
629+
def transmit(self):
630630
if self.lines is not None:
631631
self.callable(self.lines)
632632
self.lines = None
@@ -734,7 +734,7 @@ def reconcile(self, r):
734734
"""
735735
if r.protocol not in self.protocols:
736736
raise RuntimeError("cannot add new receivers to copy operations")
737-
r()
737+
r.transmit()
738738
# Okay, add it back.
739739
self.receivers.add(r)
740740

@@ -761,7 +761,7 @@ def _service_receivers(self):
761761
for x in self.receivers:
762762
# Process all the receivers.
763763
try:
764-
x()
764+
x.transmit()
765765
except Exception as e:
766766
faults[x] = e
767767
if faults:

0 commit comments

Comments
 (0)