当前位置: 首页>>代码示例>>Python>>正文


Python BlitzGateway.deleteObjects方法代码示例

本文整理汇总了Python中omero.gateway.BlitzGateway.deleteObjects方法的典型用法代码示例。如果您正苦于以下问题:Python BlitzGateway.deleteObjects方法的具体用法?Python BlitzGateway.deleteObjects怎么用?Python BlitzGateway.deleteObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在omero.gateway.BlitzGateway的用法示例。


在下文中一共展示了BlitzGateway.deleteObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSimpleDelete

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import deleteObjects [as 别名]
    def testSimpleDelete(self):
        filename = self.unique_dir + "/file.txt"
        mrepo = self.getManagedRepo()
        ofile = self.createFile(mrepo, filename)
        gateway = BlitzGateway(client_obj=self.client)

        # Assert contents of file
        rfs = mrepo.fileById(ofile.id.val)
        try:
            assert "hi" ==  rfs.read(0, 2)
        finally:
            rfs.close()

        handle = gateway.deleteObjects("/OriginalFile", [ofile.id.val])
        try:
            gateway._waitOnCmd(handle)
        finally:
            handle.close()

        # Trying to open the file should not throw an UnregisteredFileException
        # But should just be an empty file.
        rfs = mrepo.file(filename, "rw")
        try:
            assert "\x00\x00" ==  rfs.read(0, 2)
        finally:
            rfs.close()
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:28,代码来源:test_repository.py

示例2: testCmdDeleteCantDeleteDirectories

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import deleteObjects [as 别名]
    def testCmdDeleteCantDeleteDirectories(self):
        id = self.dir_map[self.dir_key]["id"]

        gateway = BlitzGateway(client_obj=self.client)
        handle = gateway.deleteObjects("/OriginalFile", [id])
        try:
            pytest.raises(Exception,
                    gateway._waitOnCmd, handle, failonerror=True)
        finally:
            handle.close()
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:12,代码来源:test_repository.py

示例3: createProject

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import deleteObjects [as 别名]

projectId1 = createProject()
projectId2 = createProject()


# Delete Project
# ==============
# You can delete a number of objects of the same type at the same
# time. In this case 'Project'. Use deleteChildren=True if you are
# deleting a Project and you want to delete Datasets and Images.
# We use wait=True so that the async delete completes.
obj_ids = [projectId1]
deleteChildren = False
conn.deleteObjects(
    "Project", obj_ids, deleteAnns=True,
    deleteChildren=deleteChildren, wait=True)


# Delete Project, handling response
# =================================
# If you want to know when delete is finished or if there were
# any errors, then we can use a callback to wait for response
handle = conn.deleteObjects("Project", [projectId2])
cb = omero.callbacks.CmdCallbackI(conn.c, handle)
print "Deleting, please wait."
while not cb.block(500):
    print "."
err = isinstance(cb.getResponse(), omero.cmd.ERR)
print "Error?", err
if err:
开发者ID:kennethgillen,项目名称:openmicroscopy,代码行数:32,代码来源:Delete.py

示例4: TableConnection

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import deleteObjects [as 别名]

#.........这里部分代码省略.........

        if not ofile:
            raise TableConnectionError('No table found with name:%s id:%s' %
                                       (tableName, tableId))

        if self.tableId == ofile.getId():
            print 'Using existing connection to table name:%s id:%d' % \
                (tableName, tableId)
        else:
            self.closeTable()
            self.table = self.res.openTable(ofile._obj)
            self.tableId = ofile.getId()
            print 'Opened table name:%s id:%d' % (tableName, self.tableId)

        try:
            print '\t%d rows %d columns' % \
                (self.table.getNumberOfRows(), len(self.table.getHeaders()))
        except omero.ApiUsageException:
            pass

        self.tableId = tableId
        return self.table


    def deleteAllTables(self):
        """
        Delete all tables with self.tableName
        Will fail if there are any annotation links
        """
        ofiles = self.conn.getObjects("OriginalFile", \
            attributes = {'name': self.tableName})
        ids = [f.getId() for f in ofiles]
        print 'Deleting ids:%s' % ids
        self.conn.deleteObjects('OriginalFile', ids)


    def dumpTable(self, table):
        """
        Print out the table
        """
        headers = table.getHeaders()
        print ', '.join([t.name for t in headers])
        nrows = table.getNumberOfRows()
        #data = table.readCoordinates(xrange(table.getNumberOfRows))

        for r in xrange(nrows):
            data = table.read(range(len(headers)), r, r + 1)
            print ', '.join(['%.2f' % c.values[0] for c in data.columns])


    def closeTable(self):
        """
        Close the table if open, and set table and tableId to None
        """
        try:
            if self.table:
                self.table.close()
        finally:
            self.table = None
            self.tableId = None


    def newTable(self, schema):
        """
        Create a new uninitialised table
        @param schema the table description
开发者ID:manics,项目名称:alternative-storage,代码行数:70,代码来源:TableConnection.py

示例5: isinstance

# 需要导入模块: from omero.gateway import BlitzGateway [as 别名]
# 或者: from omero.gateway.BlitzGateway import deleteObjects [as 别名]
    import sys

    sys.stderr.write("Error: Object does not exist.\n")
    sys.exit(1)

print "\nProject:", project.getName()


# Delete Project
# =================================================================
# You can delete a number of objects of the same type at the same
# time. In this case 'Project'. Use deleteChildren=True if you are
# deleting a Project and you want to delete Datasets and Images.
obj_ids = [projectId]
deleteChildren = False
handle = conn.deleteObjects("Project", obj_ids, deleteAnns=True, deleteChildren=deleteChildren)


# Retrieve callback and wait until delete completes
# =================================================================
# This is not necessary for the Delete to complete. Can be used
# if you want to know when delete is finished or if there were any errors
cb = omero.callbacks.CmdCallbackI(conn.c, handle)
print "Deleting, please wait."
while not cb.block(500):
    print "."
err = isinstance(cb.getResponse(), omero.cmd.ERR)
print "Error?", err
if err:
    print cb.getResponse()
cb.close(True)  # close handle too
开发者ID:sbesson,项目名称:openmicroscopy,代码行数:33,代码来源:Delete.py


注:本文中的omero.gateway.BlitzGateway.deleteObjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。