當前位置: 首頁>>代碼示例>>Python>>正文


Python Repository.parse方法代碼示例

本文整理匯總了Python中pgidocgen.repo.Repository.parse方法的典型用法代碼示例。如果您正苦於以下問題:Python Repository.parse方法的具體用法?Python Repository.parse怎麽用?Python Repository.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pgidocgen.repo.Repository的用法示例。


在下文中一共展示了Repository.parse方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_gtk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        klass = Class.from_object(repo, Gtk.Widget)
        translate_coordinates = find(klass.methods, "translate_coordinates")
        # make sure we replace src_widget with self
        self.assertTrue("src_widget" not in translate_coordinates.info.desc)

        mod = repo.parse()
        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.class_structures, "TableChild")
        self.assertRaises(
            LookupError, find, mod.structures, "WidgetClass")
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:29,代碼來源:test_repo.py

示例2: test_glib

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_glib(self):
        repo = Repository("GLib", "2.0")
        mod = repo.parse()

        klass = find(mod.pyclasses, "Error")

        # GLib.io_add_watch points to g_io_add_watch_full and should
        # also use its docs
        func = find(mod.functions, "io_add_watch")
        self.assertTrue(":param priority:" in func.signature_desc)

        # we include a note containing the shadowed docs
        self.assertTrue(func.info.shadowed_desc)

        self.assertEqual(repo.get_shadowed("g_idle_add"), "g_idle_add_full")

        self.assertEqual(repo.lookup_py_id("g_idle_add"), "GLib.idle_add")
        self.assertEqual(repo.lookup_py_id("g_idle_add", shadowed=False), None)

        klass = find(mod.enums, "BookmarkFileError")
        self.assertEqual(klass.base, "GLib.Enum")

        klass = find(mod.enums, "Enum")
        self.assertEqual(klass.base, None)

        klass = find(mod.flags, "FileTest")
        self.assertEqual(klass.base, "GLib.Flags")

        klass = find(mod.flags, "Flags")
        self.assertEqual(klass.base, None)

        struct = find(mod.structures, "MemVTable")
        field = find(struct.fields, "realloc")
        self.assertTrue("object" in field.type_desc)
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:36,代碼來源:test_repo.py

示例3: test_pango

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_pango(self):
        repo = Repository("Pango", "1.0")
        mod = repo.parse()
        func = find(mod.functions, "extents_to_pixels")
        self.assertTrue(":param inclusive:" in func.signature_desc)

        func = find(mod.functions, "break_")
        self.assertTrue(":param text:" in func.signature_desc)

        func = find(find(mod.structures, "TabArray").methods, "new")
        self.assertTrue(":param initial_size:" in func.signature_desc)

        self.assertTrue(repo.is_private("Pango.RendererPrivate"))
        self.assertFalse(repo.is_private("Pango.AttrIterator"))
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:16,代碼來源:test_repo.py

示例4: test_glib

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_glib(self):
        repo = Repository("GLib", "2.0")
        mod = repo.parse()

        # GLib.io_add_watch points to g_io_add_watch_full and should
        # also use its docs
        func = find(mod.functions, "io_add_watch")
        self.assertTrue(":param priority:" in func.signature_desc)

        # we include a note containing the shadowed docs
        self.assertTrue(func.info.shadowed_desc)

        klass = find(mod.structures, "IConv")
        func = find(klass.methods, "_")
        self.assertTrue(func.info.desc)
開發者ID:gbtami,項目名稱:pgi-docgen,代碼行數:17,代碼來源:test_repo.py

示例5: test_gobject

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_gobject(self):
        repo = Repository("GObject", "2.0")
        mod = repo.parse()

        self.assertEqual(
            repo.lookup_py_id_for_type_struct("GObjectClass"),
            "GObject.Object")

        klass = find(mod.enums, "GEnum")
        self.assertEqual(klass.base, "GLib.Enum")

        klass = find(mod.flags, "GFlags")
        self.assertEqual(klass.base, "GLib.Flags")

        klass = find(mod.flags, "ParamFlags")
        self.assertEqual(klass.base, "GLib.Flags")
開發者ID:LucasSilvaFerreira,項目名稱:pgi-docgen,代碼行數:18,代碼來源:test_repo.py

示例6: test_gtk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_gtk(self):
        repo = Repository("Gtk", "3.0")
        mod = repo.parse()
        Gtk = repo.import_module()

        klass = Class.from_object(repo, Gtk.TreeModel)
        vfunc = find(klass.vfuncs, "do_get_iter")
        self.assertTrue(vfunc.info.desc)

        Class.from_object(repo, Gtk.Button)
        Class.from_object(repo, Gtk.Paned)
        Class.from_object(repo, Gtk.ActionBar)

        klass = Class.from_object(repo, Gtk.TextView)
        self.assertTrue(klass.image_path)

        find(mod.class_structures, "WidgetClass")
        find(mod.structures, "TableChild")
        self.assertRaises(LookupError, find, mod.class_structures, "TableChild")
        self.assertRaises(LookupError, find, mod.structures, "WidgetClass")
開發者ID:gbtami,項目名稱:pgi-docgen,代碼行數:22,代碼來源:test_repo.py

示例7: test_gobject

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import parse [as 別名]
    def test_gobject(self):
        repo = Repository("GObject", "2.0")
        GObject = repo.import_module()
        mod = repo.parse()

        self.assertEqual(
            repo.lookup_py_id_for_type_struct("GObjectClass"),
            "GObject.Object")

        klass = Class.from_object(repo, GObject.Object)
        method = find(klass.methods, "list_properties")
        self.assertTrue(method.is_static)
        self.assertEqual(method.fullname, "GObject.Object.list_properties")

        klass = find(mod.enums, "GEnum")
        self.assertEqual(klass.base, "GLib.Enum")

        klass = find(mod.flags, "GFlags")
        self.assertEqual(klass.base, "GLib.Flags")

        klass = find(mod.flags, "ParamFlags")
        self.assertEqual(klass.base, "GLib.Flags")
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:24,代碼來源:test_repo.py


注:本文中的pgidocgen.repo.Repository.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。