-
Notifications
You must be signed in to change notification settings - Fork 129
/
pyproject.toml
177 lines (161 loc) · 4.61 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
[tool.black]
target-version = ["py310", "py311"]
[tool.isort]
# https://github.com/PyCQA/isort/wiki/isort-Settings
profile = "black"
# will group `import x` and `from x import` of the same module.
combine_as_imports = true
force_sort_within_sections = true
forced_separate = [
"tests",
]
known_first_party = [
"pytradfri",
"tests",
]
[tool.pylint.MAIN]
ignore = []
py-version = "3.10"
# Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate.
extension-pkg-allow-list = "pydantic"
init-hook = 'from pylint.config.find_default_config_files import find_default_config_files; from pathlib import Path; import sys; sys.path.append(str(Path(Path(list(find_default_config_files())[0]).parent, "pylint/plugins")))'
jobs = 2
load-plugins = [
"pylint.extensions.code_style",
"pylint.extensions.typing",
"pylint_strict_informational",
]
persistent = false
score = false
[tool.pylint.BASIC]
class-const-naming-style = "any"
good-names = [
"_",
"i",
"id",
"j",
"k",
"Run",
"T",
]
[tool.pylint.DESIGN]
max-args = 9
[tool.pylint."MESSAGES CONTROL"]
disable = [
"format",
# When Python 3.10 is the minimum version
# (or pydantic is updated to support the new union syntax with Python 3.9)
# we can remove this disable and change to the new syntax.
"consider-alternative-union-syntax",
"duplicate-code",
"locally-disabled",
"too-few-public-methods",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-public-methods",
"too-many-statements",
"too-many-boolean-expressions",
"unused-argument",
"wrong-import-order",
]
enable = [
"useless-suppression",
"use-symbolic-message-instead",
]
[tool.pylint.FORMAT]
expected-line-ending-format = "LF"
[tool.pylint.EXCEPTIONS]
overgeneral-exceptions = [
"builtins.BaseException",
"builtins.Exception",
]
[tool.pylint.TYPING]
runtime-typing = false
[tool.pylint.CODE_STYLE]
max-line-length-suggestions = 72
[tool.pytest.ini_options]
asyncio_mode = "auto"
norecursedirs = [
".git",
"testing_config",
]
testpaths = [
"tests",
]
[tool.mypy]
python_version = "3.10"
show_error_codes = true
follow_imports = "silent"
ignore_missing_imports = true
strict_equality = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
plugins = "pydantic.mypy"
strict = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[tool.ruff]
target-version = "py310"
select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
"C", # complexity
"D", # docstrings
"E", # pycodestyle
"F", # pyflakes/autoflake
"I", # isort
"ICN001", # import concentions; {name} should be imported as {asname}
"PGH004", # Use specific rule codes when using noqa
"PLC0414", # Useless import alias. Import alias does not rename original package.
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
"SIM401", # Use get from dict with default instead of an if block
"TRY004", # Prefer TypeError exception for invalid type
"UP", # pyupgrade
"W", # pycodestyle
]
ignore = [
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
]
[tool.ruff.isort]
# will group `import x` and `from x import` of the same module.
combine-as-imports = true
force-sort-within-sections = true
forced-separate = [
"tests",
]
known-first-party = [
"pytradfri",
"tests",
]
[tool.ruff.per-file-ignores]
# E402 Module level import not at top of file
# C901 too complex
"examples/debug_info.py" = ["E402"]
"examples/example_air_purifier_async.py" = ["E402"]
"examples/example_async.py" = ["E402", "C901"]
"examples/example_cover_async.py" = ["E402"]
"examples/example_pair.py" = ["E402", "C901"]
"examples/example_socket_async.py" = ["E402"]
"examples/example_sync.py" = ["E402", "C901"]
"pytradfri/api/libcoap_api.py" = ["C901"]