def listranking(format='json'): ranks = [] for x in db.findRanking(): if format == "json": ranks.append(x) else: ranks.append(x['cpe'] + " " + str(x['rank'])) return ranks
def listranking(format="json"): ranks = [] for x in db.findRanking(): if format == "json": ranks.append(x) else: ranks.append(x["cpe"] + " " + str(x["rank"])) return ranks
def findranking(cpe=None, loosy=True): if cpe is None: return False result = False if loosy: for x in cpe.split(":"): if x is not "": i = db.findRanking(cpe) if i is None: continue if "rank" in i: result = i["rank"] else: i = db.findRanking(cpe) print(cpe) if i is None: return result if "rank" in i: result = i["rank"] return result
def findranking(cpe=None, loosy=True): if cpe is None: return False result = False if loosy: for x in cpe.split(':'): if x is not '': i = db.findRanking(cpe, regex=True) if i is None: continue if 'rank' in i: result = i['rank'] else: i = db.findRanking(cpe, regex=True) print(cpe) if i is None: return result if 'rank' in i: result = i['rank'] return result
def findranking(cpe=None, loosy=True): if cpe is None: return False result = False if loosy: for x in cpe.split(':'): if x is not '': i = db.findRanking(cpe, regex=True) if i is None: continue if 'rank' in i: result = i['rank'] else: i = db.findRanking(cpe, regex=True) print (cpe) if i is None: return result if 'rank' in i: result = i['rank'] return result
def getranking(self, cpeid=None, loosy=True): if cpeid is None: return False result = False if loosy: for x in cpeid.split(':'): if x is not '': i = db.findRanking(x, regex=True) if i is None: continue if 'rank' in i: result = i['rank'] else: i = db.findRanking(cpeid, regex=True) if i is None: return result if 'rank' in i: result = i['rank'] return result
def findranking(cpe=None, loosy=True): i = None if cpe is None: return False result = False if loosy: for x in cpe.split(":"): if x is not "": i = db.findRanking(cpe, regex=True) if i is None: continue if "rank" in i: result = i["rank"] else: i = db.findRanking(cpe, regex=True) print(cpe) if i is None: return result if "rank" in i: result = i["rank"] return result