本文整理匯總了Python中jedi.__version__方法的典型用法代碼示例。如果您正苦於以下問題:Python jedi.__version__方法的具體用法?Python jedi.__version__怎麽用?Python jedi.__version__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jedi
的用法示例。
在下文中一共展示了jedi.__version__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_all
# 需要導入模塊: import jedi [as 別名]
# 或者: from jedi import __version__ [as 別名]
def test_all():
if sys.version_info >= (3, 8):
warnings.warn("Skipping name matcher tests in Python 3.8")
return
import jedi
if (
jedi.__version__.startswith("0.13.")
or jedi.__version__.startswith("0.14.")
or jedi.__version__.startswith("0.15.")
or jedi.__version__.startswith("0.16.")
):
warnings.warn("Skipping name matcher tests for Jedi " + jedi.__version__)
return
for i, test in enumerate(TEST_GROUPS):
print("Running test group %d: " % (i + 1))
_assert_returns_correct_indices(test[0], test[1], test[2])
示例2: version_info
# 需要導入模塊: import jedi [as 別名]
# 或者: from jedi import __version__ [as 別名]
def version_info():
"""
Returns a namedtuple of Jedi's version, similar to Python's
``sys.version_info``.
"""
Version = namedtuple('Version', 'major, minor, micro, releaselevel, serial')
from jedi import __version__
tupl = re.findall('[a-z]+|\d+', __version__)
return Version(*[x if i == 3 else int(x) for i, x in enumerate(tupl)])
示例3: version_info
# 需要導入模塊: import jedi [as 別名]
# 或者: from jedi import __version__ [as 別名]
def version_info():
"""
Returns a namedtuple of Jedi's version, similar to Python's
``sys.version_info``.
"""
Version = namedtuple('Version', 'major, minor, micro')
from jedi import __version__
tupl = re.findall('[a-z]+|\d+', __version__)
return Version(*[x if i == 3 else int(x) for i, x in enumerate(tupl)])
示例4: get_completions
# 需要導入模塊: import jedi [as 別名]
# 或者: from jedi import __version__ [as 別名]
def get_completions(self, info):
'''Get Python completions'''
# https://github.com/davidhalter/jedi/blob/master/jedi/utils.py
if jedi is None:
return []
text = info['code']
position = (info['line_num'], info['column'])
interpreter = Interpreter(text, [self.env])
if jedi.__version__ >= LooseVersion('0.12.0'):
lines = split_lines(text)
name = get_on_completion_name(
interpreter._module_node,
lines,
position
)
before = text[:len(text) - len(name)]
elif jedi.__version__ >= LooseVersion('0.10.0'):
lines = split_lines(text)
name = get_on_completion_name(
interpreter._get_module_node(),
lines,
position
)
before = text[:len(text) - len(name)]
else:
path = UserContext(text, position).get_path_until_cursor()
path, dot, like = completion_parts(path)
before = text[:len(text) - len(like)]
completions = interpreter.completions()
completions = [before + c.name_with_symbols for c in completions]
self.kernel.log.error(completions)
return [c[info['start']:] for c in completions]