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


Python Repository.import_module方法代碼示例

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


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

示例1: test_gtk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [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_atk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
    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,代碼行數:27,代碼來源:test_repo.py

示例3: test_method_inheritance

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
 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,代碼行數:10,代碼來源:test_repo.py

示例4: test_method_inheritance

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
 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,代碼行數:11,代碼來源:test_repo.py

示例5: test_hierarchy

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
    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,代碼行數:12,代碼來源:test_repo.py

示例6: test_gtk_overrides

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
    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,代碼行數:15,代碼來源:test_repo.py

示例7: test_gio

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

        klass = Class.from_object(repo, Gio.Application)
        method = find(klass.methods, "activate")
        signal = find(klass.signals, "activate")

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

        signal = find(klass.signals, "command_line")
        self.assertTrue(":param command_line:" in signal.signature_desc)

        klass = Class.from_object(repo, Gio.File)
        method = find(klass.methods, "load_contents_finish")
        self.assertTrue(":returns:" in method.signature_desc)
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:20,代碼來源:test_repo.py

示例8: test_atk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
    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,代碼行數:20,代碼來源:test_repo.py

示例9: test_gtk

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [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

示例10: test_gobject

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [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

示例11: test_override_method

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
 def test_override_method(self):
     repo = Repository("Gtk", "3.0")
     Gtk = repo.import_module()
     func = Function.from_object(
         "Gtk.Widget", "translate_coordinates", Gtk.Widget.translate_coordinates, repo, Gtk.Widget)
     self.assertEqual(func.signature, "(dest_widget, src_x, src_y)")
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:8,代碼來源:test_repo.py

示例12: test_gudev

# 需要導入模塊: from pgidocgen.repo import Repository [as 別名]
# 或者: from pgidocgen.repo.Repository import import_module [as 別名]
 def test_gudev(self):
     repo = Repository("GUdev", "1.0")
     GUdev = repo.import_module()
     Class.from_object(repo, GUdev.Client)
開發者ID:lazka,項目名稱:pgi-docgen,代碼行數:6,代碼來源:test_repo.py


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