# Path: privacyscore/evaluation/description.py
# def describe_locations(server_type: str, locations: list) -> dict:
#     """Describe a list of locations."""
#     locations = [location for location in locations if location]
#     if not locations:
#         return {
#             'description': _('The locations of the %(server_type)s could not '
#                              'be detected.') % {'server_type': server_type},
#             'classification': Rating('neutral', influences_ranking=False),
#             'details_list': None
#         }
#     rating = Rating('good')
#     for country in locations:
#         if country not in GDPR_STATES:
#             rating = Rating('bad')
#     if len(locations) == 1:
#         return {
#             'description': _('All %(server_type)s are located in %(country)s.') % {
#                 'server_type': server_type,
#                 'country': locations[0],
#             }, 
#             'classification': rating,
#             'details_list': None
#         }
#     return {
#         'description': _('The %(server_type)s are located in %(countries)s.') % {
#             'server_type': server_type,
#             'countries': ', '.join(locations[:-1]) + ' and {}'.format(locations[-1])
#         },
#         'classification': rating,
#         'details_list': [(country,) for country in locations]
#     }
# 
# Path: privacyscore/evaluation/rating.py
# class Rating:
#     """
#     A rating.
# 
#     It can be critical, bad, warning, good or doubleplusgood.
#     """
#     # rating  : str
#     # influences_ranking  : bool
#     # devaluates_group : bool
# 
#     ORDERING = ['critical', 'bad', 'warning', 'neutral', 'good', 'doubleplusgood']
# 
#     def __init__(self, rating: str, influences_ranking: bool = True, devaluates_group: bool = False):
#         self.rating = rating
#         self.influences_ranking = influences_ranking
#         self.devaluates_group = devaluates_group
# 
#     def __str__(self) -> str:
#         return self.rating
# 
#     def __repr__(self) -> str:
#         return '<Rating {}>'.format(str(self))
# 
#     def __eq__(self, other) -> bool:
#         return self.rating == other.rating
# 
#     def __lt__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) < self.ORDERING.index(other.rating)
# 
#     def __le__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) <= self.ORDERING.index(other.rating)
# 
#     def __gt__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) > self.ORDERING.index(other.rating)
# 
#     def __ge__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) >= self.ORDERING.index(other.rating)


from collections import OrderedDict
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from privacyscore.evaluation.description import describe_locations
from privacyscore.evaluation.rating import Rating
        'classification': Rating('neutral', influences_ranking=False),
        'details_list': None,
        'finding': keys["mx_vulnerabilities"].get('beast')['finding']
    } if keys["mx_vulnerabilities"].get('beast') else {
        'description': _('The server is secure against the BEAST attack.'),
        'classification': Rating('good', influences_ranking=False),
        'details_list': None,
    } if keys['mx_has_ssl'] else {
        'description': _('Not checking for the BEAST vulnerability, as the server does not offer HTTPS.'),
        'classification': Rating('neutral'),
        'details_list': None
    },
    'missing': None,
}
# Check for Lucky13
# vulnerable: bad
# Else: good
CHECKS['mx']['mx_vuln_lucky13'] = {
    'keys': {'mx_vulnerabilities', 'mx_has_ssl'},
    'rating': lambda **keys: {
        'description': _('The server may be vulnerable to the LUCKY13 attack.'),
        'classification': Rating('neutral', influences_ranking=False),
        'details_list': None,
        'finding': keys["mx_vulnerabilities"].get('lucky13')['finding']
    } if keys["mx_vulnerabilities"].get('lucky13') else {
        'description': _('The server is secure against the LUCKY13 attack.'),
        'classification': Rating('good', influences_ranking=False),
        'details_list': None,
    } if keys['mx_has_ssl'] else {
        'description': _('Not checking for the LUCKY13 vulnerability, as the server does not offer HTTPS.'),

# Path: privacyscore/evaluation/description.py
# def describe_locations(server_type: str, locations: list) -> dict:
#     """Describe a list of locations."""
#     locations = [location for location in locations if location]
#     if not locations:
#         return {
#             'description': _('The locations of the %(server_type)s could not '
#                              'be detected.') % {'server_type': server_type},
#             'classification': Rating('neutral', influences_ranking=False),
#             'details_list': None
#         }
#     rating = Rating('good')
#     for country in locations:
#         if country not in GDPR_STATES:
#             rating = Rating('bad')
#     if len(locations) == 1:
#         return {
#             'description': _('All %(server_type)s are located in %(country)s.') % {
#                 'server_type': server_type,
#                 'country': locations[0],
#             }, 
#             'classification': rating,
#             'details_list': None
#         }
#     return {
#         'description': _('The %(server_type)s are located in %(countries)s.') % {
#             'server_type': server_type,
#             'countries': ', '.join(locations[:-1]) + ' and {}'.format(locations[-1])
#         },
#         'classification': rating,
#         'details_list': [(country,) for country in locations]
#     }
# 
# Path: privacyscore/evaluation/rating.py
# class Rating:
#     """
#     A rating.
# 
#     It can be critical, bad, warning, good or doubleplusgood.
#     """
#     # rating  : str
#     # influences_ranking  : bool
#     # devaluates_group : bool
# 
#     ORDERING = ['critical', 'bad', 'warning', 'neutral', 'good', 'doubleplusgood']
# 
#     def __init__(self, rating: str, influences_ranking: bool = True, devaluates_group: bool = False):
#         self.rating = rating
#         self.influences_ranking = influences_ranking
#         self.devaluates_group = devaluates_group
# 
#     def __str__(self) -> str:
#         return self.rating
# 
#     def __repr__(self) -> str:
#         return '<Rating {}>'.format(str(self))
# 
#     def __eq__(self, other) -> bool:
#         return self.rating == other.rating
# 
#     def __lt__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) < self.ORDERING.index(other.rating)
# 
#     def __le__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) <= self.ORDERING.index(other.rating)
# 
#     def __gt__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) > self.ORDERING.index(other.rating)
# 
#     def __ge__(self, other) -> bool:
#         return self.ORDERING.index(self.rating) >= self.ORDERING.index(other.rating)


# Path: privacyscore/evaluation/default_checks.py
from collections import OrderedDict
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from privacyscore.evaluation.description import describe_locations
from privacyscore.evaluation.rating import Rating

        'classification': Rating('neutral', influences_ranking=False),
        'details_list': None,
        'finding': keys["mx_vulnerabilities"].get('beast')['finding']
    } if keys["mx_vulnerabilities"].get('beast') else {
        'description': _('The server is secure against the BEAST attack.'),
        'classification': Rating('good', influences_ranking=False),
        'details_list': None,
    } if keys['mx_has_ssl'] else {
        'description': _('Not checking for the BEAST vulnerability, as the server does not offer HTTPS.'),
        'classification': Rating('neutral'),
        'details_list': None
    },
    'missing': None,
}
# Check for Lucky13
# vulnerable: bad
# Else: good
CHECKS['mx']['mx_vuln_lucky13'] = {
    'keys': {'mx_vulnerabilities', 'mx_has_ssl'},
    'rating': lambda **keys: {
        'description': _('The server may be vulnerable to the LUCKY13 attack.'),
        'classification': Rating('neutral', influences_ranking=False),
        'details_list': None,
        'finding': keys["mx_vulnerabilities"].get('lucky13')['finding']
    } if keys["mx_vulnerabilities"].get('lucky13') else {
        'description': _('The server is secure against the LUCKY13 attack.'),
        'classification': Rating('good', influences_ranking=False),
        'details_list': None,
    } if keys['mx_has_ssl'] else {
        'description': _('Not checking for the LUCKY13 vulnerability, as the server does not offer HTTPS.'),

        'classification': Rating('neutral'),