<commit_before>import json
import re

try:
    from pygerrit2 import GerritRestAPI, GerritReview, HTTPDigestAuthFromNetrc
except ImportError:
    # Only reviewing and merging functionality depends on pygerrit2
    pass

import requests

GERRIT_URL = 'https://gerrit.suse.provo.cloud'
GERRIT_VERIFY = True

# We use a more complex regex that matches both formats of Depends-On so that
# we preserve the order in which they are discovered.
DEPENDS_ON_RE = re.compile(
    r"^\W*Depends-On: ("
    r"((http(s)?:\/\/)?gerrit\.suse\.provo\.cloud\/(\/)?(\#\/c\/)?(\d+).*?)"
    r"|(I[0-9a-f]{40})"
    r")\s*$",
    re.MULTILINE | re.IGNORECASE)


class GerritApiCaller:
    _CACHE = {}

    @staticmethod
    def _query_gerrit(query):
        if query in GerritApiCaller._CACHE:
            return GerritApiCaller._CACHE[query]
<commit_msg>openstack-ardana-gerrit: use GERRIT_VERIFY env var<commit_after>import json
import os
import re

try:
    from pygerrit2 import GerritRestAPI, GerritReview, HTTPDigestAuthFromNetrc
except ImportError:
    # Only reviewing and merging functionality depends on pygerrit2
    pass

import requests

GERRIT_URL = 'https://gerrit.suse.provo.cloud'

GERRIT_VERIFY = os.environ.get('GERRIT_VERIFY', True) in ['true', '1', True]

# We use a more complex regex that matches both formats of Depends-On so that
# we preserve the order in which they are discovered.
DEPENDS_ON_RE = re.compile(
    r"^\W*Depends-On: ("
    r"((http(s)?:\/\/)?gerrit\.suse\.provo\.cloud\/(\/)?(\#\/c\/)?(\d+).*?)"
    r"|(I[0-9a-f]{40})"
    r")\s*$",
    re.MULTILINE | re.IGNORECASE)


class GerritApiCaller:
    _CACHE = {}

    @staticmethod
    def _query_gerrit(query):
        if query in GerritApiCaller._CACHE:
            return GerritApiCaller._CACHE[query]

{'fraction_non_alphanumeric': 0.13641488162344984, 'fraction_numerical': 0.007328072153325817, 'mean_word_length': 3.4710327455919394, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1354033', 'n_tokens_mistral': 678, 'n_tokens_neox': 639, 'n_words': 153}