(self, cmd, calls, wait=True, is_preloaded=False, async_wait=True)
| 738 | return resp |
| 739 | |
| 740 | def call_many(self, cmd, calls, wait=True, is_preloaded=False, async_wait=True): |
| 741 | if not calls and cmd != "async_responses": |
| 742 | return |
| 743 | |
| 744 | assert not is_preloaded or cmd == "get", "is_preloaded is only supported for 'get'" |
| 745 | |
| 746 | def send_buffer(): |
| 747 | if self.to_send: |
| 748 | try: |
| 749 | written = self.ratelimit.write(self.stdin_fd, self.to_send.peek_front()) |
| 750 | self.tx_bytes += written |
| 751 | self.to_send.pop_front(written) |
| 752 | except OSError as e: |
| 753 | # io.write might raise EAGAIN even though select indicates |
| 754 | # that the fd should be writable. |
| 755 | # EWOULDBLOCK is added for defensive programming sake. |
| 756 | if e.errno not in [errno.EAGAIN, errno.EWOULDBLOCK]: |
| 757 | raise |
| 758 | |
| 759 | def pop_preload_msgid(chunkid): |
| 760 | msgid = self.chunkid_to_msgids[chunkid].pop(0) |
| 761 | if not self.chunkid_to_msgids[chunkid]: |
| 762 | del self.chunkid_to_msgids[chunkid] |
| 763 | return msgid |
| 764 | |
| 765 | def handle_error(unpacked): |
| 766 | if "exception_class" not in unpacked: |
| 767 | return |
| 768 | |
| 769 | error = unpacked["exception_class"] |
| 770 | args = unpacked["exception_args"] |
| 771 | |
| 772 | if error == "Error": |
| 773 | raise Error(args[0]) |
| 774 | elif error == "ErrorWithTraceback": |
| 775 | raise ErrorWithTraceback(args[0]) |
| 776 | elif error == "InvalidRepository": |
| 777 | raise Repository.InvalidRepository(self.location.processed) |
| 778 | elif error == "DoesNotExist": |
| 779 | raise Repository.DoesNotExist(self.location.processed) |
| 780 | elif error == "AlreadyExists": |
| 781 | raise Repository.AlreadyExists(self.location.processed) |
| 782 | elif error == "CheckNeeded": |
| 783 | raise Repository.CheckNeeded(self.location.processed) |
| 784 | elif error == "IntegrityError": |
| 785 | raise IntegrityError(args[0]) |
| 786 | elif error == "PathNotAllowed": |
| 787 | raise PathNotAllowed(args[0]) |
| 788 | elif error == "PathPermissionDenied": |
| 789 | raise Repository.PathPermissionDenied(args[0]) |
| 790 | elif error == "PathAlreadyExists": |
| 791 | raise Repository.PathAlreadyExists(args[0]) |
| 792 | elif error == "ParentPathDoesNotExist": |
| 793 | raise Repository.ParentPathDoesNotExist(args[0]) |
| 794 | elif error == "ObjectNotFound": |
| 795 | raise Repository.ObjectNotFound(args[0], self.location.processed) |
| 796 | elif error == "StoreObjectNotFound": |
| 797 | raise StoreObjectNotFound(args[0]) |
no test coverage detected