<commit_before>"""
Edraak internationalization tasks
"""
from path import path
import yaml
from paver.easy import task, needs, sh, call_task, BuildFailure
import polib
from git import Repo
import os
import contextlib
from shutil import copyfile

from .utils.cmd import django_cmd

EDRAAK_RESOURCES = (
    'edraak-platform',
    'edraak-platform-2015-theme',
)

ARABIC_LOCALE_DIR = 'conf/locale/ar/LC_MESSAGES/'

OTHER_RTL_LOCALES = ('eo', 'rtl', 'he', 'fa',)

git_repo = Repo('.')


@contextlib.contextmanager
def working_directory(path):
    """
    A context manager which changes the working directory to the given
    path, and then changes it back to its previous value on exit.
    """
    prev_cwd = os.getcwd()
    os.chdir(path)
    yield
    os.chdir(prev_cwd)


def js_nonjs(func):
    """
    Make a task run for both `django.po` and `djangojs.po` in a DRY way.
    """<commit_msg>Farsi is not available in edX anymore, removing it<commit_after>"""
Edraak internationalization tasks
"""
from path import path
import yaml
from paver.easy import task, needs, sh, call_task, BuildFailure
import polib
from git import Repo
import os
import contextlib
from shutil import copyfile

from .utils.cmd import django_cmd

EDRAAK_RESOURCES = (
    'edraak-platform',
    'edraak-platform-2015-theme',
)

ARABIC_LOCALE_DIR = 'conf/locale/ar/LC_MESSAGES/'

OTHER_RTL_LOCALES = ('eo', 'rtl', 'he',)

git_repo = Repo('.')


@contextlib.contextmanager
def working_directory(path):
    """
    A context manager which changes the working directory to the given
    path, and then changes it back to its previous value on exit.
    """
    prev_cwd = os.getcwd()
    os.chdir(path)
    yield
    os.chdir(prev_cwd)


def js_nonjs(func):
    """
    Make a task run for both `django.po` and `djangojs.po` in a DRY way.
    """
{'fraction_non_alphanumeric': 0.10445299615173172, 'fraction_numerical': 0.0043980208905992305, 'mean_word_length': 3.789473684210526, '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': '4579871', 'n_tokens_mistral': 639, 'n_tokens_neox': 615, 'n_words': 195}