mercurial/worker.py
changeset 49224 cdb85d0512b8
parent 49217 13dfad0f9f7a
child 49230 5d28246b9acc
--- a/mercurial/worker.py	Thu May 19 00:51:36 2022 +0100
+++ b/mercurial/worker.py	Wed May 25 17:23:16 2022 +0200
@@ -68,7 +68,7 @@
     return threading.current_thread() == threading.main_thread()
 
 
-class _blockingreader(object):
+class _blockingreader:
     def __init__(self, wrapped):
         self._wrapped = wrapped
 
@@ -114,37 +114,6 @@
         return bytes(buf)
 
 
-class _blockingreader:
-    def __init__(self, wrapped):
-        self._wrapped = wrapped
-
-    # Do NOT implement readinto() by making it delegate to
-    # _wrapped.readinto(), since that is unbuffered. The unpickler is fine
-    # with just read() and readline(), so we don't need to implement it.
-
-    def readline(self):
-        return self._wrapped.readline()
-
-    # issue multiple reads until size is fulfilled
-    def read(self, size=-1):
-        if size < 0:
-            return self._wrapped.readall()
-
-        buf = bytearray(size)
-        view = memoryview(buf)
-        pos = 0
-
-        while pos < size:
-            ret = self._wrapped.readinto(view[pos:])
-            if not ret:
-                break
-            pos += ret
-
-        del view
-        del buf[pos:]
-        return bytes(buf)
-
-
 if pycompat.isposix or pycompat.iswindows:
     _STARTUP_COST = 0.01
     # The Windows worker is thread based. If tasks are CPU bound, threads