コード例 #1
0
ファイル: iso639.py プロジェクト: KaiCode2/phenny
def refresh_database(phenny, raw=None):
    if raw.admin or raw is None:
        f = iso_filename(phenny)
        write_ethnologue_codes(phenny)
        phenny.iso_data = scrape_wiki_codes()
        phenny.iso_data.update(phenny.ethno_data)
        write_dict(f, phenny.iso_data)
        phenny.say('ISO code database successfully written')
    else:
        phenny.say('Only admins can execute that command!')
コード例 #2
0
def refresh_database(phenny, raw=None):
    if raw.admin or raw is None:
        ethnologue.write_ethnologue_codes(phenny)
        phenny.iso_data = scrape_wiki_codes()
        phenny.iso_data.update(phenny.ethno_data)
        phenny.say('ISO code database successfully written')

        phenny.iso_conversion_data = scrape_wiki_codes_convert()
        phenny.say('ISO conversion db successfully written')
    else:
        phenny.say('Only admins can execute that command!')
コード例 #3
0
ファイル: iso639.py プロジェクト: goavki/phenny
def refresh_database(phenny, raw=None):
    if raw.admin or raw is None:
        ethnologue.write_ethnologue_codes(phenny)
        phenny.iso_data = scrape_wiki_codes()
        phenny.iso_data.update(phenny.ethno_data)
        phenny.say('ISO code database successfully written')

        phenny.iso_conversion_data = scrape_wiki_codes_convert()
        phenny.say('ISO conversion db successfully written')
    else:
        phenny.say('Only admins can execute that command!')
コード例 #4
0
ファイル: iso639.py プロジェクト: vikramkashyap/phenny
def refresh_database(phenny, raw=None):
    if raw.admin or raw is None:
        f = iso_filename(phenny)
        write_ethnologue_codes(phenny)
        phenny.iso_data = scrape_wiki_codes()
        phenny.iso_data.update(phenny.ethno_data)
        write_dict(f, phenny.iso_data)
        phenny.say('ISO code database successfully written')

        f2 = iso_one_to_three_filename(phenny)
        phenny.iso_conversion_data = scrape_wiki_codes_convert()
        write_dict(f2, phenny.iso_conversion_data)
        phenny.say('ISO conversion db successfully written')
    else:
        phenny.say('Only admins can execute that command!')
コード例 #5
0
 def test_ethnologue_macrolanguage(self):
     self.input.group = lambda x: [None, "ara"][x]
     ethno.write_ethnologue_codes(self.phenny)
     ethno.ethnologue(self.phenny, self.input)
     out = self.phenny.say.call_args[0][0]
     self.assertTrue("macrolanguage" in out)
コード例 #6
0
 def test_ethnologue(self):
     self.input.group = lambda x: [None, "nld"][x]
     ethno.write_ethnologue_codes(self.phenny)
     ethno.ethnologue(self.phenny, self.input)
     out = self.phenny.say.call_args[0][0]
     self.assertTrue("Dutch" in out)
コード例 #7
0
 def test_write_ethnologue_codes(self):
     raw = MagicMock()
     raw.admin = True
     ethno.write_ethnologue_codes(self.phenny, raw=raw)
     out = self.phenny.say.call_args[0][0]
     self.assertTrue("Ethnologue iso-639 code fetch successful" in out)