Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.PUT(req, body=body)
#self.id.links.create_external(name, self._e(obj.filename),
# self._e(obj.path), lcpl=lcpl, lapl=self._lapl)
elif isinstance(obj, numpy.dtype):
# print "create named type"
type_json = h5type.getTypeItem(obj)
req = "/datatypes"
body = {'type': type_json }
rsp = self.POST(req, body=body)
body['id'] = rsp['id']
body['lastModified'] = rsp['lastModified']
type_id = TypeID(self, body)
req = "/groups/" + self.id.uuid + "/links/" + name
body = {'id': type_id.uuid }
self.PUT(req, body=body)
#htype = h5t.py_create(obj)
#htype.commit(self.id, name, lcpl=lcpl)
else:
pass #todo
#ds = self.create_dataset(None, data=obj, dtype=base.guess_dtype(obj))
def __init__(self, bind):
""" Create a new Datatype object by binding to a low-level TypeID.
"""
if not isinstance(bind, TypeID):
# todo: distinguish type from other hl objects
raise ValueError("%s is not a TypeID" % bind)
HLObject.__init__(self, bind)
self._dtype = createDataType(self.id.type_json)
self._req_prefix = "/datatypes/" + self.id.uuid
else:
return False
else:
return False
tgt = None
if isinstance(name, h5type.Reference):
tgt = name.objref() # weak reference to ref object
if tgt is not None:
return tgt # ref'd object has not been deleted
if isinstance(name.id, GroupID):
tgt = getObjByUuid(name.id.uuid, collection_type="groups")
elif isinstance(name.id, DatasetID):
tgt = getObjByUuid(name.id.uuid, collection_type="datasets")
elif isinstance(name.id, TypeID):
tgt = getObjByUuid(name.id.uuid, collection_type="datasets")
else:
raise IOError("Unexpected Error - ObjectID type: " + name.__class__.__name__)
return tgt
if isUUID(name):
tgt = getObjByUuid(name)
return tgt
parent_uuid, link_json = self._get_link_json(name)
link_class = link_json['class']
if link_class == 'H5L_TYPE_HARD':
tgt = getObjByUuid(link_json['id'], collection_type=link_json['collection'])
elif link_class == 'H5L_TYPE_SOFT':
def __init__(self, parent):
""" Private constructor.
"""
self._parent = parent
if isinstance(parent.id, GroupID):
self._req_prefix = "/groups/" + parent.id.uuid + "/attributes/"
elif isinstance(parent.id, TypeID):
self._req_prefix = "/datatypes/" + parent.id.uuid + "/attributes/"
elif isinstance(parent.id, DatasetID):
self._req_prefix = "/datasets/" + parent.id.uuid + "/attributes/"
else:
# "unknown id"
self._req_prefix = ""
objdb = self._parent.id.http_conn.getObjDb()
if objdb:
# _objdb is meta-data pulled from the domain on open.
# see if we can extract the link json from there
objid = self._parent.id.uuid
if objid not in objdb:
raise IOError("Expected to find {} in objdb".format(objid))
obj_json = objdb[objid]
self._objdb_attributes = obj_json["attributes"]
else: