Esempio n. 1
0
 def search(pkg):
     success = True
     phrases = parse_search_phrase(param)
     for phrase in phrases:
         if phrase not in pkg['short_description']:
             success = False
             break
     return success
Esempio n. 2
0
 def search(pkg):
     success = True
     phrases = parse_search_phrase(param)
     for phrase in phrases:
         if phrase not in pkg['name']:
             success = False
             break
     return success
Esempio n. 3
0
 def search(pkg):
     success = True
     phrases = parse_search_phrase(param)
     for phrase in phrases:
         success_loop = False
         for author in pkg['authors']:
             if phrase in author:
                 success_loop = True
                 break
         if not success_loop:
             success = False
             break
     return success
Esempio n. 4
0
 def search(pkg):
     success = True
     phrases = parse_search_phrase(param)
     for phrase in phrases:
         success_loop = False
         for k, v in pkg['screenshots'].items():
             if phrase in v:
                 success_loop = True
                 break
         if not success_loop:
             success = False
             break
     return success
Esempio n. 5
0
        def search(pkg):
            phrases = parse_search_phrase(param)
            for phrase in phrases:
                found = False
                for k in ["name", "description", "short_description"]:
                    if phrase.lower() in pkg[k].lower():
                        found = True
                        break
                if found:
                    continue

                for k in ["owners", "authors", "license", "tags"]:
                    for v in pkg[k]:
                        if phrase.lower() in v.lower():
                            found = True
                            break
                    if found:
                        break
                if found:
                    continue

                for k, screenshot in pkg["screenshots"].items():
                    if phrase.lower() in screenshot.lower():
                        found = True
                        break
                if found:
                    continue

                for k, version in pkg["versions"].items():
                    if phrase.lower() in version["changes"].lower():
                        found = True
                        break
                if found:
                    continue

                # If we reached this line, `continue` lines weren't executed.
                # It means that the phrase was not found.
                # As all phrases must be found, we terminate the loop.
                return False

            return True