changeset 30435 | b86a448a2965 |
child 30895 | c32454d69b85 |
30434:2e484bdea8c4 | 30435:b86a448a2965 |
---|---|
1 import io |
|
2 |
|
3 class OpCountingBytesIO(io.BytesIO): |
|
4 def __init__(self, *args, **kwargs): |
|
5 self._read_count = 0 |
|
6 self._write_count = 0 |
|
7 return super(OpCountingBytesIO, self).__init__(*args, **kwargs) |
|
8 |
|
9 def read(self, *args): |
|
10 self._read_count += 1 |
|
11 return super(OpCountingBytesIO, self).read(*args) |
|
12 |
|
13 def write(self, data): |
|
14 self._write_count += 1 |
|
15 return super(OpCountingBytesIO, self).write(data) |