def calculatePersonalizedLinks(embeds, service, weights, rMin, rMax): categories = { "toOwnWebsite": { "rating": scaleToRating( calculatePersonalizedLinksToOwnWebsite( embeds, service, rMin["toOwnWebsite"], rMax["toOwnWebsite"], ), rMax["toOwnWebsite"], ), "weight": weights["toOwnWebsite"], }, "toThirdParties": { "rating": scaleToRating( calculatePersonalizedLinksThirdParties(embeds, service, rMin["toThirdParties"], rMax["toThirdParties"]), rMax["toThirdParties"], ), "weight": weights["toThirdParties"], }, } return calculateRating(categories)
def calculateEmailLeaks(service, embeds, weights, rMin, rMax): categories = { "spam": { "rating": scaleToRating(calculateSpam(service), rMax["spam"]), "weight": weights["spam"], }, "emailLeaks": { "rating": scaleToRating(calculateEmailLeaksThirdparties(embeds), rMax["thirdparties"]), "weight": weights["thirdparties"], }, } return calculateRating(categories)
def calculateTrackingServices(service, weights, rMin, rMax): return { "weight": weights["bigTrackers"], "rating": scaleToRating( trackers(service, rMin["smallTrackers"], rMax["bigTrackers"]), rMax["bigTrackers"], ), }
def calculateABTesting(service, weight, rMin, rMax): if service["suspected_AB_testing"]: rating = 1 else: rating = 0 return { "weight": weight, "rating": scaleToRating(rating, rMax), }
def calculateABTesting(service, weight, rMin, rMax): idents = Identity.objects.filter(service=service) if Mail.objects.filter(identity__in=idents, identity__approved=True, possible_AB_testing=True).exists(): rating = 1 else: rating = 0 return { "weight": weight, "rating": scaleToRating(rating, rMax), }
def calculateCDNs(service, weight, rMin, rMax): return { "weight": weight, "rating": scaleToRating(CDNs(service, rMin, rMax), rMax), }