jedi = None jedi_import_error = sys.exc_info() else: try: version = jedi.__version__ except Exception as e: # e.g. AttributeError echo_highlight( "Error when loading the jedi python module ({0}). " "Please ensure that Jedi is installed correctly (see Installation " "in the README.".format(e)) jedi = None else: if isinstance(version, str): # the normal use case, now. from jedi import utils version = utils.version_info() if version < (0, 7): echo_highlight('Please update your Jedi version, it is too old.') finally: sys.path.remove(jedi_path) sys.path.remove(parso_path) class VimCompat: _eval_cache = {} _func_cache = {} @classmethod def has(cls, what): try: return cls._eval_cache[what]
jedi = None jedi_import_error = str(e) else: try: version = jedi.__version__ except Exception as e: # e.g. AttributeError echo_highlight( "Error when loading the jedi python module ({0}). " "Please ensure that Jedi is installed correctly (see Installation " "in the README.".format(e)) jedi = None else: if isinstance(version, str): # the normal use case, now. from jedi import utils version = utils.version_info() if version < (0, 7): echo_highlight('Please update your Jedi version, it is too old.') finally: sys.path.remove(jedi_path) sys.path.remove(parso_path) def catch_and_print_exceptions(func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except (Exception, vim.error): print(traceback.format_exc()) return None return wrapper
def test_version_info(): assert utils.version_info()[:2] > (0, 7)
# The master toctree document. master_doc = 'index' # General information about the project. project = 'Jedi' copyright = 'jedi contributors' import jedi from jedi.utils import version_info # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y.Z version. version = '.'.join(str(x) for x in version_info()[:3]) # The full version, including alpha/beta/rc tags. release = jedi.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files.
# The master toctree document. master_doc = 'index' # General information about the project. project = u'Jedi' copyright = u'jedi contributors' import jedi from jedi.utils import version_info # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '.'.join(str(x) for x in version_info()[:2]) # The full version, including alpha/beta/rc tags. release = jedi.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files.