<commit_before>"""Main stb-tester python module. Intended to be used with `stbt run`.

See `man stbt` and http://stb-tester.com for documentation.

Copyright 2012-2013 YouView TV Ltd and contributors.
License: LGPL v2.1 or (at your option) any later version (see
https://github.com/drothlis/stb-tester/blob/master/LICENSE for details).
"""

import argparse
from collections import namedtuple, deque
import ConfigParser
from contextlib import contextmanager
import datetime
import errno
import functools
import glob
import inspect
import os
import Queue
import re
import socket
import subprocess
import sys
import threading
import tempfile
import time
import warnings

import cv2
from gi.repository import GObject, Gst, GLib  # pylint: disable-msg=E0611
import numpy

import irnetbox
from gst_hacks import map_gst_buffer, gst_iterate


GObject.threads_init()  # Required for GObject < 3.12
Gst.init(None)

warnings.filterwarnings(
    action="always", category=DeprecationWarning, message='.*stb-tester')


# Functions available to stbt scripts
#===========================================================================

def get_config(section, key, default=None, type_=str):
    """Read the value of `key` from `section` of the stbt config file.

    See 'CONFIGURATION' in the stbt(1) man page for the config file search
    path.<commit_msg>pylint 1.1 support: `disable-msg` is deprecated in favor of `disable`<commit_after>"""Main stb-tester python module. Intended to be used with `stbt run`.

See `man stbt` and http://stb-tester.com for documentation.

Copyright 2012-2013 YouView TV Ltd and contributors.
License: LGPL v2.1 or (at your option) any later version (see
https://github.com/drothlis/stb-tester/blob/master/LICENSE for details).
"""

import argparse
from collections import namedtuple, deque
import ConfigParser
from contextlib import contextmanager
import datetime
import errno
import functools
import glob
import inspect
import os
import Queue
import re
import socket
import subprocess
import sys
import threading
import tempfile
import time
import warnings

import cv2
from gi.repository import GObject, Gst, GLib  # pylint: disable=E0611
import numpy

import irnetbox
from gst_hacks import map_gst_buffer, gst_iterate


GObject.threads_init()  # Required for GObject < 3.12
Gst.init(None)

warnings.filterwarnings(
    action="always", category=DeprecationWarning, message='.*stb-tester')


# Functions available to stbt scripts
#===========================================================================

def get_config(section, key, default=None, type_=str):
    """Read the value of `key` from `section` of the stbt config file.

    See 'CONFIGURATION' in the stbt(1) man page for the config file search
    path.
{'fraction_non_alphanumeric': 0.1276440554339898, 'fraction_numerical': 0.014587892049598834, 'mean_word_length': 5.305747126436781, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2151971', 'n_tokens_mistral': 831, 'n_tokens_neox': 783, 'n_words': 300}