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

Python programs.is_module_installed函数代码示例

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

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



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

示例1: setup_page

    def setup_page(self):
        # Connections group
        connections_group = QGroupBox(_("Automatic connections"))
        connections_label = QLabel(_("This pane can automatically "
                                     "show an object's help information after "
                                     "a left parenthesis is written next to it. "
                                     "Below you can decide to which plugin "
                                     "you want to connect it to turn on this "
                                     "feature."))
        connections_label.setWordWrap(True)
        editor_box = self.create_checkbox(_("Editor"), 'connect/editor')
        rope_installed = programs.is_module_installed('rope')
        jedi_installed = programs.is_module_installed('jedi', '>=0.8.1')
        editor_box.setEnabled(rope_installed or jedi_installed)
        if not rope_installed and not jedi_installed:
            editor_tip = _("This feature requires the Rope or Jedi libraries.\n"
                           "It seems you don't have either installed.")
            editor_box.setToolTip(editor_tip)
        ipython_box = self.create_checkbox(_("IPython Console"),
                                           'connect/ipython_console')

        connections_layout = QVBoxLayout()
        connections_layout.addWidget(connections_label)
        connections_layout.addWidget(editor_box)
        connections_layout.addWidget(ipython_box)
        connections_group.setLayout(connections_layout)

        # Features group
        features_group = QGroupBox(_("Additional features"))
        math_box = self.create_checkbox(_("Render mathematical equations"),
                                        'math')
        req_sphinx = programs.is_module_installed('sphinx', '>=1.1')
        math_box.setEnabled(req_sphinx)
        if not req_sphinx:
            sphinx_ver = programs.get_module_version('sphinx')
            sphinx_tip = _("This feature requires Sphinx 1.1 or superior.")
            sphinx_tip += "\n" + _("Sphinx %s is currently installed.") % sphinx_ver
            math_box.setToolTip(sphinx_tip)

        features_layout = QVBoxLayout()
        features_layout.addWidget(math_box)
        features_group.setLayout(features_layout)

        # Source code group
        sourcecode_group = QGroupBox(_("Source code"))
        wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap')

        sourcecode_layout = QVBoxLayout()
        sourcecode_layout.addWidget(wrap_mode_box)
        sourcecode_group.setLayout(sourcecode_layout)

        # Final layout
        vlayout = QVBoxLayout()
        vlayout.addWidget(connections_group)
        vlayout.addWidget(features_group)
        vlayout.addWidget(sourcecode_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
开发者ID:rlaverde,项目名称:spyder,代码行数:58,代码来源:help.py


示例2: is_qtconsole_installed

def is_qtconsole_installed():
    pyzmq_installed = programs.is_module_installed('zmq', version=ZMQ_REQVER)
    pygments_installed = programs.is_module_installed('pygments')
    qtconsole_installed = programs.is_module_installed('qtconsole',
                                                       version=QTCONSOLE_REQVER)

    if pyzmq_installed and pygments_installed and qtconsole_installed:
        return True
    else:
        return False
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:10,代码来源:ipython.py


示例3: import_test

 def import_test(self):
     """Raise ImportError if feature is not supported."""
     from spyder.utils import programs
     if not programs.is_module_installed('psutil', '>=0.2.0'):
         # The `interval` argument in `psutil.cpu_percent` function
         # was introduced in v0.2.0
         raise ImportError
开发者ID:impact27,项目名称:spyder,代码行数:7,代码来源:status.py


示例4: long_banner

    def long_banner(self):
        """Banner for IPython widgets with pylab message"""
        # Default banner
        from IPython.core.usage import quick_guide

        banner_parts = [
            "Python %s\n" % self.interpreter_versions["python_version"],
            'Type "copyright", "credits" or "license" for more information.\n\n',
            "IPython %s -- An enhanced Interactive Python.\n" % self.interpreter_versions["ipython_version"],
            quick_guide,
        ]
        banner = "".join(banner_parts)

        # Pylab additions
        pylab_o = self.additional_options["pylab"]
        autoload_pylab_o = self.additional_options["autoload_pylab"]
        mpl_installed = programs.is_module_installed("matplotlib")
        if mpl_installed and (pylab_o and autoload_pylab_o):
            pylab_message = "\nPopulating the interactive namespace from " "numpy and matplotlib"
            banner = banner + pylab_message

        # Sympy additions
        sympy_o = self.additional_options["sympy"]
        if sympy_o:
            lines = """
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
"""
            banner = banner + lines
        return banner
开发者ID:silentquasar,项目名称:spyder,代码行数:34,代码来源:shell.py


示例5: load_plugin

 def load_plugin(self):
     """Load the Jedi introspection plugin"""
     if not programs.is_module_installed('jedi', JEDI_REQVER):
         raise ImportError('Requires Jedi %s' % JEDI_REQVER)
     jedi.settings.case_insensitive_completion = False
     for lib in ['numpy', 'matplotlib']:
         jedi.preload_module(lib)
开发者ID:rlaverde,项目名称:spyder,代码行数:7,代码来源:jedi_plugin.py


示例6: set_umr_namelist

 def set_umr_namelist(self):
     """Set UMR excluded modules name list"""
     arguments, valid = QInputDialog.getText(self, _('UMR'),
                               _("Set the list of excluded modules as "
                                 "this: <i>numpy, scipy</i>"),
                               QLineEdit.Normal,
                               ", ".join(self.get_option('umr/namelist')))
     if valid:
         arguments = to_text_string(arguments)
         if arguments:
             namelist = arguments.replace(' ', '').split(',')
             fixed_namelist = [module_name for module_name in namelist
                               if programs.is_module_installed(module_name)]
             invalid = ", ".join(set(namelist)-set(fixed_namelist))
             if invalid:
                 QMessageBox.warning(self, _('UMR'),
                                     _("The following modules are not "
                                       "installed on your machine:\n%s"
                                       ) % invalid, QMessageBox.Ok)
             QMessageBox.information(self, _('UMR'),
                                 _("Please note that these changes will "
                                   "be applied only to new Python/IPython "
                                   "consoles"), QMessageBox.Ok)
         else:
             fixed_namelist = []
         self.set_option('umr/namelist', fixed_namelist)
开发者ID:jitseniesen,项目名称:spyder,代码行数:26,代码来源:maininterpreter.py


示例7: setup_page

    def setup_page(self):
        ar_group = QGroupBox(_("Autorefresh"))
        ar_box = self.create_checkbox(_("Enable autorefresh"),
                                      'autorefresh')
        ar_spin = self.create_spinbox(_("Refresh interval: "),
                                      _(" ms"), 'autorefresh/timeout',
                                      min_=100, max_=1000000, step=100)
        
        filter_group = QGroupBox(_("Filter"))
        filter_data = [
            ('exclude_private', _("Exclude private references")),
            ('exclude_capitalized', _("Exclude capitalized references")),
            ('exclude_uppercase', _("Exclude all-uppercase references")),
            ('exclude_unsupported', _("Exclude unsupported data types")),
                ]
        filter_boxes = [self.create_checkbox(text, option)
                        for option, text in filter_data]

        display_group = QGroupBox(_("Display"))
        display_data = [('truncate', _("Truncate values"), '')]
        if programs.is_module_installed('numpy'):
            display_data.append(('minmax', _("Show arrays min/max"), ''))
        display_data.append(
            ('remote_editing', _("Edit data in the remote process"),
             _("Editors are opened in the remote process for NumPy "
               "arrays, PIL images, lists, tuples and dictionaries.\n"
               "This avoids transfering large amount of data between "
               "the remote process and Spyder (through the socket)."))
                            )
        display_boxes = [self.create_checkbox(text, option, tip=tip)
                         for option, text, tip in display_data]
        
        ar_layout = QVBoxLayout()
        ar_layout.addWidget(ar_box)
        ar_layout.addWidget(ar_spin)
        ar_group.setLayout(ar_layout)
        
        filter_layout = QVBoxLayout()
        for box in filter_boxes:
            filter_layout.addWidget(box)
        filter_group.setLayout(filter_layout)

        display_layout = QVBoxLayout()
        for box in display_boxes:
            display_layout.addWidget(box)
        display_group.setLayout(display_layout)

        vlayout = QVBoxLayout()
        vlayout.addWidget(ar_group)
        vlayout.addWidget(filter_group)
        vlayout.addWidget(display_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
开发者ID:jitseniesen,项目名称:spyder,代码行数:53,代码来源:variableexplorer.py


示例8: set_umr_namelist

 def set_umr_namelist(self):
     """Set UMR excluded modules name list"""
     arguments, valid = QInputDialog.getText(self, _('UMR'),
                               _("Set the list of excluded modules as "
                                 "this: <i>numpy, scipy</i>"),
                               QLineEdit.Normal,
                               ", ".join(self.get_option('umr/namelist')))
     if valid:
         arguments = to_text_string(arguments)
         if arguments:
             namelist = arguments.replace(' ', '').split(',')
             fixed_namelist = []
             non_ascii_namelist = []
             for module_name in namelist:
                 if PY2:
                     if all(ord(c) < 128 for c in module_name):
                         if programs.is_module_installed(module_name):
                             fixed_namelist.append(module_name)
                     else:
                         QMessageBox.warning(self, _('Warning'),
                         _("You are working with Python 2, this means that "
                           "you can not import a module that contains non-"
                           "ascii characters."), QMessageBox.Ok)
                         non_ascii_namelist.append(module_name)
                 elif programs.is_module_installed(module_name):
                     fixed_namelist.append(module_name)
             invalid = ", ".join(set(namelist)-set(fixed_namelist)-
                                 set(non_ascii_namelist))
             if invalid:
                 QMessageBox.warning(self, _('UMR'),
                                     _("The following modules are not "
                                       "installed on your machine:\n%s"
                                       ) % invalid, QMessageBox.Ok)
             QMessageBox.information(self, _('UMR'),
                                 _("Please note that these changes will "
                                   "be applied only to new Python/IPython "
                                   "consoles"), QMessageBox.Ok)
         else:
             fixed_namelist = []
         self.set_option('umr/namelist', fixed_namelist)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:40,代码来源:maininterpreter.py


示例9: register_plugin

 def register_plugin(self):
     """Register plugin in Spyder's main window"""
     self.pylint.treewidget.sig_edit_goto.connect(self.main.editor.load)
     self.pylint.redirect_stdio.connect(
         self.main.redirect_internalshell_stdio)
     self.main.add_dockwidget(self)
     
     pylint_act = create_action(self, _("Run static code analysis"),
                                triggered=self.run_pylint)
     pylint_act.setEnabled(is_module_installed('pylint'))
     self.register_shortcut(pylint_act, context="Pylint",
                            name="Run analysis")
     
     self.main.source_menu_actions += [MENU_SEPARATOR, pylint_act]
     self.main.editor.pythonfile_dependent_actions += [pylint_act]
开发者ID:burrbull,项目名称:spyder,代码行数:15,代码来源:plugin.py


示例10: load_plugin

 def load_plugin(self):
     """Load the Rope introspection plugin"""
     if not programs.is_module_installed('rope', ROPE_REQVER):
         raise ImportError('Requires Rope %s' % ROPE_REQVER)
     self.project = None
     self.create_rope_project(root_path=get_conf_path())
     submods = get_preferred_submodules()
     actual = []
     for submod in submods:
         try:
             imp.find_module(submod)
             actual.append(submod)
         except ImportError:
             pass
     if self.project is not None:
         self.project.prefs.set('extension_modules', actual)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:16,代码来源:rope_plugin.py


示例11: find_return_types

def find_return_types(module_context, func):
    """
    Determines a set of potential return types for `func` using docstring hints
    :type evaluator: jedi.evaluate.Evaluator
    :type param: jedi.parser.tree.Param
    :rtype: list
    >>> from jedi.evaluate.docstrings import *  # NOQA
    >>> from jedi.evaluate.docstrings import _search_param_in_docstr
    >>> from jedi.evaluate.docstrings import _evaluate_for_statement_string
    >>> from jedi.evaluate.docstrings import _search_return_in_gooogledocstr
    >>> from jedi.evaluate.docstrings import _search_return_in_numpydocstr
    >>> from jedi._compatibility import builtins
    >>> source = open(jedi.evaluate.docstrings.__file__.replace('.pyc', '.py'), 'r').read()
    >>> script = jedi.Script(source)
    >>> evaluator = script._evaluator
    >>> func = script._get_module().names_dict['find_return_types'][0].parent
    >>> types = find_return_types(evaluator, func)
    >>> print('types = %r' % (types,))
    >>> assert len(types) == 1
    >>> assert types[0].base.obj is builtins.list
    """
    def search_return_in_docstr(docstr):
        # Check for Sphinx/Epydoc return hint
        for p in DOCSTRING_RETURN_PATTERNS:
            match = p.search(docstr)
            if match:
                return [_strip_rst_role(match.group(1))]
        found = []

        if not found:
            # Check for numpy style return hint
            found = _search_return_in_numpydocstr(docstr)
        return found
    try:
        docstr = u(func.raw_doc)
    except AttributeError:
        docstr = u(func.doc)
    types = []
    for type_str in search_return_in_docstr(docstr):
        if is_module_installed('jedi', '>=0.10.0;<0.11'):
            type_ = _evaluate_for_statement_string(module_context, type_str)
        else:
            module = func.get_parent_until()
            type_ = _evaluate_for_statement_string(module_context,
                                                   type_str, module)
        types.extend(type_)
    return types
开发者ID:rlaverde,项目名称:spyder,代码行数:47,代码来源:numpy_docstr.py


示例12: create_module_bookmark_actions

def create_module_bookmark_actions(parent, bookmarks):
    """
    Create bookmark actions depending on module installation:
    bookmarks = ((module_name, url, title), ...)
    """
    actions = []
    for key, url, title in bookmarks:
        # Create actions for scientific distros only if Spyder is installed
        # under them
        create_act = True
        if key == 'xy' or key == 'winpython':
            if not programs.is_module_installed(key):
                create_act = False
        if create_act:
            act = create_bookmark_action(parent, url, title)
            actions.append(act)
    return actions
开发者ID:silentquasar,项目名称:spyder,代码行数:17,代码来源:qthelpers.py


示例13: long_banner

    def long_banner(self):
        """Banner for IPython widgets with pylab message"""
        # Default banner
        try:
            from IPython.core.usage import quick_guide
        except Exception:
            quick_guide = ''
        banner_parts = [
            'Python %s\n' % self.interpreter_versions['python_version'],
            'Type "copyright", "credits" or "license" for more information.\n\n',
            'IPython %s -- An enhanced Interactive Python.\n' % \
            self.interpreter_versions['ipython_version'],
            quick_guide
        ]
        banner = ''.join(banner_parts)

        # Pylab additions
        pylab_o = self.additional_options['pylab']
        autoload_pylab_o = self.additional_options['autoload_pylab']
        mpl_installed = programs.is_module_installed('matplotlib')
        if mpl_installed and (pylab_o and autoload_pylab_o):
            pylab_message = ("\nPopulating the interactive namespace from "
                             "numpy and matplotlib\n")
            banner = banner + pylab_message

        # Sympy additions
        sympy_o = self.additional_options['sympy']
        if sympy_o:
            lines = """
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
"""
            banner = banner + lines
        if (pylab_o and sympy_o):
            lines = """
Warning: pylab (numpy and matplotlib) and symbolic math (sympy) are both 
enabled at the same time. Some pylab functions are going to be overrided by 
the sympy module (e.g. plot)
"""
            banner = banner + lines
        return banner
开发者ID:impact27,项目名称:spyder,代码行数:45,代码来源:shell.py


示例14: setup_option_actions

    def setup_option_actions(self, exclude_private, exclude_uppercase,
                             exclude_capitalized, exclude_unsupported):
        """Setup the actions to show in the cog menu."""
        self.setup_in_progress = True

        self.exclude_private_action = create_action(self,
                _("Exclude private references"),
                tip=_("Exclude references which name starts"
                            " with an underscore"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_private', state))
        self.exclude_private_action.setChecked(exclude_private)
        
        self.exclude_uppercase_action = create_action(self,
                _("Exclude all-uppercase references"),
                tip=_("Exclude references which name is uppercase"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_uppercase', state))
        self.exclude_uppercase_action.setChecked(exclude_uppercase)
        
        self.exclude_capitalized_action = create_action(self,
                _("Exclude capitalized references"),
                tip=_("Exclude references which name starts with an "
                      "uppercase character"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_capitalized', state))
        self.exclude_capitalized_action.setChecked(exclude_capitalized)
        
        self.exclude_unsupported_action = create_action(self,
                _("Exclude unsupported data types"),
                tip=_("Exclude references to unsupported data types"
                            " (i.e. which won't be handled/saved correctly)"),
                toggled=lambda state:
                self.sig_option_changed.emit('exclude_unsupported', state))
        self.exclude_unsupported_action.setChecked(exclude_unsupported)

        self.actions = [
            self.exclude_private_action, self.exclude_uppercase_action,
            self.exclude_capitalized_action, self.exclude_unsupported_action]
        if is_module_installed('numpy'):
            self.actions.extend([MENU_SEPARATOR, self.editor.minmax_action])

        self.setup_in_progress = False
开发者ID:burrbull,项目名称:spyder,代码行数:43,代码来源:namespacebrowser.py


示例15: _shape_text

 def _shape_text(self, text, colsep=u"\t", rowsep=u"\n",
                 transpose=False, skiprows=0, comments='#'):
     """Decode the shape of the given text"""
     assert colsep != rowsep
     out = []
     text_rows = text.split(rowsep)[skiprows:]
     for row in text_rows:
         stripped = to_text_string(row).strip()
         if len(stripped) == 0 or stripped.startswith(comments):
             continue
         line = to_text_string(row).split(colsep)
         line = [try_to_parse(to_text_string(x)) for x in line]
         out.append(line)
     # Replace missing elements with np.nan's or None's
     if programs.is_module_installed('numpy'):
         from numpy import nan
         out = list(zip_longest(*out, fillvalue=nan))
     else:
         out = list(zip_longest(*out, fillvalue=None))
     # Tranpose the last result to get the expected one
     out = [[r[col] for r in out] for col in range(len(out[0]))]
     if transpose:
         return [[r[col] for r in out] for col in range(len(out[0]))]
     return out
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:24,代码来源:importwizard.py


示例16: apply

def apply():
    """Monkey patching rope

    See [1], [2], [3], [4] and [5] in module docstring."""
    from spyder.utils.programs import is_module_installed
    if is_module_installed('rope', '<0.9.4'):
        import rope
        raise ImportError("rope %s can't be patched" % rope.VERSION)

    # [1] Patching project.Project for compatibility with py2exe/cx_Freeze
    #     distributions
    from spyder.config.base import is_py2exe_or_cx_Freeze
    if is_py2exe_or_cx_Freeze():
        from rope.base import project
        class PatchedProject(project.Project):
            def _default_config(self):
                # py2exe/cx_Freeze distribution
                from spyder.config.base import get_module_source_path
                fname = get_module_source_path('spyder',
                                               'default_config.py')
                return open(fname, 'rb').read()
        project.Project = PatchedProject
    
    # Patching pycore.PyCore...
    from rope.base import pycore
    class PatchedPyCore(pycore.PyCore):
        # [2] ...so that forced builtin modules (i.e. modules that were 
        # declared as 'extension_modules' in rope preferences) will be indeed
        # recognized as builtins by rope, as expected
        # 
        # This patch is included in rope 0.9.4+ but applying it anyway is ok
        def get_module(self, name, folder=None):
            """Returns a `PyObject` if the module was found."""
            # check if this is a builtin module
            pymod = self._builtin_module(name)
            if pymod is not None:
                return pymod
            module = self.find_module(name, folder)
            if module is None:
                raise pycore.ModuleNotFoundError(
                                            'Module %s not found' % name)
            return self.resource_to_pyobject(module)
        # [3] ...to avoid considering folders without __init__.py as Python
        # packages
        def _find_module_in_folder(self, folder, modname):
            module = folder
            packages = modname.split('.')
            for pkg in packages[:-1]:
                if  module.is_folder() and module.has_child(pkg):
                    module = module.get_child(pkg)
                else:
                    return None
            if module.is_folder():
                if module.has_child(packages[-1]) and \
                   module.get_child(packages[-1]).is_folder() and \
                   module.get_child(packages[-1]).has_child('__init__.py'):
                    return module.get_child(packages[-1])
                elif module.has_child(packages[-1] + '.py') and \
                     not module.get_child(packages[-1] + '.py').is_folder():
                    return module.get_child(packages[-1] + '.py')
    pycore.PyCore = PatchedPyCore

    # [2] Patching BuiltinName for the go to definition feature to simply work 
    # with forced builtins
    from rope.base import builtins, libutils, pyobjects
    import inspect
    import os.path as osp
    class PatchedBuiltinName(builtins.BuiltinName):
        def _pycore(self):
            p = self.pyobject
            while p.parent is not None:
                p = p.parent
            if isinstance(p, builtins.BuiltinModule) and p.pycore is not None:
                return p.pycore
        def get_definition_location(self):
            if not inspect.isbuiltin(self.pyobject):
                _lines, lineno = inspect.getsourcelines(self.pyobject.builtin)
                path = inspect.getfile(self.pyobject.builtin)
                if path.endswith('pyc') and osp.isfile(path[:-1]):
                    path = path[:-1]
                pycore = self._pycore()
                if pycore and pycore.project:
                    resource = libutils.path_to_resource(pycore.project, path)
                    module = pyobjects.PyModule(pycore, None, resource)
                    return (module, lineno)
            return (None, None)
    builtins.BuiltinName = PatchedBuiltinName
    
    # [4] Patching several PyDocExtractor methods:
    # 1. get_doc:
    # To force rope to return the docstring of any object which has one, even
    # if it's not an instance of AbstractFunction, AbstractClass, or
    # AbstractModule.
    # Also, to use utils.dochelpers.getdoc to get docs from forced builtins.
    #
    # 2. _get_class_docstring and _get_single_function_docstring:
    # To not let rope add a 2 spaces indentation to every docstring, which was
    # breaking our rich text mode. The only value that we are modifying is the
    # 'indents' keyword of those methods, from 2 to 0.
    #
#.........这里部分代码省略.........
开发者ID:0xBADCA7,项目名称:spyder,代码行数:101,代码来源:rope_patch.py


示例17: data_header

    assert data_header(header, 1, 4) == 'one'
    assert data_header(header, 0, 5) == 'foo'
    assert data_header(header, 1, 5) == 'two'


def test_header_bom():
    """Test for BOM data in the headers."""
    df = read_csv(os.path.join(FILES_PATH, 'issue_2514.csv'))
    editor = DataFrameEditor(None)
    editor.setup_and_check(df)
    header = editor.table_header.model()
    assert header.headerData(0, Qt.Horizontal,
                             Qt.DisplayRole) == "Date (MMM-YY)"


@pytest.mark.skipif(is_module_installed('pandas', '<0.19'),
                    reason="It doesn't work for Pandas 0.19-")
def test_header_encoding():
    """Test for header encoding handling."""
    df = read_csv(os.path.join(FILES_PATH, 'issue_3896.csv'))
    editor = DataFrameEditor(None)
    editor.setup_and_check(df)
    header = editor.table_header.model()
    assert header.headerData(0, Qt.Horizontal,
                             Qt.DisplayRole) == "Unnamed: 0"
    assert "Unieke_Idcode" in header.headerData(1, Qt.Horizontal,
                                                Qt.DisplayRole)
    assert header.headerData(2, Qt.Horizontal,
                             Qt.DisplayRole) == "a"
    assert header.headerData(3, Qt.Horizontal,
                             Qt.DisplayRole) == "b"
开发者ID:burrbull,项目名称:spyder,代码行数:31,代码来源:test_dataframeeditor.py


示例18: psutil_phymem_usage

def psutil_phymem_usage():
    """
    Return physical memory usage (float)
    Requires the cross-platform psutil (>=v0.3) library
    (http://code.google.com/p/psutil/)
    """
    import psutil
    # This is needed to avoid a deprecation warning error with
    # newer psutil versions
    try:
        percent = psutil.virtual_memory().percent
    except:
        percent = psutil.phymem_usage().percent
    return percent

if programs.is_module_installed('psutil', '>=0.3.0'):
    #  Function `psutil.phymem_usage` was introduced in psutil v0.3.0
    memory_usage = psutil_phymem_usage
elif os.name == 'nt':
    # Backup plan for Windows platforms
    memory_usage = windows_memory_usage
else:
    raise ImportError("Feature requires psutil 0.3+ on non Windows platforms")


if __name__ == '__main__':
    print("*"*80)
    print(memory_usage.__doc__)
    print(memory_usage())
    if os.name == 'nt':
        #  windll can only be imported if os.name = 'nt' or 'ce'
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:31,代码来源:system.py


示例19: except

        # Numpy scalars all inherit from np.generic.
        # Numpy arrays all inherit from np.ndarray.
        # If we check that we are certain we have one of these
        # types then we are less likely to generate an exception below.
            try:
                return obj.dtype.type
            except (AttributeError, RuntimeError):
                #  AttributeError: some NumPy objects have no dtype attribute
                #  RuntimeError: happens with NetCDF objects (Issue 998)
                return


#==============================================================================
# Pandas support
#==============================================================================
if programs.is_module_installed('pandas', PANDAS_REQVER):
    from pandas import DataFrame, Series
else:
    DataFrame = Series = FakeObject      # analysis:ignore


#==============================================================================
# PIL Images support
#==============================================================================
try:
    from spyder import pil_patch
    Image = pil_patch.Image.Image
except ImportError:
    Image = FakeObject  # analysis:ignore

开发者ID:jitseniesen,项目名称:spyder,代码行数:29,代码来源:utils.py


示例20: check

 def check(self):
     """Check if dependency is installed"""
     return programs.is_module_installed(self.modname,
                                         self.required_version,
                                         self.installed_version)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:5,代码来源:dependencies.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python qthelpers.add_actions函数代码示例发布时间:2022-05-27
下一篇:
Python icon_manager.icon函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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