fix flake error as suggested
This commit is contained in:
1 parent
7eef61bfde
commit
2f0dbf5cbb
4 files changed
+186
-163
No files matched your search
@@ -0,0 +1,28 @@
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
class PacketBuffer(object):
|
||||
def __init__(self):
|
||||
self.bytes = BytesIO()
|
||||
|
||||
def send(self, value):
|
||||
"""
|
||||
Writes the given bytes to the buffer, designed to emulate socket.send
|
||||
:param value: The bytes to write
|
||||
"""
|
||||
self.bytes.write(value)
|
||||
|
||||
def read(self, length=None):
|
||||
return self.bytes.read(length)
|
||||
|
||||
def recv(self, length=None):
|
||||
return self.read(length)
|
||||
|
||||
def reset(self):
|
||||
self.bytes = BytesIO()
|
||||
|
||||
def reset_cursor(self):
|
||||
self.bytes.seek(0)
|
||||
|
||||
def get_writable(self):
|
||||
return self.bytes.getvalue()
|
||||
Reference in new issue
Block a user