本文整理汇总了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")
示例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)
示例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"))
示例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)
示例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")
示例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")
示例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")