예제 #1
0
    def test_get__tab(self):
        from clld.lib.iso import get_tab

        with patch.multiple(
            "clld.lib.iso", requests=self._requests("a\tb\nc\td\naa"), get_taburls=Mock(return_value={"name": "path"})
        ):
            res = list(get_tab("name"))
            assert res[-1].b is None
예제 #2
0
    def test_get__tab(self):
        from clld.lib.iso import get_tab

        with patch.multiple('clld.lib.iso',
                            requests=self._requests('a\tb\nc\td\naa'),
                            get_taburls=Mock(return_value={'name': 'path'})):
            res = list(get_tab('name'))
            assert res[-1].b is None
예제 #3
0
def macrolanguages(args):
    codes = {row[0] for row in DBSession.query(Languoid.hid).filter(Languoid.hid != None)
             if len(row[0]) == 3}
    macrolangs = defaultdict(list)
    for code in get_tab('macrolanguages'):
        if code.I_Id in codes:
            macrolangs[code.M_Id].append(code.I_Id)

    return macrolangs
예제 #4
0
    def test_get__tab(self):
        from clld.lib.iso import get_tab

        with patch.multiple(
            'clld.lib.iso',
            requests=self._requests('a\tb\nc\td\naa'),
            get_taburls=Mock(return_value={'name': 'path'})
        ):
            res = list(get_tab('name'))
            assert res[-1].b is None
예제 #5
0
def macrolanguages(args):
    codes = {
        row[0]
        for row in DBSession.query(Languoid.hid).filter(Languoid.hid != None)
        if len(row[0]) == 3
    }
    macrolangs = defaultdict(list)
    for code in get_tab('macrolanguages'):
        if code.I_Id in codes:
            macrolangs[code.M_Id].append(code.I_Id)

    return macrolangs
예제 #6
0
def get_macrolangs(codes):
    for code in iso.get_tab('macrolanguages'):
        if code.i_id in codes:
            yield code.m_id, code.i_id