<commit_before>import logging
from mediacrush.network import is_tor

from flask import request

try:
    from configparser import ConfigParser
except ImportError:
    # Python 2 support
    from ConfigParser import ConfigParser

logger = logging.getLogger("MediaCrush")
logger.setLevel(logging.DEBUG)

sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
sh.setFormatter(formatter)

logger.addHandler(sh)

# scss logger
logging.getLogger("scss").addHandler(sh)

config = ConfigParser()
config.readfp(open('config.ini'))
env = 'config'

_cfg = lambda k: config.get(env, k)
_cfgi = lambda k: int(_cfg(k))

def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)

def cdn_url(path):
    request_domain = request.headers["Host"]
    if request_domain is not _cfg("domain"):
        return "/" + path
    else:
        return "%s/%s" % (_cfg("protocol") + "://" + _cfg("domain") if _cfg("cdn") == '' else _cfg("cdn"), path)<commit_msg>Fixed comparison<commit_after>import logging
from mediacrush.network import is_tor

from flask import request

try:
    from configparser import ConfigParser
except ImportError:
    # Python 2 support
    from ConfigParser import ConfigParser

logger = logging.getLogger("MediaCrush")
logger.setLevel(logging.DEBUG)

sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
sh.setFormatter(formatter)

logger.addHandler(sh)

# scss logger
logging.getLogger("scss").addHandler(sh)

config = ConfigParser()
config.readfp(open('config.ini'))
env = 'config'

_cfg = lambda k: config.get(env, k)
_cfgi = lambda k: int(_cfg(k))

def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)

def cdn_url(path):
    request_domain = request.headers["Host"].strip()

    if request_domain != _cfg("domain").strip():
        return "/" + path
    else:
        return "%s/%s" % (_cfg("protocol") + "://" + _cfg("domain") if _cfg("cdn") == '' else _cfg("cdn"), path)
{'fraction_non_alphanumeric': 0.16563330380868024, 'fraction_numerical': 0.0008857395925597874, 'mean_word_length': 4.509756097560976, 'pattern_counts': {'":': 2, '<': 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': '2317163', 'n_tokens_mistral': 758, 'n_tokens_neox': 744, 'n_words': 174}