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


Python Folders.delete方法代码示例

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


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

示例1: test_delete_invld

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
    def test_delete_invld(self):
        """Test deletion of a folder we can't access."""
        dirpath = tempfile.mkdtemp()

        os.chmod(dirpath, 0)
        with pytest.raises(CuckooOperationalError):
            Folders.delete(dirpath)

        os.chmod(dirpath, 0775)
        Folders.delete(dirpath)
开发者ID:consen,项目名称:cuckoo,代码行数:12,代码来源:test_utils.py

示例2: tasks_delete

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
def tasks_delete(task_id):
    response = {}

    task = db.view_task(task_id)
    if not task:
        return json_error(404, "Task not found")

    if task.status == TASK_RUNNING:
        return json_error(
            500, "The task is currently being processed, cannot delete"
        )

    if not db.delete_task(task_id):
        return json_error(
            500, "An error occurred while trying to delete the task"
        )

    Folders.delete(cwd("storage", "analyses", "%d" % task_id))
    response["status"] = "OK"
    return jsonify(response)
开发者ID:CERT-Polska,项目名称:cuckoo,代码行数:22,代码来源:api.py

示例3: task_delete

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
    def task_delete(request, task_id):
        """
        Deletes a task
        :param body: required: task_id
        :return:
        """
        task = db.view_task(task_id)
        if task:
            if task.status == TASK_RUNNING:
                return json_fatal_response("The task is currently being "
                                           "processed, cannot delete")

            if db.delete_task(task_id):
                Folders.delete(os.path.join(cwd(), "storage",
                                            "analyses", "%d" % task_id))
            else:
                return json_fatal_response("An error occurred while trying to "
                                           "delete the task")
        else:
            return json_error_response("Task not found")

        return JsonResponse({"status": True})
开发者ID:LetMeR00t,项目名称:cuckoo,代码行数:24,代码来源:api.py

示例4: test_delete_folder2

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import delete [as 别名]
 def test_delete_folder2(self):
     """Tests folder deletion #2."""
     Folders.create(self.tmp_dir, "foo")
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     Folders.delete(self.tmp_dir, "foo")
     assert not os.path.exists(os.path.join(self.tmp_dir, "foo"))
开发者ID:consen,项目名称:cuckoo,代码行数:8,代码来源:test_utils.py


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