mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e175ca82b | ||
|
|
30e9b7b5be | ||
|
|
83545bc9ec | ||
|
|
57e7b83455 | ||
|
|
0770372857 | ||
|
|
7e533ca7e1 | ||
|
|
a60fdba1d4 | ||
|
|
9d399a9229 | ||
|
|
770cdade00 | ||
|
|
29890c1f29 | ||
|
|
159566e1a0 | ||
|
|
a80618a2df | ||
|
|
4bc1b6ef99 | ||
|
|
d655d65d3a |
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -7,11 +7,11 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, windows-2019]
|
||||
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]
|
||||
environment: ['3.8', '3.11', '3.10', '3.9', '3.7', '3.6', 'interpreter']
|
||||
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7", "3.6"]
|
||||
environment: ['3.8', '3.12', '3.11', '3.10', '3.9', '3.7', '3.6', 'interpreter']
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -19,10 +19,12 @@ jobs:
|
||||
if: ${{ matrix.environment != 'interpreter' }}
|
||||
with:
|
||||
python-version: ${{ matrix.environment }}
|
||||
allow-prereleases: true
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
allow-prereleases: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: 'pip install .[testing]'
|
||||
@@ -36,7 +38,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -53,7 +55,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
@@ -6,6 +6,11 @@ Changelog
|
||||
Unreleased
|
||||
++++++++++
|
||||
|
||||
0.19.1 (2023-10-02)
|
||||
+++++++++++++++++++
|
||||
|
||||
- Python 3.12 support (Thanks Peter!)
|
||||
|
||||
0.19.0 (2023-07-29)
|
||||
+++++++++++++++++++
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ ad
|
||||
load
|
||||
"""
|
||||
|
||||
__version__ = '0.19.0'
|
||||
__version__ = '0.19.1'
|
||||
|
||||
from jedi.api import Script, Interpreter, set_debug_function, preload_module
|
||||
from jedi import settings
|
||||
|
||||
@@ -17,7 +17,7 @@ import parso
|
||||
|
||||
_VersionInfo = namedtuple('VersionInfo', 'major minor micro') # type: ignore[name-match]
|
||||
|
||||
_SUPPORTED_PYTHONS = ['3.11', '3.10', '3.9', '3.8', '3.7', '3.6']
|
||||
_SUPPORTED_PYTHONS = ['3.12', '3.11', '3.10', '3.9', '3.8', '3.7', '3.6']
|
||||
_SAFE_PATHS = ['/usr/bin', '/usr/local/bin']
|
||||
_CONDA_VAR = 'CONDA_PREFIX'
|
||||
_CURRENT_VERSION = '%s.%s' % (sys.version_info.major, sys.version_info.minor)
|
||||
|
||||
@@ -90,7 +90,7 @@ class InferenceState:
|
||||
self.compiled_subprocess = environment.get_inference_state_subprocess(self)
|
||||
self.grammar = environment.get_grammar()
|
||||
|
||||
self.latest_grammar = parso.load_grammar(version='3.11')
|
||||
self.latest_grammar = parso.load_grammar(version='3.12')
|
||||
self.memoize_cache = {} # for memoize decorators
|
||||
self.module_cache = imports.ModuleCache() # does the job of `sys.modules`.
|
||||
self.stub_module_cache = {} # Dict[Tuple[str, ...], Optional[ModuleValue]]
|
||||
|
||||
8
setup.py
8
setup.py
@@ -27,12 +27,15 @@ setup(name='jedi',
|
||||
maintainer=__AUTHOR__,
|
||||
maintainer_email=__AUTHOR_EMAIL__,
|
||||
url='https://github.com/davidhalter/jedi',
|
||||
project_urls={
|
||||
"Documentation": 'https://jedi.readthedocs.io/en/latest/',
|
||||
},
|
||||
license='MIT',
|
||||
keywords='python completion refactoring vim',
|
||||
long_description=readme,
|
||||
packages=find_packages(exclude=['test', 'test.*']),
|
||||
python_requires='>=3.6',
|
||||
# Python 3.11 grammar is added to parso in 0.8.3
|
||||
# Python 3.11 & 3.12 grammars are added to parso in 0.8.3
|
||||
install_requires=['parso>=0.8.3,<0.9.0'],
|
||||
extras_require={
|
||||
'testing': [
|
||||
@@ -41,7 +44,7 @@ setup(name='jedi',
|
||||
'docopt',
|
||||
# coloroma for colored debug output
|
||||
'colorama',
|
||||
'Django<3.1', # For now pin this.
|
||||
'Django',
|
||||
'attrs',
|
||||
],
|
||||
'qa': [
|
||||
@@ -97,6 +100,7 @@ setup(name='jedi',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Programming Language :: Python :: 3.10',
|
||||
'Programming Language :: Python :: 3.11',
|
||||
'Programming Language :: Python :: 3.12',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||
'Topic :: Text Editors :: Integrated Development Environments (IDE)',
|
||||
'Topic :: Utilities',
|
||||
|
||||
@@ -188,10 +188,7 @@ def test_functions_should_have_params(Script):
|
||||
assert c.get_signatures()
|
||||
|
||||
|
||||
def test_hashlib_params(Script, environment):
|
||||
if environment.version_info < (3,):
|
||||
pytest.skip()
|
||||
|
||||
def test_hashlib_params(Script):
|
||||
script = Script('from hashlib import sha256')
|
||||
c, = script.complete()
|
||||
sig, = c.get_signatures()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from textwrap import dedent
|
||||
import sys
|
||||
import math
|
||||
from collections import Counter
|
||||
from datetime import datetime
|
||||
@@ -26,7 +27,10 @@ def test_builtin_loading(inference_state):
|
||||
assert not from_name.py__doc__() # It's a stub
|
||||
|
||||
|
||||
def test_next_docstr(inference_state):
|
||||
def test_next_docstr(inference_state, environment):
|
||||
if environment.version_info[:2] != sys.version_info[:2]:
|
||||
pytest.skip()
|
||||
|
||||
next_ = compiled.builtin_from_name(inference_state, 'next')
|
||||
assert next_.tree_node is not None
|
||||
assert next_.py__doc__() == '' # It's a stub
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import pytest
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def skip_not_supported(environment):
|
||||
if environment.version_info < (3, 6):
|
||||
pytest.skip()
|
||||
|
||||
|
||||
def test_fstring_multiline(Script):
|
||||
code = dedent("""\
|
||||
'' f'''s{
|
||||
|
||||
@@ -12,29 +12,23 @@ def _infer_literal(Script, code, is_fstring=False):
|
||||
return def_._name._value.get_safe_value()
|
||||
|
||||
|
||||
def test_f_strings(Script, environment):
|
||||
def test_f_strings(Script):
|
||||
"""
|
||||
f literals are not really supported in Jedi. They just get ignored and an
|
||||
empty string is returned.
|
||||
"""
|
||||
if environment.version_info < (3, 6):
|
||||
pytest.skip()
|
||||
|
||||
assert _infer_literal(Script, 'f"asdf"', is_fstring=True) == ''
|
||||
assert _infer_literal(Script, 'f"{asdf} "', is_fstring=True) == ''
|
||||
assert _infer_literal(Script, 'F"{asdf} "', is_fstring=True) == ''
|
||||
assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == ''
|
||||
|
||||
|
||||
def test_rb_strings(Script, environment):
|
||||
def test_rb_strings(Script):
|
||||
assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf'
|
||||
assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf'
|
||||
|
||||
|
||||
def test_thousand_separators(Script, environment):
|
||||
if environment.version_info < (3, 6):
|
||||
pytest.skip()
|
||||
|
||||
def test_thousand_separators(Script):
|
||||
assert _infer_literal(Script, '1_2_3') == 123
|
||||
assert _infer_literal(Script, '123_456_789') == 123456789
|
||||
assert _infer_literal(Script, '0x3_4') == 52
|
||||
|
||||
@@ -13,18 +13,15 @@ from ..helpers import get_example_dir
|
||||
'code, sig, names, op, version', [
|
||||
('import math; math.cos', 'cos(x, /)', ['x'], ge, (3, 6)),
|
||||
|
||||
('next', 'next(iterator, default=None, /)', ['iterator', 'default'], ge, (3, 6)),
|
||||
('next', 'next(iterator, default=None, /)', ['iterator', 'default'], lt, (3, 12)),
|
||||
('next', 'next()', [], ge, (3, 12)),
|
||||
|
||||
('str', "str(object='', /) -> str", ['object'], ge, (3, 6)),
|
||||
|
||||
('pow', 'pow(x, y, z=None, /) -> number', ['x', 'y', 'z'], lt, (3, 6)),
|
||||
('pow', 'pow(base, exp, mod=None)', ['base', 'exp', 'mod'], ge, (3, 8)),
|
||||
|
||||
('bytes.partition', 'partition(self, sep, /) -> (head, sep, tail)',
|
||||
['self', 'sep'], lt, (3, 6)),
|
||||
('bytes.partition', 'partition(self, sep, /)', ['self', 'sep'], ge, (3, 6)),
|
||||
|
||||
('bytes().partition', 'partition(sep, /) -> (head, sep, tail)', ['sep'], lt, (3, 6)),
|
||||
('bytes().partition', 'partition(sep, /)', ['sep'], ge, (3, 6)),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -81,10 +81,10 @@ class TestSetupReadline(unittest.TestCase):
|
||||
if all(not x.startswith('from os import ' + s)
|
||||
for s in ['_', 'O_', 'EX_', 'MFD_', 'SF_', 'ST_',
|
||||
'CLD_', 'POSIX_SPAWN_', 'P_', 'RWF_',
|
||||
'SCHED_'])
|
||||
'CLONE_', 'SCHED_'])
|
||||
}
|
||||
# There are quite a few differences, because both Windows and Linux
|
||||
# (posix and nt) librariesare included.
|
||||
# (posix and nt) libraries are included.
|
||||
assert len(difference) < 30
|
||||
|
||||
def test_local_import(self):
|
||||
|
||||
Reference in New Issue
Block a user