From 32c74fd2703770837e9e308c4daef532ec12ee05 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 15 May 2020 05:34:25 +0000 Subject: [PATCH 1/2] Bump flake8 from 3.7.9 to 3.8.1 Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.7.9 to 3.8.1. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.7.9...3.8.1) Signed-off-by: dependabot-preview[bot] --- requirements/flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/flake8.txt b/requirements/flake8.txt index 0caa162d..aed8cbc2 100644 --- a/requirements/flake8.txt +++ b/requirements/flake8.txt @@ -1,4 +1,4 @@ -flake8==3.7.9 +flake8==3.8.1 flake8-import-order==0.18.1 flake8-bugbear==20.1.4 flake8-commas==2.0.0 From 313f1f257fb13a8d2b0497d3d7238134affcf5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Tr=C4=99bski?= Date: Fri, 15 May 2020 21:24:37 +0200 Subject: [PATCH 2/2] fix flake errors --- .flake8 | 4 +++- axion/handler/analysis/return_type.py | 4 ++-- axion/oas/parser/type.py | 2 +- axion/utils/types.py | 2 +- tests/test_oas_mixed_type.py | 16 ++++++++-------- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.flake8 b/.flake8 index 659394c8..343e13a4 100644 --- a/.flake8 +++ b/.flake8 @@ -4,10 +4,13 @@ show-source = True select = E,F,W,C,I,B,S,T,Q,N400 ignore = S101,S608 +extend-ignore = F821,E721 per-file-ignores = tests/test_init_import.py:F401 tests/conftest.py:S311 axion/handler/__init__.py:F811 +builtins = + _, import-order-style=appnexus application-package-names=axion @@ -18,7 +21,6 @@ hang-closing = false max-line-length = 90 inline-quotes = single -disable-noqa = True exclude = .git, __pycache__, diff --git a/axion/handler/analysis/return_type.py b/axion/handler/analysis/return_type.py index 53dbcc93..47c9cabc 100644 --- a/axion/handler/analysis/return_type.py +++ b/axion/handler/analysis/return_type.py @@ -90,7 +90,7 @@ def _analyze_headers( elif not types.is_dict_like(headers): return { exceptions.Error( - param_name=f'return.headers', + param_name='return.headers', reason=exceptions.IncorrectTypeReason( expected=model.COOKIES_HEADERS_TYPE, actual=headers, @@ -115,7 +115,7 @@ def _analyze_cookies( elif not types.is_dict_like(cookies): return { exceptions.Error( - param_name=f'return.cookies', + param_name='return.cookies', reason=exceptions.IncorrectTypeReason( expected=model.COOKIES_HEADERS_TYPE, actual=cookies, diff --git a/axion/oas/parser/type.py b/axion/oas/parser/type.py index e7e3cb5c..abee5778 100644 --- a/axion/oas/parser/type.py +++ b/axion/oas/parser/type.py @@ -381,7 +381,7 @@ def _resolve_oas_string( if min_length is not None and max_length is not None: if min_length > max_length: raise exceptions.OASInvalidConstraints( - f'type=string cannot have max_length < min_length. ', + 'type=string cannot have max_length < min_length. ', f'min_length={min_length} ' f'max_length={max_length}.', ) diff --git a/axion/utils/types.py b/axion/utils/types.py index eaa60c4a..7b2df66d 100644 --- a/axion/utils/types.py +++ b/axion/utils/types.py @@ -43,7 +43,7 @@ def is_new_type(tt: t.Type[t.Any]) -> bool: @functools.lru_cache(maxsize=30, typed=True) def is_none_type(tt: t.Type[t.Any]) -> bool: - return tt is type(None) # noqa + return tt is type(None) @functools.lru_cache(maxsize=30, typed=True) diff --git a/tests/test_oas_mixed_type.py b/tests/test_oas_mixed_type.py index 0c754197..b6484933 100644 --- a/tests/test_oas_mixed_type.py +++ b/tests/test_oas_mixed_type.py @@ -768,17 +768,17 @@ def _do() -> t.Any: raise AssertionError('This should not happen') elif isinstance(ap_1, bool) and isinstance(ap_2, dict): assert ( - f'additionalProperties value differs between mixed schemas. ' - f'a=bool != b=dict. When using "anyOf,oneOf,allOf" values in ' - f'same location must be equal. ' - f'Either make it so or remove one of the duplicating properties.' + 'additionalProperties value differs between mixed schemas. ' + 'a=bool != b=dict. When using "anyOf,oneOf,allOf" values in ' + 'same location must be equal. ' + 'Either make it so or remove one of the duplicating properties.' ) == str(err.value) elif isinstance(ap_1, dict) and isinstance(ap_2, bool): assert ( - f'additionalProperties value differs between mixed schemas. ' - f'a=dict != b=bool. When using "anyOf,oneOf,allOf" values in ' - f'same location must be equal. ' - f'Either make it so or remove one of the duplicating properties.' + 'additionalProperties value differs between mixed schemas. ' + 'a=dict != b=bool. When using "anyOf,oneOf,allOf" values in ' + 'same location must be equal. ' + 'Either make it so or remove one of the duplicating properties.' ) == str(err.value) else: raise AssertionError('This should not happen')