<commit_before># -*- coding: utf-8 -*-
import re
import os
import shutil
import signal
import tempfile
from contextlib import contextmanager
from django.template.defaultfilters import slugify
from django.conf import settings
from django.core.management import call_command
from aloe import before, after, around, step, world
import aloe_webdriver.django  # noqa
from selenium.webdriver import Chrome, ChromeOptions
import vcr


selenium_vcr = vcr.VCR()
# We need to ignore localhost as selenium communicates over local http
# to interact with the 'browser'
selenium_vcr.ignore_localhost = True

temp_dir = tempfile.mkdtemp()


@before.all
def before_all():
    # build static assets into a temporary location
    settings.STATIC_ROOT = temp_dir
    call_command("collectstatic", interactive=False, verbosity=0)


@after.all
def after_all():
    # clean up static assets
    shutil.rmtree(temp_dir)


@before.each_example
def setup(scenario, outline, steps):
    options = ChromeOptions()
    options.add_argument("--headless")
    options.add_argument("--disable-gpu")
    world.browser = Chrome(options=options)
    world.browser.set_page_load_timeout(10)
    world.browser.set_script_timeout(10)

    with open(os.devnull, "w") as f:
        call_command("loaddata", "integration_tests_addressbase.json", stdout=f)
        call_command("loaddata", "test_routing.json", stdout=f)
        call_command("loaddata", "newport_council.json", stdout=f)


@step("No errors were thrown")
def no_errors(step):
    assert (
        len(world.browser.get_log("browser")) == 0
    ), "JavaScript errors were logged:\n %s" % (world.browser.get_log("browser"))


@after.each_example
def take_down(scenario, outline, steps):<commit_msg>fix E2E tests for chromedriver 75<commit_after># -*- coding: utf-8 -*-
import re
import os
import shutil
import signal
import tempfile
from contextlib import contextmanager
from django.template.defaultfilters import slugify
from django.conf import settings
from django.core.management import call_command
from aloe import before, after, around, step, world
import aloe_webdriver.django  # noqa
from selenium.webdriver import Chrome, ChromeOptions
import vcr


selenium_vcr = vcr.VCR()
# We need to ignore localhost as selenium communicates over local http
# to interact with the 'browser'
selenium_vcr.ignore_localhost = True

temp_dir = tempfile.mkdtemp()


@before.all
def before_all():
    # build static assets into a temporary location
    settings.STATIC_ROOT = temp_dir
    call_command("collectstatic", interactive=False, verbosity=0)


@after.all
def after_all():
    # clean up static assets
    shutil.rmtree(temp_dir)


@before.each_example
def setup(scenario, outline, steps):
    options = ChromeOptions()
    options.add_argument("--headless")
    options.add_argument("--disable-gpu")
    options.add_experimental_option("w3c", False)
    world.browser = Chrome(options=options)
    world.browser.set_page_load_timeout(10)
    world.browser.set_script_timeout(10)

    with open(os.devnull, "w") as f:
        call_command("loaddata", "integration_tests_addressbase.json", stdout=f)
        call_command("loaddata", "test_routing.json", stdout=f)
        call_command("loaddata", "newport_council.json", stdout=f)


@step("No errors were thrown")
def no_errors(step):
    assert (
        len(world.browser.get_log("browser")) == 0
    ), "JavaScript errors were logged:\n %s" % (world.browser.get_log("browser"))


@after.each_example
def take_down(scenario, outline, steps):
{'fraction_non_alphanumeric': 0.10472396129766648, 'fraction_numerical': 0.005122367672168469, 'mean_word_length': 4.734094616639478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '249773', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1059, 'n_words': 284}