• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python search.Search类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: searchAction

        def searchAction(event):
            try:
                global query
                global mTime
                mTime = StringVar(None)
                query = StringVar(None)
                search_ = Search()
                query = self.searchEntry1.get()

                if query not in (None, '', ' '):
                    start_time = time.time()
                    global title_url
                    title_url = [None]
                    raw = search_.fetch_url(query)
                    title_url = search_.process_url(raw)
                    self.masters.withdraw()
                    mTime = (time.time() - start_time)
                    self.guiresults()
                    self.timeLabelres = Label(self.masters, text="--- %s seconds ---" % (mTime), font=('arial',8))
                    self.timeLabelres.place(x=150,y=630)
                    
                else:
                    tkMessageBox.showinfo('Info', 'You must put a keyword')
            except Exception as e:
                    tkMessageBox.showinfo('Info', 'No Internet Connection Try Again Later')
                    exit()
开发者ID:worstusernameiveevermade,项目名称:web-retrieval,代码行数:26,代码来源:UI.py


示例2: GET

 def GET(self):
     logging.debug(self.input)
     userName = auth.uuap_sso()
     products = auth.getProcByName(userName)
     if products==None or len(products)==0:
         web.config.session.kill()
         return render.forbidden(userName)
     if self.input == None or len(self.input) == 0:
         return render.manage(userName, products, web.ctx.homedomain)
     #更新树形菜单
     if self.input['oper'] == 'updatelist':
         #检查文件夹是否存在,不存在则创建
         dirPath = 'data/updateflag'
         product = self.input['product']
         updateflag = '%s/%s' % (dirPath,product)
         if not os.path.exists(dirPath):
             os.makedirs(dirPath)
         #创建更新标志文件以触发updatelist.sh的更新任务
         f = open(updateflag, 'w')
         f.close()
         while os.path.exists(updateflag):
             time.sleep(0.1)
         return json.dumps({'code':200,'txt':u'更新成功'})
     elif self.input['oper'] == 'search':
         s = Search(self.input)
         return s.search()
开发者ID:actank,项目名称:zmon,代码行数:26,代码来源:manage.py


示例3: BookSearchTests

class BookSearchTests(WLTestCase):
    def setUp(self):
        WLTestCase.setUp(self)

        index = Index()
        self.search = Search()
        index.delete_query(self.search.index.query(uid="*"))
        index.index.commit()

        with self.settings(NO_SEARCH_INDEX=False):
            self.do_doktora = Book.from_xml_file(
                get_fixture('do-doktora.xml', opds))
            self.do_anusie = Book.from_xml_file(
                get_fixture('fraszka-do-anusie.xml', catalogue))

    def test_search_perfect_book_author(self):
        books = self.search.search_books(self.search.index.query(authors=u"sęp szarzyński"))
        assert len(books) == 1
        assert books[0].id == self.do_anusie.id

        # here we lack slop functionality as well
    def test_search_perfect_book_title(self):
        books = self.search.search_books(self.search.index.query(title=u"fraszka do anusie"))
        assert len(books) == 1
        assert books[0].id == self.do_anusie.id
开发者ID:BibliotekaOtwartejNauki,项目名称:wolnelektury,代码行数:25,代码来源:index.py


示例4: memory_search_api

def memory_search_api():
    source = request.args.get('source')
    target = request.args.get('target')
    project = request.args.get('project')

    search = Search(source, target, project)
    return Response(search.get_json(), mimetype='application/json')
开发者ID:txemaq,项目名称:translation-memory-tools,代码行数:7,代码来源:web_search.py


示例5: searchMatchesFound

 def searchMatchesFound(self, searchString=None):
     """ Helper function used to return the number of search results """
     self.startCoverage("searchMatchesFound")
     s = Search(self)
     result = s.searchMatchesFound(searchString)
     self.endCoverage()
     return result
开发者ID:AnithaT,项目名称:eden,代码行数:7,代码来源:actions.py


示例6: run

  def run(self):
    
       
    # Main loop
    while True:
      # Perform a simulation step of 64 milliseconds
      # and leave the loop when the simulation is over
      if self.step(64) == -1:
        break
      
      #self.forward()
      # Read the sensors:
      prox = self.get_proximities()
      #arg1 = self.get_lights()
      #arg2 = self.get_accelleration()
      # Process sensor data here.

      SearchObject = Search()
      output1 = SearchObject.determine_action(prox)

      if(output1[0]):
        speeds = output1[1]
        self.move_wheels(speeds[0],speeds[1],1.0)
      else:
        self.stop()
      #Search.determine_action(True)
      #Stagnation.determine_action(True)
      
      # Enter here functions to send actuator commands, like:
      print output1
开发者ID:LoudRobed,项目名称:swarm-epuck,代码行数:30,代码来源:swarm_controller.py


示例7: search_json

def search_json():
    keyword = request.data
    para = json.loads(keyword)['keyword']
    c_log('search', para).save()
    target = Search()
    if keyword == None:
        return 'NONE'
    return target.fetch(para, 3, 1)  # keyword limit isjson
开发者ID:yiyizhai,项目名称:zone_blog,代码行数:8,代码来源:application.py


示例8: go_search

def go_search(query, need_suggest=True):
    search = Search()
    if (need_suggest):
        suggest = search.generate_suggest(query)
    else:
        suggest = ""
    result = search.go(query)
    return result, suggest
开发者ID:ialibekov,项目名称:infoproject,代码行数:8,代码来源:views.py


示例9: search_projects

def search_projects(request):
    '''
    comments
    '''
    if request.method == 'GET':
        search      = Search(request)
        context = search.get_search_context(search.SEARCH_PROJECTS)
        return render_to_response('project_search_results.html', context)
开发者ID:mtpoutanen,项目名称:lbog,代码行数:8,代码来源:views.py


示例10: get_search_results

def get_search_results():
    try:
        search_text = request.json['search-text']
        s = Search( search_text )
        results = s.search()
        return render_template( 'search_results.html', results=results), 200
    except ValueError, e:
        return render_template( 'search_error.html', errortext=str(e))
开发者ID:roshow,项目名称:xwlists,代码行数:8,代码来源:xwlists.py


示例11: search_developers

def search_developers(request):
    '''
    comments
    '''
    if request.method == 'GET':
        search      = Search(request)
        context = search.get_search_context(search.SEARCH_DEVELOPERS)
        return render_to_response('developer_search_results.html', context)
开发者ID:mtpoutanen,项目名称:lbog,代码行数:8,代码来源:views.py


示例12: ask_for_URLs

 def ask_for_URLs(self):
     """ 1) Envoie une recherche en background de fichiers similaires
     2) Lorsque les urls sont arrivées, set_URLs met à jour les urls puis appelle manage_download
     3) _ftp.Manage_download ajoute des urls pour aider au download"""
     print "Asking for urls"
     search = Search(self.file_share.name, self.file_share.protocol)
     # Signal
     self.resultsReceived.connect(self.set_URLs)
     search.do_search(self.resultsReceived.emit)
开发者ID:MaximeCheramy,项目名称:pyrex,代码行数:9,代码来源:downloads.py


示例13: autocomplete_api

def autocomplete_api(word):
    word = word + u"*" 
    lang = request.args.get('lang')
    if lang is None:
        search = Search(word)
    else:
        search = Search(word, lang)

    search.AutoComplete = True
    return json_answer(search.get_json())
开发者ID:Softcatala,项目名称:diccionari-multilingue,代码行数:10,代码来源:web_search.py


示例14: dict_index

def dict_index(lletra):
    start = lletra.find('?')
    if start != -1:
        lletra = lletra[:start]

    search = Search(lletra)
    search.Index = True
    search.Duplicates = False
    View = IndexView(lletra)
    result = View.do(search)
    return result
开发者ID:Softcatala,项目名称:diccionari-multilingue,代码行数:11,代码来源:web_search.py


示例15: search_files

def search_files():
    keyword = request.GET.get('w')
    if len(keyword) > 0:
        keyword = keyword.strip()
        
    s = Search(os.getcwd(), keyword.decode("utf-8"), ("*.markdown", "*.md"))
    result = s.walk()

    result = [x for x in result if x[1] is not None]
    result = map(lambda x : [x[0][len(os.getcwd()):len(x[0])], x[1]], result)
    return dict(results = result, keyword = keyword, request = request)
开发者ID:liuchaofeng1230,项目名称:mdserver,代码行数:11,代码来源:mdserver.py


示例16: get_issues_with_label

def get_issues_with_label():
	i = 0
	y = 0
	for label in labels:
		issues = Search(search_query + "AND labels = '%s'" % label)
		print(label)
		print("%s total issues. %s total points.") % (
			issues.get_issue_count(), issues.get_point_sum())
		i = i + issues.get_point_sum()
		y = y + issues.get_issue_count()
	print("Total issues: %s Total Points: %s") % (y, i)
开发者ID:joeracker,项目名称:jiraTracker,代码行数:11,代码来源:ea_progress.py


示例17: run

	def run(self):
		search = Search(DATABASE_FILE_NAME)

		# Search!
		result_list = search.search(self.term)

		# Create an HTML file and open it in the default browser
		name = self.generate_html_file(result_list)
		webbrowser.open('file://' + name)

		# Re-enable the search button
		self.app.button.config(text='Search', state=ACTIVE)
开发者ID:OpenSourceInternetV2,项目名称:magnet-archive-viewer,代码行数:12,代码来源:app.py


示例18: search_api

def search_api(word):
    lang = request.args.get('lang')
    it = request.args.get('it')
    if lang is None:
        search = Search(word)
    else:
        search = Search(word, lang)

    if it is None and is_tracking_enabled():
        save_stats(word, lang)

    return json_answer(search.get_json())
开发者ID:Softcatala,项目名称:diccionari-multilingue,代码行数:12,代码来源:web_search.py


示例19: TestSkipListMerging

class TestSkipListMerging(unittest.TestCase):
    def get_skipList(self, length):
        lst = SkipList()
        data = sorted([random.randint(0, length*4) for i in range(0, length)])
        for i in range(0, length):
            lst.append(data[i]) # TODO:swap out with SkipList(data)
        return lst

    def setUp(self):
        self.la = self.get_skipList(10)
        self.lb = self.get_skipList(20)
        self.lc = self.get_skipList(20)
        postings_file = "dev_postings.data"
        dictionary_file = "dev_dict.data"
        self.search = Search(postings_file, dictionary_file)

    def list_equality(self, lsta, lstb):
        try:
            self.assertEqual(len(lsta), len(lstb))
            self.assertEqual(lsta.get_list(), lstb.get_list())
        except AssertionError as e:
            logging.info(lsta)
            logging.info(lstb)
            print lsta
            print lstb
            raise e

    def test_mergingSingleListShouldReturnTheList(self):
        """
        A single skip list should just be casted into a simple list and returned
        """
        results = self.search.merge_results(Operation.AND, self.la)
        self.list_equality(self.la, results)

    def test_mergingTwoListsORshouldReturnUnion(self):
        results = self.search.merge_results(Operation.OR, self.la, self.lb)
        # results = self.search.merge_two_list(self.la, self.lb, Operation.OR)
        la = self.la.get_list()
        la.extend(self.lb.get_list())
        la = list(set(la))
        la.sort()
        self.list_equality(results, SkipList(la))

    def test_mergingTwoListsOverANDshouldReturnIntersection(self):
        results = self.search.merge_results(Operation.AND, self.la, self.lb)
        # results = self.search.merge_two_list(self.la, self.lb, Operation.AND)
        la = set(self.la.get_list())
        lb = set(self.lb.get_list())
        ls = la & lb
        ls = list(ls)
        ls.sort()
        self.list_equality(results, SkipList(ls))
开发者ID:darora,项目名称:cs3245,代码行数:52,代码来源:tests.py


示例20: get_next_redo

    def get_next_redo():
        from pyasm.biz import Project
        namespace = Project.get_project_code()

        user_name = Environment.get_user_name()
        search = Search("sthpw/transaction_log")
        search.add_filter("login", user_name)
        search.add_filter("namespace", namespace)
        
        search.add_filter("type", "redo")
        search.add_order_by("timestamp")
        sobject = search.get_sobject()
        return sobject
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:13,代码来源:transaction_log.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.perform_search函数代码示例发布时间:2022-05-27
下一篇:
Python search.search函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap