mirror of
https://github.com/openkmip/pykmip
synced 2025-12-21 18:53:15 +00:00
Adding support for the Query operation
This change adds support for the Query operation, including updates to the KMIP client and core object libraries, the KMIP client and core unit test suites, and a Query unit demo.
This commit is contained in:
@@ -66,7 +66,7 @@ def build_er_error(class_object, descriptor, expected, received,
|
||||
class BytearrayStream(io.RawIOBase):
|
||||
def __init__(self, data=None):
|
||||
if data is None:
|
||||
self.buffer = b''
|
||||
self.buffer = bytes()
|
||||
else:
|
||||
self.buffer = bytes(data)
|
||||
|
||||
@@ -81,10 +81,11 @@ class BytearrayStream(io.RawIOBase):
|
||||
return data
|
||||
|
||||
def readall(self):
|
||||
data = self.buffer[0:]
|
||||
self.buffer = self.buffer[len(self.buffer):]
|
||||
data = self.buffer
|
||||
self.buffer = bytes()
|
||||
return data
|
||||
|
||||
# TODO (peter-hamilton) Unused, add documentation or cut.
|
||||
def readinto(self, b):
|
||||
if len(b) <= len(self.buffer):
|
||||
num_bytes_to_read = len(b)
|
||||
@@ -117,6 +118,17 @@ class BytearrayStream(io.RawIOBase):
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, BytearrayStream):
|
||||
return (self.buffer == other.buffer)
|
||||
if len(self.buffer) != len(other.buffer):
|
||||
return False
|
||||
elif self.buffer != other.buffer:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
else:
|
||||
return NotImplemented
|
||||
|
||||
def __ne__(self, other):
|
||||
if isinstance(other, BytearrayStream):
|
||||
return not (self == other)
|
||||
else:
|
||||
return NotImplemented
|
||||
|
||||
Reference in New Issue
Block a user