# Path: validator/decorator.py
# TEST_TIERS = {}
# CLEANUP_FUNCTIONS = []
# def register_test(tier=1, expected_type=None, simple=False, versions=None):
#     def wrap(function):
# def register_cleanup(cleanup):
# def cleanup():
# def get_tiers():
# def get_tests(tier, type_=None):
# def version_range(guid, version, before=None, app_versions=None):
# 
# Path: validator/submain.py
# def prepare_package(err, path, expectation=0, for_appversions=None,
#                     timeout=-1):
#         def timeout_handler(signum, frame):
# def test_search(err, package, expectation=0):
# def test_package(err, file_, name, expectation=PACKAGE_ANY,
#                  for_appversions=None):
# def _load_install_rdf(err, package, expectation):
# def _load_package_json(err, package, expectation):
# def _load_manifest_json(err, package, expectation):
# def populate_chrome_manifest(err, xpi_package):
#         def get_linked_manifest(path, from_path, from_chrome, from_triple):
# def test_inner_package(err, xpi_package, for_appversions=None):
# 
# Path: validator/unicodehelper.py
# UNICODE_BOMS = [
#     (codecs.BOM_UTF8, 'utf-8'),
#     (codecs.BOM_UTF32_LE, 'utf-32-le'),
#     (codecs.BOM_UTF32_BE, 'utf-32-be'),
#     (codecs.BOM_UTF16_LE, 'utf-16-le'),
#     (codecs.BOM_UTF16_BE, 'utf-16-be'),
# ]
# COMMON_ENCODINGS = ('latin_1', 'utf-16')
# NON_ASCII_FILTER = re.compile(r'[^\t\r\n\x20-\x7f]+')
# def decode(data):


import hashlib
import os
import re
import validator.testcases.markup.markuptester as testendpoint_markup
import validator.testcases.markup.csstester as testendpoint_css
import validator.testcases.scripting as testendpoint_js
import validator.testcases.langpack as testendpoint_langpack
from StringIO import StringIO
from zipfile import BadZipfile
from regex import run_regex_tests
from validator.constants import MAX_JS_THRESHOLD
from validator import decorator
from validator import submain as testendpoint_validator
from validator import unicodehelper
from validator.constants import (BUGZILLA_BUG, PACKAGE_LANGPACK,
                                 PACKAGE_SUBPACKAGE, PACKAGE_THEME)
from validator.xpi import XPIManager
            testendpoint_validator.test_package(err, package, name)

        err.pop_state()
        err.set_tier(2)

        err.supported_versions = supported_versions

    elif name_lower.endswith('.xpi'):
        # It's not a subpackage, it's a nested extension. These are
        # found in multi-extension packages.

        # Unpack!
        package = StringIO(file_data)

        err.push_state(name_lower)
        err.set_tier(1)

        # There are no expected types for packages within a multi-
        # item package.
        testendpoint_validator.test_package(err, package, name)

        err.pop_state()
        err.set_tier(2)  # Reset to the current tier

    elif name_lower.endswith(('.css', '.js', '.jsm')):

        if not file_data:
            return None

        # Convert the file data to unicode

# Path: validator/decorator.py
# TEST_TIERS = {}
# CLEANUP_FUNCTIONS = []
# def register_test(tier=1, expected_type=None, simple=False, versions=None):
#     def wrap(function):
# def register_cleanup(cleanup):
# def cleanup():
# def get_tiers():
# def get_tests(tier, type_=None):
# def version_range(guid, version, before=None, app_versions=None):
# 
# Path: validator/submain.py
# def prepare_package(err, path, expectation=0, for_appversions=None,
#                     timeout=-1):
#         def timeout_handler(signum, frame):
# def test_search(err, package, expectation=0):
# def test_package(err, file_, name, expectation=PACKAGE_ANY,
#                  for_appversions=None):
# def _load_install_rdf(err, package, expectation):
# def _load_package_json(err, package, expectation):
# def _load_manifest_json(err, package, expectation):
# def populate_chrome_manifest(err, xpi_package):
#         def get_linked_manifest(path, from_path, from_chrome, from_triple):
# def test_inner_package(err, xpi_package, for_appversions=None):
# 
# Path: validator/unicodehelper.py
# UNICODE_BOMS = [
#     (codecs.BOM_UTF8, 'utf-8'),
#     (codecs.BOM_UTF32_LE, 'utf-32-le'),
#     (codecs.BOM_UTF32_BE, 'utf-32-be'),
#     (codecs.BOM_UTF16_LE, 'utf-16-le'),
#     (codecs.BOM_UTF16_BE, 'utf-16-be'),
# ]
# COMMON_ENCODINGS = ('latin_1', 'utf-16')
# NON_ASCII_FILTER = re.compile(r'[^\t\r\n\x20-\x7f]+')
# def decode(data):


# Path: validator/testcases/content.py
import hashlib
import os
import re
import validator.testcases.markup.markuptester as testendpoint_markup
import validator.testcases.markup.csstester as testendpoint_css
import validator.testcases.scripting as testendpoint_js
import validator.testcases.langpack as testendpoint_langpack
from StringIO import StringIO
from zipfile import BadZipfile
from regex import run_regex_tests
from validator.constants import MAX_JS_THRESHOLD
from validator import decorator
from validator import submain as testendpoint_validator
from validator import unicodehelper
from validator.constants import (BUGZILLA_BUG, PACKAGE_LANGPACK,
                                 PACKAGE_SUBPACKAGE, PACKAGE_THEME)
from validator.xpi import XPIManager

            testendpoint_validator.test_package(err, package, name)

        err.pop_state()
        err.set_tier(2)

        err.supported_versions = supported_versions

    elif name_lower.endswith('.xpi'):
        # It's not a subpackage, it's a nested extension. These are
        # found in multi-extension packages.

        # Unpack!
        package = StringIO(file_data)

        err.push_state(name_lower)
        err.set_tier(1)

        # There are no expected types for packages within a multi-
        # item package.
        testendpoint_validator.test_package(err, package, name)

        err.pop_state()
        err.set_tier(2)  # Reset to the current tier

    elif name_lower.endswith(('.css', '.js', '.jsm')):

        if not file_data:
            return None

        # Convert the file data to unicode

        file_data = unicodehelper.decode(file_data)