<commit_before># -*- coding: utf-8 -*-

import fcntl
import glob
import json
import os
import random
import shutil
import socket
import subprocess
import sys
import tempfile
import time

TEST_DIR = os.path.normpath(os.path.dirname(os.path.realpath(os.path.join(__file__, ".."))))


def browser_path(headless=True):
    """Return path to CDP browser.

    Support the following locations:
     - /usr/lib*/chromium-browser/headless_shell (chromium-headless RPM), if
       headless is true
     - "chromium-browser" in $PATH (distro package)
     - node_modules/chromium/lib/chromium/chrome-linux/chrome (npm install chromium)

    Exit with an error if none is found.
    """
    if headless:
        g = glob.glob("/usr/lib*/chromium-browser/headless_shell")
        if g:
            return g[0]

    p = subprocess.check_output("which chromium-browser || true", shell=True).strip()
    if p:
        return p

    p = os.path.join(os.path.dirname(TEST_DIR), "node_modules/chromium/lib/chromium/chrome-linux/chrome")
    if os.access(p, os.X_OK):
        return p

    return None

def jsquote(str):
    return json.dumps(str)


class CDP:
    def __init__(self, lang=None, headless=True, verbose=False, trace=False, inject_helpers=[]):
        self.lang = lang<commit_msg>tests: Find chromium on Debian<commit_after># -*- coding: utf-8 -*-

import fcntl
import glob
import json
import os
import random
import shutil
import socket
import subprocess
import sys
import tempfile
import time

TEST_DIR = os.path.normpath(os.path.dirname(os.path.realpath(os.path.join(__file__, ".."))))


def browser_path(headless=True):
    """Return path to CDP browser.

    Support the following locations:
     - /usr/lib*/chromium-browser/headless_shell (chromium-headless RPM), if
       headless is true
     - "chromium-browser" in $PATH (distro package)
     - node_modules/chromium/lib/chromium/chrome-linux/chrome (npm install chromium)

    Exit with an error if none is found.
    """
    if headless:
        g = glob.glob("/usr/lib*/chromium-browser/headless_shell")
        if g:
            return g[0]

    p = subprocess.check_output("which chromium-browser || which chromium || true", shell=True).strip()
    if p:
        return p

    p = os.path.join(os.path.dirname(TEST_DIR), "node_modules/chromium/lib/chromium/chrome-linux/chrome")
    if os.access(p, os.X_OK):
        return p

    return None

def jsquote(str):
    return json.dumps(str)


class CDP:
    def __init__(self, lang=None, headless=True, verbose=False, trace=False, inject_helpers=[]):
        self.lang = lang
{'fraction_non_alphanumeric': 0.1195357833655706, 'fraction_numerical': 0.0015473887814313346, 'mean_word_length': 3.170967741935484, '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': '7177114', 'n_tokens_mistral': 868, 'n_tokens_neox': 824, 'n_words': 213}