Esempio n. 1
0
def test_contains_everything():
    all_the_things = ContainsEverything()
    assert 'dude' in all_the_things
    assert 42 in all_the_things
    assert list in all_the_things
Esempio n. 2
0
import os
import re
from os.path import join
from tokenize import generate_tokens, NAME, NEWLINE, OP, untokenize

from django.conf import settings
from django.core.cache import caches
from django.template.loader import get_template
from jinja2 import Environment

from dotlang import (parse as parse_lang, get_lang_path,
                     get_translations_for_langfile, lang_file_tag_set)
from lib.l10n_utils.utils import ContainsEverything


ALL_THE_THINGS = ContainsEverything()
REGEX_URL = re.compile(r'.* (\S+/\S+\.[^:]+).*')
cache = caches['l10n']


def parse_po(path):
    msgs = {}

    if not os.path.exists(path):
        return msgs

    with codecs.open(path, 'r', 'utf-8') as lines:
        def parse_string(s):
            # remove first and last characters which are "
            s = s.strip()[1:-1]
            return s.replace('\\"', '"')
Esempio n. 3
0
def test_contains_everything():
    all_the_things = ContainsEverything()
    ok_('dude' in all_the_things)
    ok_(42 in all_the_things)
    ok_(list in all_the_things)