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


Python search.Search类代码示例

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


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


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