Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit 0b13eb4

Browse files
committed
chore: Clean up flake8 settings
1 parent 518ab98 commit 0b13eb4

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

openapi_tester/utils.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
""" Utils Module - this file contains utility functions used in multiple places """
1+
"""
2+
Utils Module - this file contains utility functions used in multiple places.
3+
"""
24
from __future__ import annotations
35

46
from copy import deepcopy
@@ -10,7 +12,9 @@
1012

1113

1214
def merge_objects(dictionaries: Sequence[dict[str, Any]]) -> dict[str, Any]:
13-
"""helper function to deep merge objects"""
15+
"""
16+
Deeply merge objects.
17+
"""
1418
output: dict[str, Any] = {}
1519
for dictionary in dictionaries:
1620
for key, value in dictionary.items():
@@ -27,8 +31,10 @@ def merge_objects(dictionaries: Sequence[dict[str, Any]]) -> dict[str, Any]:
2731
return output
2832

2933

30-
def normalize_schema_section(schema_section: dict) -> dict:
31-
"""helper method to remove allOf and handle edge uses of oneOf"""
34+
def normalize_schema_section(schema_section: dict[str, Any]) -> dict[str, Any]:
35+
"""
36+
Remove allOf and handle edge uses of oneOf.
37+
"""
3238
output: dict[str, Any] = deepcopy(schema_section)
3339
if output.get("allOf"):
3440
all_of = output.pop("allOf")
@@ -46,7 +52,9 @@ def normalize_schema_section(schema_section: dict) -> dict:
4652

4753

4854
def lazy_combinations(options_list: Sequence[dict[str, Any]]) -> Iterator[dict]:
49-
"""helper to lazy evaluate possible permutations of possible combinations"""
55+
"""
56+
Lazily evaluate possible combinations.
57+
"""
5058
for i in range(2, len(options_list) + 1):
5159
for combination in combinations(options_list, i):
5260
yield merge_objects(combination)

setup.cfg

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
11
[flake8]
22
ignore=
3-
# E501: Line length
4-
E501
53
# Docstring at the top of a public module
64
D100
75
# Docstring at the top of a public class (method is enough)
86
D101
97
# Make docstrings one line if it can fit.
108
D200
119
D210
12-
# Imperative docstring declarations
13-
D401
14-
# Type annotation for `self`
15-
TYP101
16-
TYP102 # for cls
17-
ANN101
1810
# Missing docstring in __init__
1911
D107
2012
# Missing docstring in public package
2113
D104
22-
# Missing type annotations for `**kwargs`
23-
TYP003
2414
# Whitespace before ':'. Black formats code this way.
2515
E203
2616
# 1 blank line required between summary line and description
2717
D205
28-
# First line should end with a period - here we have a few cases where the first line is too long, and
29-
# this issue can't be fixed without using noqa notation
30-
D400
3118
# Line break before binary operator. W504 will be hit when this is excluded.
3219
W503
33-
# Missing type annotation for *args
34-
TYP002
35-
ANN002
36-
# Missing type annotation for **kwargs
37-
ANN003
38-
# f-string missing prefix (too many false positives)
39-
FS003
40-
# Handle error-cases first
20+
# Handle error cases first
4121
SIM106
4222
enable-extensions =
4323
enable-extensions = TC, TC1
@@ -49,6 +29,11 @@ exclude =
4929
manage.py,
5030
.venv
5131
max-complexity = 16
32+
max-line-length = 120
33+
per-file-ignores =
34+
openapi_tester/constants.py:FS003
35+
tests/*:FS003
36+
test_project/*:FS003
5237

5338
[mypy]
5439
python_version = 3.10

tests/test_schema_tester.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ def test_validate_response_failure_scenario_undocumented_content(client, monkeyp
201201
response = client.get(de_parameterized_path)
202202
with pytest.raises(
203203
UndocumentedSchemaSectionError,
204-
match=f"Error: Unsuccessfully tried to index the OpenAPI schema by `content`. \n\nNo `content` defined for this response: {method}, path: {parameterized_path}",
204+
match=f"Error: Unsuccessfully tried to index the OpenAPI schema by `content`. \n\n"
205+
f"No `content` defined for this response: {method}, path: {parameterized_path}",
205206
):
206207
tester.validate_response(response)
207208

0 commit comments

Comments
 (0)