Merge branch 'master' of github.com:davidhalter/jedi

This commit is contained in:
Dave Halter
2020-07-23 01:33:06 +02:00
8 changed files with 31 additions and 13 deletions

14
.editorconfig Normal file
View File

@@ -0,0 +1,14 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.py]
indent_size = 4
[*.md]
indent_size = 2

View File

@@ -15,7 +15,7 @@ env:
matrix:
include:
- python: 3.8
script:
script:
- 'pip install coverage'
- 'coverage run --source jedi -m pytest'
- 'coverage report'
@@ -31,7 +31,7 @@ matrix:
- 'pip install .[qa]'
script:
# Ignore F401, which are unused imports. flake8 is a primitive tool and is sometimes wrong.
- 'flake8 --extend-ignore F401 {posargs:jedi}'
- 'flake8 --extend-ignore F401 jedi setup.py'
install:
- sudo apt-get -y install python3-venv
- pip install .[testing]

View File

@@ -111,7 +111,7 @@ class HelperValueMixin(object):
.py__getattribute__('__anext__').execute_with_values()
.py__getattribute__('__await__').execute_with_values()
.py__stop_iteration_returns()
) # noqa
) # noqa: E124
])
return self.py__iter__(contextualized_node)

View File

@@ -53,8 +53,10 @@ def _infer_annotation_string(context, string, index=None):
value_set = context.infer_node(node)
if index is not None:
value_set = value_set.filter(
lambda value: value.array_type == 'tuple' # noqa
and len(list(value.py__iter__())) >= index
lambda value: (
value.array_type == 'tuple'
and len(list(value.py__iter__())) >= index
)
).py__simple_getitem__(index)
return value_set

View File

@@ -69,8 +69,11 @@ Adds an opening bracket after a function for completions.
# ----------------
if platform.system().lower() == 'windows':
_cache_directory = os.path.join(os.getenv('LOCALAPPDATA') or
os.path.expanduser('~'), 'Jedi', 'Jedi')
_cache_directory = os.path.join(
os.getenv('LOCALAPPDATA') or os.path.expanduser('~'),
'Jedi',
'Jedi',
)
elif platform.system().lower() == 'darwin':
_cache_directory = os.path.join('~', 'Library', 'Caches', 'Jedi')
else:

View File

@@ -13,6 +13,8 @@ ignore =
E721,
# Line break before binary operator
W503,
# Single letter loop variables are often fine
E741,
exclude = jedi/third_party/* .tox/*
[pycodestyle]

View File

@@ -45,7 +45,7 @@ setup(name='jedi',
'Django<3.1', # For now pin this.
],
'qa': [
'flake8==3.7.9',
'flake8==3.8.3',
],
},
package_data={'jedi': ['*.pyi', 'third_party/typeshed/LICENSE',

View File

@@ -121,11 +121,8 @@ def test_multiple_signatures(Script):
def test_get_signatures_whitespace(Script):
s = dedent("""\
abs(
def x():
pass
""") # noqa
# note: trailing space after 'abs'
s = 'abs( \ndef x():\n pass\n'
assert_signature(Script, s, 'abs', 0, line=1, column=5)