当前位置: 首页>>代码示例>>Python>>正文


Python repo.Repository类代码示例

本文整理汇总了Python中pgidocgen.repo.Repository的典型用法代码示例。如果您正苦于以下问题:Python Repository类的具体用法?Python Repository怎么用?Python Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_atk

    def test_atk(self):
        repo = Repository("Atk", "1.0")
        Atk = repo.import_module()

        c = Constant.from_object(repo, "", "FOO", Atk.Document.__gtype__)
        self.assertEqual(str(c.value), "<GType AtkDocument>")

        klass = Class.from_object(repo, Atk.Document)
        method = find(klass.methods, "get_attributes")
        self.assertEqual(method.info.version_added, "1.12")

        method = find(klass.methods, "get_attribute_value")
        self.assertEqual(method.info.version_added, "1.12")

        klass = Class.from_object(repo, Atk.Hyperlink)

        method = find(klass.methods, "is_selected_link")
        self.assertTrue(method.info.deprecated)
        self.assertEqual(method.info.version_added, "1.4")
        self.assertEqual(method.info.version_deprecated, "1.8")
        self.assertTrue(method.info.deprecation_desc, "1.8")

        klass = Flags.from_object(repo, Atk.Role)
        info = find(klass.values, "APPLICATION").info
        self.assertEqual(info.version_added, "1.1.4")
开发者ID:lazka,项目名称:pgi-docgen,代码行数:25,代码来源:test_repo.py

示例2: test_gtk

    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,代码行数:27,代码来源:test_repo.py

示例3: test_version_added

    def test_version_added(self):
        repo = Repository("Atk", "1.0")
        docs = repo.lookup_attr_meta("Atk.Document.get_attributes")
        self.assertTrue(".. versionadded:: 1.12" in docs)

        docs = repo.lookup_attr_meta("Atk.Document.get_attribute_value")
        self.assertTrue(".. versionadded:: 1.12" in docs)
开发者ID:tobias47n9e,项目名称:pgi-docgen,代码行数:7,代码来源:test_repo.py

示例4: test_props_gstrv

    def test_props_gstrv(self):
        from pgi.repository import GUdev

        repo = Repository("GUdev", "1.0")
        GUdev.Client.props.subsystems
        self.assertEqual(repo.parse_properties(GUdev.Client)[0].type_desc,
                         "[:obj:`str`]")
开发者ID:tobias47n9e,项目名称:pgi-docgen,代码行数:7,代码来源:test_repo.py

示例5: test_glib

    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,代码行数:34,代码来源:test_repo.py

示例6: test_method_inheritance

 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual(
         [x[0] for x in klass.methods_inherited],
         ['Atk.Object', 'GObject.Object', 'Atk.Component']
     )
开发者ID:lazka,项目名称:pgi-docgen,代码行数:8,代码来源:test_repo.py

示例7: test_method_inheritance

 def test_method_inheritance(self):
     repo = Repository("Atk", "1.0")
     Atk = repo.import_module()
     klass = Class.from_object(repo, Atk.Plug)
     self.assertEqual(
         klass.methods_inherited,
         [('Atk.Object', 23),
          ('GObject.Object', 33),
          ('Atk.Component', 13)])
开发者ID:LucasSilvaFerreira,项目名称:pgi-docgen,代码行数:9,代码来源:test_repo.py

示例8: test_hierarchy

    def test_hierarchy(self):
        from pgi.repository import GObject

        repo = Repository("Atk", "1.0")
        Atk = repo.import_module()
        hier = get_hierarchy([Atk.NoOpObjectFactory])
        self.assertEqual(hier.keys(), [GObject.Object])
        self.assertEqual(hier[GObject.Object].keys(), [Atk.ObjectFactory])
        self.assertEqual(hier[GObject.Object][Atk.ObjectFactory].keys(), [Atk.NoOpObjectFactory])
        self.assertFalse(hier[GObject.Object][Atk.ObjectFactory][Atk.NoOpObjectFactory])
开发者ID:gbtami,项目名称:pgi-docgen,代码行数:10,代码来源:test_repo.py

示例9: test_gtk_overrides

    def test_gtk_overrides(self):
        repo = Repository("Gtk", "3.0")
        Gtk = repo.import_module()

        PyClass.from_object(repo, Gtk.TreeModelRow)
        PyClass.from_object(repo, Gtk.TreeModelRowIter)

        func = Function.from_object("Gtk.Container", "child_get", Gtk.Container.child_get, repo, Gtk.Container)
        self.assertEqual(func.info.desc, "Returns a list of child property values for the given names.")
        self.assertEqual(func.signature, "(child, *prop_names)")

        func = Function.from_object("Gtk", "stock_lookup", Gtk.stock_lookup, repo, Gtk)
        self.assertEqual(func.signature, "(stock_id)")
开发者ID:davelab6,项目名称:pgi-docgen,代码行数:13,代码来源:test_repo.py

示例10: test_pango

    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,代码行数:14,代码来源:test_repo.py

示例11: test_glib_shadowed

    def test_glib_shadowed(self):
        repo = Repository("GLib", "2.0")

        # GLib.io_add_watch points to g_io_add_watch_full and should
        # also use its docs

        self.assertTrue(
            repo.lookup_parameter_docs("GLib.io_add_watch.priority"))

        self.assertTrue(
            "priority" in repo.lookup_attr_docs("GLib.io_add_watch"))

        # we include a note containing the shadowed docs
        self.assertTrue(
            ".. note::" in repo.lookup_attr_docs("GLib.io_add_watch"))
开发者ID:tobias47n9e,项目名称:pgi-docgen,代码行数:15,代码来源:test_repo.py

示例12: test_glib

    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,代码行数:15,代码来源:test_repo.py

示例13: test_gobject

    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,代码行数:16,代码来源:test_repo.py

示例14: test_gio

    def test_gio(self):
        repo = Repository("Gio", "2.0")

        method = repo.lookup_attr_docs("Gio.Application.activate")
        signal = repo.lookup_signal_docs("Gio.Application.activate")

        self.assertTrue(method)
        self.assertTrue(signal)
        self.assertNotEqual(method, signal)

        self.assertFalse(
            repo.lookup_parameter_docs(
                "Gio.Application.command-line.command_line"))

        self.assertTrue(
            repo.lookup_parameter_docs(
                "Gio.Application.command-line.command_line", signal=True))
开发者ID:tobias47n9e,项目名称:pgi-docgen,代码行数:17,代码来源:test_repo.py

示例15: test_atk

    def test_atk(self):
        repo = Repository("Atk", "1.0")
        Atk = repo.import_module()

        klass = Class.from_object(repo, Atk.Document)
        method = find(klass.methods, "get_attributes")
        self.assertEqual(method.info.version_added, "1.12")

        method = find(klass.methods, "get_attribute_value")
        self.assertEqual(method.info.version_added, "1.12")

        klass = Class.from_object(repo, Atk.Hyperlink)

        method = find(klass.methods, "is_selected_link")
        self.assertTrue(method.info.deprecated)
        self.assertEqual(method.info.version_added, "1.4")
        self.assertEqual(method.info.version_deprecated, "1.8")
        self.assertTrue(method.info.deprecation_desc, "1.8")
开发者ID:gbtami,项目名称:pgi-docgen,代码行数:18,代码来源:test_repo.py


注:本文中的pgidocgen.repo.Repository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。