1
from imagestore.lib.jsonobject import JSONObject, MissingValueError
4
class ImageFile(JSONObject):
5
required = ["url", "size-in-bytes", "sha256", "kind"]
8
class Image(JSONObject):
9
required = ["uri", "title", "summary"]
10
subtypes = {"files": ImageFile}
13
class ImageState(JSONObject):
14
required = ["image-uri", "status"]
17
class ImageSection(JSONObject):
21
class ImageStoreResponse(JSONObject):
22
subtypes = {"images": Image,
24
"sections": ImageSection}
27
class ImageRegistration(object):
29
def __init__(self, image):
31
self.eki = ImagePart()
32
self.eri = ImagePart()
33
self.emi = ImagePart()
35
def __eq__(self, other):
36
if type(self) is not type(other):
38
return (self.image == other.image and
39
self.eki == other.eki and
40
self.eri == other.eri and
41
self.emi == other.emi)
43
def __ne__(self, other):
44
return not self.__eq__(other)
47
class ImagePart(object):
55
def __eq__(self, other):
56
if type(self) is not type(other):
58
return (self.eid == other.eid and
59
self.size == other.size and
60
self.kind == other.kind and
61
self.sha256 == other.sha256 and
62
self.path == other.path)