# 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

    total_scripts = sum(len(bundle['scripts']) for bundle in scripts)
    exhaustive = True
    if total_scripts > MAX_JS_THRESHOLD:
        err.warning(
            err_id=('testcases_content', 'packed_js', 'too_much_js'),
            warning='TOO MUCH JS FOR EXHAUSTIVE VALIDATION',
            description='There are too many JS files for the validator to '
                        'process sequentially. An editor must manually '
                        'review the JS in this add-on.')
        exhaustive = False

    # Get the chrome manifest in case there's information about pollution
    # exemptions.
    chrome = err.get_resource('chrome.manifest_nopush')
    marked_scripts = err.get_resource('marked_scripts')
    if not marked_scripts:
        marked_scripts = set()

    # Process all of the scripts that were found seperately from the rest of
    # the package contents.
    for script_bundle in scripts:
        package = script_bundle['package']

        # Set the error bundle's package state to what it was when we first
        # encountered the script file during the content tests.
        for archive in script_bundle['state']:
            err.push_state(archive)

        for script in script_bundle['scripts']:

# 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


    total_scripts = sum(len(bundle['scripts']) for bundle in scripts)
    exhaustive = True
    if total_scripts > MAX_JS_THRESHOLD:
        err.warning(
            err_id=('testcases_content', 'packed_js', 'too_much_js'),
            warning='TOO MUCH JS FOR EXHAUSTIVE VALIDATION',
            description='There are too many JS files for the validator to '
                        'process sequentially. An editor must manually '
                        'review the JS in this add-on.')
        exhaustive = False

    # Get the chrome manifest in case there's information about pollution
    # exemptions.
    chrome = err.get_resource('chrome.manifest_nopush')
    marked_scripts = err.get_resource('marked_scripts')
    if not marked_scripts:
        marked_scripts = set()

    # Process all of the scripts that were found seperately from the rest of
    # the package contents.
    for script_bundle in scripts:
        package = script_bundle['package']

        # Set the error bundle's package state to what it was when we first
        # encountered the script file during the content tests.
        for archive in script_bundle['state']:
            err.push_state(archive)

        for script in script_bundle['scripts']:

            file_data = unicodehelper.decode(package.read(script))