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


Python Search.add_relationship_search_filter方法代码示例

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


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

示例1: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_relationship_search_filter [as 别名]
    def preprocess(my):
        # find out if there is a snapshot associated with this path
        #print "sobject: ", my.sobject

        #context = "design/%s" % basename
        #search = Search("sthpw/snapshot")
        #search.add_filter("context", context)
        #my.sobject = search.get_sobject()

        search_key = my.kwargs.get("search_key")
        my.sobject = Search.get_by_search_key(search_key)

        md5s = my.kwargs.get("md5s")
        sizes = my.kwargs.get("sizes")

        # bit of a hack get the file system paths
        spaths = []
        my.md5s = {}
        my.sizes = {}
        for i, path in enumerate(my.paths):
            #path = Common.get_filesystem_name(path)
            #new_path = path.replace(" ", "_")
            new_path = path
            spaths.append(new_path)

            my.md5s[new_path] = md5s.get(path)
            my.sizes[new_path] = sizes.get(path)


        process = my.kwargs.get("process")

        # need to match up files 
        search = Search("sthpw/file")
        search.add_sobject_filter(my.sobject)
        snapshots = []
        if process:
            search2 = Search("sthpw/snapshot")
            search2.add_filter("process", process)
            search2.add_filter("is_latest", True)
            search2.add_sobject_filter(my.sobject)
            snapshots = search2.get_sobjects()
            search.add_relationship_search_filter(search2)
        #search.add_filters("source_path", spaths)
        sobjects = search.get_sobjects()

        my.snapshots_dict = {}
        for snapshot in snapshots:
            my.snapshots_dict[snapshot.get_code()] = snapshot


        my.base_dir = my.kwargs.get("base_dir")
        my.checked_in_paths = {}
        for sobject in sobjects:
            source_path = sobject.get_value("source_path")
            if not source_path:
                print "WARNING: source_path for file [%s] is empty" % sobject.get_code()
                continue
            my.checked_in_paths[source_path] = sobject

            relative_dir = sobject.get_value("relative_dir")
            file_name = sobject.get_value("file_name")
            file_name = os.path.basename(source_path)
            relative_path = "%s/%s" % (relative_dir, file_name)

            sandbox_dir = Environment.get_sandbox_dir()
            sandbox_path = "%s/%s" % (sandbox_dir, relative_path)
            my.checked_in_paths[sandbox_path] = sobject



        # this is advanced option
        my.context_options = my.kwargs.get("context_options")

        my.subcontext_options = my.kwargs.get("subcontext_options")
        if not my.subcontext_options:
            my.subcontext_options = []


        my.preselected = my.kwargs.get("preselected")
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:81,代码来源:checkin_dir_list_wdg.py


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