• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python packagemanager.get_package_manager函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_vtl_files

 def test_vtl_files(self):
     from vistrails.tests.utils import run_file
     for root, dirs, file_names in os.walk(self.vtl_path):
         for file_name in sorted(file_names):
             if file_name.endswith('.vtl'):
                 # update available packages
                 from vistrails.core.packagemanager import get_package_manager
                 get_package_manager().build_available_package_names_list()
                 f = os.path.join(root, file_name)
                 locator = FileLocator(f)
                 version = locator._vnode
                 # if there is a version specified try to execute it,
                 # else just load the pipeline
                 if version:
                     errors = run_file(f, lambda x: x == version)
                     self.assertEqual(errors, [], 'Errors processing %s: %s' % (f, str(errors)))
                 else:
                     import vistrails.core.db.io
                     from vistrails.core.vistrail.controller import \
                         VistrailController
                     loaded_objs = vistrails.core.db.io.load_vistrail(locator)
                     controller = VistrailController(loaded_objs[0],
                                                     locator,
                                                     *loaded_objs[1:])
                     controller.change_selected_version(
                         controller.vistrail.get_latest_version())
                     self.assertTrue(controller.current_pipeline.is_valid,
                                     "Latest pipeline is invalid: %s" % f)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:28,代码来源:locator.py


示例2: operation_added

 def operation_added(self, operation):
     pm = get_package_manager()
     package = pm.get_package(operation.package_identifier)
     item = OperationItem(operation, package.name,
                          operation.wizard is not None)
     self._operations[operation] = item
     self._list.addItem(item, package.name)
开发者ID:VisTrails,项目名称:DAT,代码行数:7,代码来源:operations.py


示例3: load_package

 def load_package(self, identifier, codepath):
     packages = self.get_packages()
     if identifier not in packages:
         pm = get_package_manager()
         pm.late_enable_package(codepath)
         self._packages = None
     return self.get_package(identifier)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:api.py


示例4: package_dependencies

def package_dependencies():
    pm = get_package_manager()
    spreadsheet_identifier = 'org.vistrails.vistrails.spreadsheet'
    if pm.has_package(spreadsheet_identifier):
        return [spreadsheet_identifier]
    else: # pragma: no cover
        return []
开发者ID:remram44,项目名称:tabledata-backport,代码行数:7,代码来源:__init__.py


示例5: find_descriptor

    def find_descriptor(controller, pipeline, module_id, desired_version=''):
        reg = get_module_registry()

        get_descriptor = reg.get_descriptor_by_name
        pm = get_package_manager()
        invalid_module = pipeline.modules[module_id]
        mpkg, mname, mnamespace, mid = (invalid_module.package,
                                        invalid_module.name,
                                        invalid_module.namespace,
                                        invalid_module.id)
        pkg = pm.get_package(mpkg)
        desired_version = ''
        d = None
        # don't check for abstraction/subworkflow since the old module
        # could be a subworkflow
        if reg.has_abs_upgrade(*invalid_module.descriptor_info):
            return reg.get_abs_upgrade(*invalid_module.descriptor_info)

        try:
            try:
                d = get_descriptor(mpkg, mname, mnamespace, '', desired_version)
            except MissingModule, e:
                r = None
                if pkg.can_handle_missing_modules():
                    r = pkg.handle_missing_module(controller, module_id, 
                                                  pipeline)
                    d = get_descriptor(mpkg, mname, mnamespace, '', 
                                       desired_version)
                if not r:
                    raise e
        except MissingModule, e:
            return None
开发者ID:tacaswell,项目名称:VisTrails,代码行数:32,代码来源:upgradeworkflow.py


示例6: new_package

    def new_package(self, package_identifier, prepend=False):
        """Called when a package is loaded in VisTrails.

        Discovers and registers Plots and VariableLoaders.
        """
        pm = get_package_manager()
        package = pm.get_package(package_identifier)
        if hasattr(package.init_module, '_plots'):
            for plot in package.init_module._plots:
                if not isinstance(plot, Plot):
                    warnings.warn(
                        "Package %s (%s) declares in _plots something "
                        "that is not a plot: %r" % (
                            package_identifier, package.codepath, plot))
                    continue
                plot.package_identifier = package_identifier

                # Resolve the port types
                for port in plot.ports:
                    port.type = resolve_descriptor(port.type,
                                                   package_identifier)

                # Read and check the metadata from the workflow
                try:
                    plot._read_metadata(package_identifier)
                except Exception, e:
                    warnings.warn("In package '%s'\n"
                                  "Couldn't read plot subworkflow for '%s':\n"
                                  "%s" % (package_identifier, plot.name, e))
                else:
                    self._add_plot(plot)
开发者ID:VisTrails,项目名称:DAT,代码行数:31,代码来源:global_data.py


示例7: createFailedPackage

    def createFailedPackage(self):
        """ Failed package is created so that the user can remove
        it manually using package submenu """
        pm = get_package_manager()
        if pm.has_package(self.signature):
            # do nothing
            return
        reg = vistrails.core.modules.module_registry.get_module_registry()

        # create a document hash integer from the cached sax tree
        # "name" is what suds use as the cache key
        name = '%s-%s' % (abs(hash(self.address)), "wsdl")
        self.wsdlHash = '0'

        package_id = reg.idScope.getNewId(Package.vtType)
        package = Package(id=package_id,
                          load_configuration=False,
                          name="SUDS#" + self.address,
                          identifier=self.signature,
                          version=self.wsdlHash,
                          )
        suds_package = reg.get_package_by_name(identifier)
        package._module = suds_package.module
        package._init_module = suds_package.init_module
        self.package = package
        reg.add_package(package)
        reg.signals.emit_new_package(self.signature)
        self.module = new_module(Module, str(self.signature))
        reg.add_module(self.module, **{'package':self.signature,
                                       'package_version':self.wsdlHash,
                                       'abstract':True})
        self.service = -1
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:32,代码来源:init.py


示例8: package_configuration

 def package_configuration():
     """
     Create a shortcut to Edit->Preferences->Module Package->Enabled Packages->Configure in menu.
     """
     pkgmgr = get_package_manager()
     package = pkgmgr.get_package(identifier)
     dlg = QPackageConfigurationDialog(None, package)
     dlg.exec_()
开发者ID:KenSuber,项目名称:cwsl-mas,代码行数:8,代码来源:init.py


示例9: setUpClass

 def setUpClass(cls):
     from vistrails.core.packagemanager import get_package_manager
     from vistrails.core.modules.module_registry import MissingPackage
     pm = get_package_manager()
     try:
         pm.get_package('org.vistrails.vistrails.http')
     except MissingPackage:
         pm.late_enable_package('URL')
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:8,代码来源:init.py


示例10: setUp

    def setUp(cls):
        cls._application = dat.tests.setup_application()

        pm = get_package_manager()

        pm.late_enable_package(
            'pkg_test_operations',
            {'pkg_test_operations': 'dat.tests.'})
开发者ID:VisTrails,项目名称:DAT,代码行数:8,代码来源:test_operations.py


示例11: reload_current_package_finisher

 def reload_current_package_finisher(self, codepath, reverse_deps, prefix_dictionary):
     # REENABLES the current package and all reverse dependencies
     pm = get_package_manager()
     try:
         pm.reload_package_enable(reverse_deps, prefix_dictionary)
     except Package.InitializationFailed, e:
         debug.critical("Re-initialization of package '%s' failed" % 
                         codepath, str(e))
         raise
开发者ID:cjh1,项目名称:VisTrails,代码行数:9,代码来源:preferences.py


示例12: choose_operation

def choose_operation(typecasts, source_descriptor, expected_descriptor,
                     parent=None):
    _ = translate('typecast_dialog')

    dialog = QtGui.QDialog(parent)
    dialog.setWindowTitle(_("Type casting"))
    layout = QtGui.QVBoxLayout()

    label = QtGui.QLabel(_(
        "A {actual} variable was put in a {expected} port. These are not "
        "compatible, but the following operations can do the "
        "conversion:").format(
            actual="%s (%s)" % (source_descriptor.module.__name__,
                                source_descriptor.identifier),
            expected="%s (%s)" % (expected_descriptor.module.__name__,
                                  expected_descriptor.identifier)))
    label.setWordWrap(True)
    layout.addWidget(label)
    list_widget = CategorizedListWidget()
    list_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
    pm = get_package_manager()
    for operation in typecasts:
        package = pm.get_package(operation.package_identifier)
        item = OperationItem(operation, package.name)
        list_widget.addItem(item, item.category)
    layout.addWidget(list_widget)

    buttons = QtGui.QHBoxLayout()
    ok = QtGui.QPushButton(_("Typecast", "Accept typecast dialog button"))
    QtCore.QObject.connect(ok, QtCore.SIGNAL('clicked()'),
                           dialog, QtCore.SLOT('accept()'))
    buttons.addWidget(ok)
    cancel = QtGui.QPushButton(_("Cancel", "Reject typecast dialog button"))
    QtCore.QObject.connect(cancel, QtCore.SIGNAL('clicked()'),
                           dialog, QtCore.SLOT('reject()'))
    buttons.addWidget(cancel)
    layout.addLayout(buttons)

    def check_selection():
        selection = list_widget.selectedItems()
        if selection:
            item = selection[0]
            if isinstance(item, OperationItem):
                ok.setEnabled(True)
                return
        ok.setEnabled(False)
    QtCore.QObject.connect(
        list_widget, QtCore.SIGNAL('itemSelectionChanged()'),
        check_selection)
    check_selection()

    dialog.setLayout(layout)
    if dialog.exec_() == QtGui.QDialog.Accepted:
        return list_widget.selectedItems()[0].operation
    else:
        raise CancelExecution
开发者ID:VisTrails,项目名称:DAT,代码行数:56,代码来源:typecast_dialog.py


示例13: reload_current_package

 def reload_current_package(self):
     # DISABLES the current package and all reverse dependencies
     inst = self._enabled_packages_list
     item = inst.currentItem()
     pm = get_package_manager()
     codepath = str(item.text())
     
     palette = QModulePalette.instance()
     palette.setUpdatesEnabled(False)
     pm.reload_package_disable(codepath)
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:preferences.py


示例14: enablePackage

 def enablePackage(self):
     """ enablePackge() -> None
     Tries to enable the controlflow package through the controller.
     """
     pm = get_package_manager()
     cf_pkg_id = 'org.vistrails.vistrails.control_flow'
     if not pm.has_package(cf_pkg_id):
         dep_graph = pm.build_dependency_graph([cf_pkg_id])
         if not self.controller.try_to_enable_package(cf_pkg_id, dep_graph):
             raise MissingPackage(cf_pkg_id)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:controlflow_assist.py


示例15: reload_current_package

    def reload_current_package(self):
        if self._enabled_packages_list.currentItem() is not None:
            # Disables the selected package (which was enabled) and all its
            # reverse dependencies, then enables it all again
            item = self._enabled_packages_list.currentItem()
            pm = get_package_manager()
            codepath = str(item.text())

            palette = QModulePalette.instance()
            palette.setUpdatesEnabled(False)
            pm.reload_package_disable(codepath)
        elif self._available_packages_list.currentItem() is not None:
            # Reloads the selected package's (which was not enabled) __init__
            # module
            item = self._available_packages_list.currentItem()
            pm = get_package_manager()
            codepath = str(item.text())
            pm._available_packages.pop(codepath).unload()
            self.selected_available_list()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:19,代码来源:preferences.py


示例16: selected_available_list

 def selected_available_list(self):
     item = self._available_packages_list.currentItem()
     if item is None:
         return # prevent back and forth looping when clearing selection
     self._enabled_packages_list.setCurrentItem(None)
     codepath = str(item.text())
     pm = get_package_manager()
     self._current_package = pm.look_at_available_package(codepath)
     self.set_buttons_to_available_package()
     self.set_package_information()
     self._available_packages_list.setFocus()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:11,代码来源:preferences.py


示例17: enable_current_package

    def enable_current_package(self):
        av = self._available_packages_list
        item = av.currentItem()
        codepath = str(item.text())
        pm = get_package_manager()

        try:
            new_deps = self._current_package.dependencies()
        except Exception, e:
            debug.critical("Failed getting dependencies of package %s, "
                           "so it will not be enabled" % \
                            self._current_package.name, str(e))
            return
开发者ID:cjh1,项目名称:VisTrails,代码行数:13,代码来源:preferences.py


示例18: selected_enabled_list

 def selected_enabled_list(self):
     item = self._enabled_packages_list.currentItem()
     if item is None:
         return # prevent back and forth looping when clearing selection
     self._available_packages_list.setCurrentItem(None)
     codepath = str(item.text())
     pm = get_package_manager()
     self._current_package = pm.get_package_by_codepath(codepath)
     self.set_buttons_to_enabled_package()
     # A delayed signal can result in the package already has been removed
     if not pm.has_package(self._current_package.identifier):
         return
     self.set_package_information()
     self._enabled_packages_list.setFocus()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:14,代码来源:preferences.py


示例19: populate_lists

 def populate_lists(self):
     pkg_manager = get_package_manager()
     enabled_pkgs = sorted(pkg_manager.enabled_package_list())
     enabled_pkg_dict = dict([(pkg.codepath, pkg) for
                                pkg in enabled_pkgs])
     self._enabled_packages_list.clear()
     for pkg in enabled_pkgs:
         self._enabled_packages_list.addItem(pkg.codepath)
     self._enabled_packages_list.sortItems()
     available_pkg_names = [pkg for pkg in 
                            sorted(pkg_manager.available_package_names_list())
                            if pkg not in enabled_pkg_dict]
     self._available_packages_list.clear()
     for pkg in available_pkg_names:
         self._available_packages_list.addItem(pkg)
     self._available_packages_list.sortItems()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:16,代码来源:preferences.py


示例20: setUpClass

 def setUpClass(cls):
     # first make sure CLTools is loaded
     pm = get_package_manager()
     if 'CLTools' not in pm._package_list: # pragma: no cover # pragma: no branch
         pm.late_enable_package('CLTools')
     remove_all_scripts()
     cls.testdir = os.path.join(packages_directory(), 'CLTools', 'test_files')
     cls._tools = {}
     for name in os.listdir(cls.testdir):
         if not name.endswith(SUFFIX):
             continue
         _add_tool(os.path.join(cls.testdir, name))
         toolname = os.path.splitext(name)[0]
         cls._tools[toolname] = cl_tools[toolname]
     cls._old_dir = os.getcwd()
     os.chdir(vistrails_root_directory())
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:16,代码来源:init.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python system.get_vistrails_basic_pkg_id函数代码示例发布时间:2022-05-26
下一篇:
Python vistrails_module.Module类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap