(self, repo_list, lines, fmt)
Print search results from v1 or v2 API
Print search results from v1 or v2 API
Print search results from v1 or v2 API
def _search_print_lines(self, repo_list, lines, fmt):
        """Print search results from v1 or v2 API"""
        for repo in repo_list["results"]:
            if "is_official" in repo and repo["is_official"]:
                is_official = "[OK]"
            else:
                is_official = "----"
            description = ""
            for dfield in ("description", "short_description"):
                if dfield in repo and repo[dfield] is not None:
                    for char in repo[dfield]:
                        if char == '\n':
                            break
                        if char in string.printable:
                            description += char
                    break
            name = ""
            for nfield in ("name", "repo_name"):
                if nfield in repo and repo[nfield] is not None:
                    name = repo[nfield]
                    break
            stars = ""
            if "star_count" in repo and repo["star_count"] is not None:
                stars = str(repo["star_count"])
            Msg().out(fmt % (name, is_official, description, stars))
            lines -= 1
            if not lines:
                break
def _search_print_lines ( self , repo_list , lines , fmt ) : for repo in repo_list [ "results" ] : if "is_official" in repo and repo [ "is_official" ] : is_official = "[OK]" else : is_official = "----" description = "" for dfield in ( "description" , "short_description" ) : if dfield in repo and repo [ dfield ] is not None : for char in repo [ dfield ] : if char == '\n' : break if char in string . printable : description += char break name = "" for nfield in ( "name" , "repo_name" ) : if nfield in repo and repo [ nfield ] is not None : name = repo [ nfield ] break stars = "" if "star_count" in repo and repo [ "star_count" ] is not None : stars = str ( repo [ "star_count" ] ) Msg ( ) . out ( fmt % ( name , is_official , description , stars ) ) lines -= 1 if not lines : break