ToolTipHelper.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:ToolTip-Helper 作者: doobleweb 项目源码 文件源码
def match_selection(self, sel, tooltip_files, scope):
        """ this method take care to the results, links and the keys which be implemented in the tooltip """
        results = []
        count = 0
        dynamic_doc_arr = self.search_for_dynamic_doc(sel, scope)
        if dynamic_doc_arr:
            results += dynamic_doc_arr
        else:
            self.logger_msg += 'There is no documentation in dynamic doc\n'

        for file in tooltip_files: 
            # search the parameter in json file
            json_result = self.search_in_json(sel, file['file_name'])
            items = []
            if isinstance(json_result, dict):
                items.append(json_result)
            elif isinstance(json_result, list):
                items += json_result

            for item in items:
                result = {}
                if item:
                    result['json_result'] = item
                    result['file_name'] = file['file_name']
                    # get the correct link for the result
                    if 'link' not in item and \
                        'link' in file:
                        result['link'] = file['link']
                    results.append(result)
                    # get the keys from the result
                    keys = list(item.keys())
                    # add key to keyorder and count the change
                    count += self.update_keyorder_list(keys)
        # if there is one change, save it in settings.
        if count != 0:
            self.save_keyorder_list()
        return results
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号