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

import os
import sys

from setuptools import setup, Command
from distutils.command.build import build as _build
from setuptools.command.install_lib import install_lib as _install_lib
from distutils.cmd import Command


class compile_translations(Command):
    description = 'compile message catalogs to MO files via django compilemessages'
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        curdir = os.getcwd()
        os.chdir(os.path.realpath('multiseek'))
        from django.core.management import call_command
        call_command('compilemessages')
        os.chdir(curdir)


class build(_build):
    sub_commands = [('compile_translations', None)] + _build.sub_commands


class install_lib(_install_lib):
    def run(self):
        self.run_command('compile_translations')
        _install_lib.run(self)



# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()


class RunTests(Command):
    description = "Run the django test suite from the testproj dir."

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        this_dir = os.getcwd()
        testproj_dir = os.path.join(this_dir, "test_project")
        os.chdir(testproj_dir)
        sys.path.append(testproj_dir)
        from django.core.management import execute_manager

        os.environ["DJANGO_SETTINGS_MODULE"] = 'test_project.settings'
        settings_file = os.environ["DJANGO_SETTINGS_MODULE"]
        settings_mod = __import__(settings_file, {}, {}, [''])
        execute_manager(settings_mod, argv=[
            __file__, "test", "multiseek", "--traceback"])
        os.chdir(this_dir)


if 'sdist' in sys.argv:
    # clear compiled mo files before building the distribution
    walk = os.walk(os.path.join(os.getcwd(), 'multiseek/locale'))
    for dirpath, dirnames, filenames in walk:
        if not filenames:
            continue

        for fn in ['django.mo', 'djangojs.mo']:
            if fn in filenames:
                os.unlink(os.path.join(dirpath, fn))

else:
    # Always try to build messages, fail if django not present
    # (I hate incomplete releases)
    dir = os.getcwd()
    os.chdir(os.path.join(dir, 'multiseek'))
    os.system('django-admin.py compilemessages')
    os.chdir(dir)

def reqs(f):
    for elem in open(f).readlines():
        elem = elem.strip()

        if not elem:
            continue
        
        if elem.find("#egg=")>0:
            ign, egg = elem.split("#egg=")
            yield egg
            continue
        
        if elem.startswith("#") or elem.startswith("-r"):
            continue
        <commit_msg>Fix build<commit_after># -*- encoding: utf-8 -*-

import os
import sys

from setuptools import setup, Command
from distutils.command.build import build as _build
from setuptools.command.install_lib import install_lib as _install_lib
from distutils.cmd import Command


class compile_translations(Command):
    description = 'compile message catalogs to MO files via django compilemessages'
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        curdir = os.getcwd()
        os.chdir(os.path.join(os.path.dirname(__file__), 'multiseek'))
        from django.core.management import call_command
        call_command('compilemessages')
        os.chdir(curdir)


class build(_build):
    sub_commands = [('compile_translations', None)] + _build.sub_commands


class install_lib(_install_lib):
    def run(self):
        self.run_command('compile_translations')
        _install_lib.run(self)



# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()


class RunTests(Command):
    description = "Run the django test suite from the testproj dir."

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        this_dir = os.getcwd()
        testproj_dir = os.path.join(this_dir, "test_project")
        os.chdir(testproj_dir)
        sys.path.append(testproj_dir)
        from django.core.management import execute_manager

        os.environ["DJANGO_SETTINGS_MODULE"] = 'test_project.settings'
        settings_file = os.environ["DJANGO_SETTINGS_MODULE"]
        settings_mod = __import__(settings_file, {}, {}, [''])
        execute_manager(settings_mod, argv=[
            __file__, "test", "multiseek", "--traceback"])
        os.chdir(this_dir)


if 'sdist' in sys.argv:
    # clear compiled mo files before building the distribution
    walk = os.walk(os.path.join(os.getcwd(), 'multiseek/locale'))
    for dirpath, dirnames, filenames in walk:
        if not filenames:
            continue

        for fn in ['django.mo', 'djangojs.mo']:
            if fn in filenames:
                os.unlink(os.path.join(dirpath, fn))

else:
    # Always try to build messages, fail if django not present
    # (I hate incomplete releases)
    cwd = os.getcwd()
    os.chdir(os.path.join(os.path.dirname(__file__),'multiseek'))
    del os.environ['DJANGO_SETTINGS_MODULE']
    os.system('django-admin.py compilemessages')
    os.chdir(cwd)

def reqs(f):
    f = os.path.join(os.path.dirname(__file__), f)
    for elem in open(f).readlines():
        elem = elem.strip()

        if not elem:
            continue
        
        if elem.find("#egg=")>0:
            ign, egg = elem.split("#egg=")
            yield egg
            continue
        
        if elem.startswith("#") or elem.startswith("-r"):
            continue
        
{'fraction_non_alphanumeric': 0.10844933635480739, 'fraction_numerical': 0.0012949174490126255, 'mean_word_length': 2.715574263379435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1229621', 'n_tokens_mistral': 1914, 'n_tokens_neox': 1864, 'n_words': 494}