# Path: validator/decorator.py
# def version_range(guid, version, before=None, app_versions=None):
#     """Returns all values after (and including) `version` for the app `guid`"""
# 
#     if app_versions is None:
#         app_versions = validator.constants.APPROVED_APPLICATIONS
#     app_key = None
# 
#     # Support for shorthand instead of full GUIDs.
#     for app_guid, app_name in APPLICATIONS.items():
#         if app_name == guid:
#             guid = app_guid
#             break
# 
#     for key in app_versions.keys():
#         if app_versions[key]['guid'] == guid:
#             app_key = key
#             break
# 
#     if not app_key or version not in app_versions[app_key]['versions']:
#         raise Exception('Bad GUID or version provided for version range: %s'
#                         % version)
# 
#     all_versions = app_versions[app_key]['versions']
#     version_pos = all_versions.index(version)
#     before_pos = None
#     if before is not None and before in all_versions:
#         before_pos = all_versions.index(before)
# 
#     return all_versions[version_pos:before_pos]


from fnmatch import fnmatch as fnm
from validator.constants import (FF4_MIN, FIREFOX_GUID, FENNEC_GUID,
                                 THUNDERBIRD_GUID as TB_GUID, ANDROID_GUID,
                                 PACKAGE_DICTIONARY, )
from validator.decorator import version_range
import validator.decorator as decorator
                             'policies/reviews#section-binary'
                             ' for more information on the binary content '
                             'review process.',
                             '\n'.join(flagged_files)),
                editors_only=True,
                signing_help=HELP,
                signing_severity='medium',
                filename=', '.join(flagged_files))


@decorator.register_test(tier=1)
def test_godlikea(err, xpi_package):
    """Test to make sure that the godlikea namespace is not in use."""

    if 'chrome/godlikea.jar' in xpi_package:
        err.error(
            err_id=('testcases_packagelayout',
                    'test_godlikea'),
            error="Banned 'godlikea' chrome namespace",
            description="The 'godlikea' chrome namepsace is generated from a "
                        'template and should be replaced with something '
                        'unique to your add-on to avoid name conflicts.',
            filename='chrome/godlikea.jar')


@decorator.register_test(
        tier=5,
        versions={FIREFOX_GUID: version_range('firefox', FF4_MIN),
                  TB_GUID: version_range('thunderbird', '3.3a4pre'),
                  FENNEC_GUID: version_range('fennec', '4.0'),

# Path: validator/decorator.py
# def version_range(guid, version, before=None, app_versions=None):
#     """Returns all values after (and including) `version` for the app `guid`"""
# 
#     if app_versions is None:
#         app_versions = validator.constants.APPROVED_APPLICATIONS
#     app_key = None
# 
#     # Support for shorthand instead of full GUIDs.
#     for app_guid, app_name in APPLICATIONS.items():
#         if app_name == guid:
#             guid = app_guid
#             break
# 
#     for key in app_versions.keys():
#         if app_versions[key]['guid'] == guid:
#             app_key = key
#             break
# 
#     if not app_key or version not in app_versions[app_key]['versions']:
#         raise Exception('Bad GUID or version provided for version range: %s'
#                         % version)
# 
#     all_versions = app_versions[app_key]['versions']
#     version_pos = all_versions.index(version)
#     before_pos = None
#     if before is not None and before in all_versions:
#         before_pos = all_versions.index(before)
# 
#     return all_versions[version_pos:before_pos]


# Path: validator/testcases/packagelayout.py
from fnmatch import fnmatch as fnm
from validator.constants import (FF4_MIN, FIREFOX_GUID, FENNEC_GUID,
                                 THUNDERBIRD_GUID as TB_GUID, ANDROID_GUID,
                                 PACKAGE_DICTIONARY, )
from validator.decorator import version_range
import validator.decorator as decorator

                             'policies/reviews#section-binary'
                             ' for more information on the binary content '
                             'review process.',
                             '\n'.join(flagged_files)),
                editors_only=True,
                signing_help=HELP,
                signing_severity='medium',
                filename=', '.join(flagged_files))


@decorator.register_test(tier=1)
def test_godlikea(err, xpi_package):
    """Test to make sure that the godlikea namespace is not in use."""

    if 'chrome/godlikea.jar' in xpi_package:
        err.error(
            err_id=('testcases_packagelayout',
                    'test_godlikea'),
            error="Banned 'godlikea' chrome namespace",
            description="The 'godlikea' chrome namepsace is generated from a "
                        'template and should be replaced with something '
                        'unique to your add-on to avoid name conflicts.',
            filename='chrome/godlikea.jar')


@decorator.register_test(
        tier=5,
        versions={FIREFOX_GUID: version_range('firefox', FF4_MIN),
                  TB_GUID: version_range('thunderbird', '3.3a4pre'),
                  FENNEC_GUID: version_range('fennec', '4.0'),

                  ANDROID_GUID: version_range('android', '11.0a1')})