

def _open_streams(self, remainder):
    '\n        A common method of counting number of open streams. Returns the number\n        of streams that are open *and* that have (stream ID % 2) == remainder.\n        While it iterates, also deletes any closed streams.\n        '
    count = 0
    to_delete = []
    for (stream_id, stream) in self.streams.items():
        if (stream.open and ((stream_id % 2) == remainder)):
            count += 1
        elif stream.closed:
            to_delete.append(stream_id)
    for stream_id in to_delete:
        del self.streams[stream_id]
    return count

dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py H2Connection._open_streams/original