diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..5374960a --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.travis.yml b/.travis.yml index d7c418a4..89102f4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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] diff --git a/jedi/inference/base_value.py b/jedi/inference/base_value.py index c0f960d4..c5b2cec0 100644 --- a/jedi/inference/base_value.py +++ b/jedi/inference/base_value.py @@ -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) diff --git a/jedi/inference/gradual/annotation.py b/jedi/inference/gradual/annotation.py index fa3aa5ae..eadcfc2e 100644 --- a/jedi/inference/gradual/annotation.py +++ b/jedi/inference/gradual/annotation.py @@ -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 diff --git a/jedi/settings.py b/jedi/settings.py index 8e6b7bef..c31a474a 100644 --- a/jedi/settings.py +++ b/jedi/settings.py @@ -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: diff --git a/setup.cfg b/setup.cfg index 39633dc1..6929ce30 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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] diff --git a/setup.py b/setup.py index 044d7d5a..bf9be8c2 100755 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/test/test_api/test_call_signatures.py b/test/test_api/test_call_signatures.py index 59e3a640..664eec86 100644 --- a/test/test_api/test_call_signatures.py +++ b/test/test_api/test_call_signatures.py @@ -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)