Python unicodedata 模块,unidata_version() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用unicodedata.unidata_version()

项目:backrefs    作者:facelessuser    | 项目源码 | 文件源码
def get_unicodedata():
    """Download the unicodedata version for the given Python version."""

    import unicodedata

    fail = False
    path = os.path.join(os.path.dirname(__file__), 'tools')
    fp, pathname, desc = imp.find_module('unidatadownload', [path])
    try:
        unidatadownload = imp.load_module('unidatadownload', fp, pathname, desc)
        unidatadownload.get_unicodedata(unicodedata.unidata_version, no_zip=True)
    except Exception:
        print(traceback.format_exc())
        fail = True
    finally:
        fp.close()

    assert not fail, "Failed to obtain unicodedata!"
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_named_sequences_full(self):
        # Check all the named sequences
        url = ("http://www.unicode.org/Public/%s/ucd/NamedSequences.txt" %
               unicodedata.unidata_version)
        try:
            testdata = support.open_urlresource(url, encoding="utf-8",
                                                check=check_version)
        except (IOError, HTTPException):
            self.skipTest("Could not retrieve " + url)
        self.addCleanup(testdata.close)
        for line in testdata:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            seqname, codepoints = line.split(';')
            codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
            self.assertEqual(unicodedata.lookup(seqname), codepoints)
            with self.assertRaises(SyntaxError):
                self.checkletter(seqname, None)
            with self.assertRaises(KeyError):
                unicodedata.ucd_3_2_0.lookup(seqname)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_named_sequences_full(self):
        # Check all the named sequences
        url = ("http://www.pythontest.net/unicode/%s/NamedSequences.txt" %
               unicodedata.unidata_version)
        try:
            testdata = support.open_urlresource(url, encoding="utf-8",
                                                check=check_version)
        except (OSError, HTTPException):
            self.skipTest("Could not retrieve " + url)
        self.addCleanup(testdata.close)
        for line in testdata:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            seqname, codepoints = line.split(';')
            codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
            self.assertEqual(unicodedata.lookup(seqname), codepoints)
            with self.assertRaises(SyntaxError):
                self.checkletter(seqname, None)
            with self.assertRaises(KeyError):
                unicodedata.ucd_3_2_0.lookup(seqname)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_named_sequences_full(self):
        # Check all the named sequences
        url = ("http://www.unicode.org/Public/%s/ucd/NamedSequences.txt" %
               unicodedata.unidata_version)
        try:
            testdata = support.open_urlresource(url, encoding="utf-8",
                                                check=check_version)
        except (OSError, HTTPException):
            self.skipTest("Could not retrieve " + url)
        self.addCleanup(testdata.close)
        for line in testdata:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            seqname, codepoints = line.split(';')
            codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
            self.assertEqual(unicodedata.lookup(seqname), codepoints)
            with self.assertRaises(SyntaxError):
                self.checkletter(seqname, None)
            with self.assertRaises(KeyError):
                unicodedata.ucd_3_2_0.lookup(seqname)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def check_version(testfile):
    hdr = testfile.readline()
    return unidata_version in hdr