# Path: vcs/utils/compat.py
# class deque(object):
# class _Condition(_Verbose):
# class _Event(_Verbose):
#     def __init__(self, iterable=(), maxlen= -1):
#     def append(self, x):
#     def appendleft(self, x):
#     def pop(self):
#     def popleft(self):
#     def clear(self):
#     def extend(self, iterable):
#     def extendleft(self, iterable):
#     def rotate(self, n=1):
#     def __getitem__(self, i):
#     def __setitem__(self, i, value):
#     def __delitem__(self, i):
#     def __len__(self):
#     def __cmp__(self, other):
#     def __repr__(self, _track=[]):
#     def __getstate__(self):
#     def __setstate__(self, s):
#     def __hash__(self):
#     def __copy__(self):
#     def __deepcopy__(self, memo={}):
# def Condition(*args, **kwargs):
#     def __init__(self, lock=None, verbose=None):
#     def __enter__(self):
#     def __exit__(self, *args):
#     def __repr__(self):
#     def _release_save(self):
#     def _acquire_restore(self, x):
#     def _is_owned(self):
#     def wait(self, timeout=None):
#     def notify(self, n=1):
#     def notifyAll(self):
# def Event(*args, **kwargs):
#     def __init__(self, verbose=None):
#     def isSet(self):
#     def set(self):
#     def clear(self):
#     def wait(self, timeout=None):


import os
import subprocess
from vcs.utils.compat import deque, Event, Thread, _bytes, _bytearray
        if self.bytes:
            os.write(t, self.bytes)
        else:
            s = self.source
            b = s.read(4096)
            while b:
                os.write(t, b)
                b = s.read(4096)
        os.close(t)

    @property
    def output(self):
        return self.readiface


class InputStreamChunker(Thread):
    def __init__(self, source, target, buffer_size, chunk_size):

        super(InputStreamChunker, self).__init__()

        self.daemon = True  # die die die.

        self.source = source
        self.target = target
        self.chunk_count_max = int(buffer_size / chunk_size) + 1
        self.chunk_size = chunk_size

        self.data_added = Event()
        self.data_added.clear()


# Path: vcs/utils/compat.py
# class deque(object):
# class _Condition(_Verbose):
# class _Event(_Verbose):
#     def __init__(self, iterable=(), maxlen= -1):
#     def append(self, x):
#     def appendleft(self, x):
#     def pop(self):
#     def popleft(self):
#     def clear(self):
#     def extend(self, iterable):
#     def extendleft(self, iterable):
#     def rotate(self, n=1):
#     def __getitem__(self, i):
#     def __setitem__(self, i, value):
#     def __delitem__(self, i):
#     def __len__(self):
#     def __cmp__(self, other):
#     def __repr__(self, _track=[]):
#     def __getstate__(self):
#     def __setstate__(self, s):
#     def __hash__(self):
#     def __copy__(self):
#     def __deepcopy__(self, memo={}):
# def Condition(*args, **kwargs):
#     def __init__(self, lock=None, verbose=None):
#     def __enter__(self):
#     def __exit__(self, *args):
#     def __repr__(self):
#     def _release_save(self):
#     def _acquire_restore(self, x):
#     def _is_owned(self):
#     def wait(self, timeout=None):
#     def notify(self, n=1):
#     def notifyAll(self):
# def Event(*args, **kwargs):
#     def __init__(self, verbose=None):
#     def isSet(self):
#     def set(self):
#     def clear(self):
#     def wait(self, timeout=None):


# Path: vcs/subprocessio.py
import os
import subprocess
from vcs.utils.compat import deque, Event, Thread, _bytes, _bytearray

        if self.bytes:
            os.write(t, self.bytes)
        else:
            s = self.source
            b = s.read(4096)
            while b:
                os.write(t, b)
                b = s.read(4096)
        os.close(t)

    @property
    def output(self):
        return self.readiface


class InputStreamChunker(Thread):
    def __init__(self, source, target, buffer_size, chunk_size):

        super(InputStreamChunker, self).__init__()

        self.daemon = True  # die die die.

        self.source = source
        self.target = target
        self.chunk_count_max = int(buffer_size / chunk_size) + 1
        self.chunk_size = chunk_size

        self.data_added = Event()
        self.data_added.clear()


        self.keep_reading = Event()