@@ -14,8 +14,6 @@ classifiers = [
1414 " Intended Audience :: Developers" ,
1515 " License :: OSI Approved :: MIT License" ,
1616 " Operating System :: OS Independent" ,
17- " Programming Language :: Python :: 3.10" ,
18- " Programming Language :: Python :: 3.11" ,
1917 " Programming Language :: Python :: 3.12" ,
2018 " Topic :: Home Automation" ,
2119]
@@ -26,7 +24,7 @@ maintainers = [
2624 { name = " bouwew" },
2725 { name = " CoMPaTech" }
2826]
29- requires-python = " >=3.10 .0"
27+ requires-python = " >=3.12 .0"
3028dependencies = [
3129 " aiohttp" ,
3230 " async_timeout" ,
@@ -53,7 +51,7 @@ include-package-data = true
5351include = [" plugwise*" ]
5452
5553[tool .black ]
56- target-version = [" py310 " , " py311 " , " py312" ]
54+ target-version = [" py312" ]
5755exclude = ' generated'
5856
5957[tool .isort ]
@@ -189,7 +187,7 @@ norecursedirs = [
189187]
190188
191189[tool .mypy ]
192- python_version = " 3.11 "
190+ python_version = " 3.12 "
193191show_error_codes = true
194192follow_imports = " silent"
195193ignore_missing_imports = true
@@ -219,28 +217,70 @@ omit= [
219217]
220218
221219[tool .ruff ]
222- target-version = " py311 "
220+ target-version = " py312 "
223221
224222select = [
223+ " B002" , # Python does not support the unary prefix increment
225224 " B007" , # Loop control variable {name} not used within loop body
226225 " B014" , # Exception handler with duplicate exception
226+ " B023" , # Function definition does not bind loop variable {name}
227+ " B026" , # Star-arg unpacking after a keyword argument is strongly discouraged
227228 " C" , # complexity
229+ " COM818" , # Trailing comma on bare tuple prohibited
228230 " D" , # docstrings
231+ " DTZ003" , # Use datetime.now(tz=) instead of datetime.utcnow()
232+ " DTZ004" , # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts)
229233 " E" , # pycodestyle
230234 " F" , # pyflakes/autoflake
235+ " G" , # flake8-logging-format
236+ " I" , # isort
231237 " ICN001" , # import concentions; {name} should be imported as {asname}
232- " PGH004" , # Use specific rule codes when using noqa
238+ " ISC001" , # Implicitly concatenated string literals on one line
239+ " N804" , # First argument of a class method should be named cls
240+ " N805" , # First argument of a method should be named self
241+ " N815" , # Variable {name} in class scope should not be mixedCase
242+ " PGH001" , # No builtin eval() allowed
243+ " PGH004" , # Use specific rule codes when using noqa
244+ " PL" , # https://github.com/astral-sh/ruff/issues/7491#issuecomment-1730008111
233245 " PLC0414" , # Useless import alias. Import alias does not rename original package.
246+ " PLC" , # pylint
247+ " PLE" , # pylint
248+ " PLR" , # pylint
249+ " PLW" , # pylint
250+ " Q000" , # Double quotes found but single quotes preferred
251+ " RUF006" , # Store a reference to the return value of asyncio.create_task
252+ " S102" , # Use of exec detected
253+ " S103" , # bad-file-permissions
254+ " S108" , # hardcoded-temp-file
255+ " S306" , # suspicious-mktemp-usage
256+ " S307" , # suspicious-eval-usage
257+ " S313" , # suspicious-xmlc-element-tree-usage
258+ " S314" , # suspicious-xml-element-tree-usage
259+ " S315" , # suspicious-xml-expat-reader-usage
260+ " S316" , # suspicious-xml-expat-builder-usage
261+ " S317" , # suspicious-xml-sax-usage
262+ " S318" , # suspicious-xml-mini-dom-usage
263+ " S319" , # suspicious-xml-pull-dom-usage
264+ " S320" , # suspicious-xmle-tree-usage
265+ " S601" , # paramiko-call
266+ " S602" , # subprocess-popen-with-shell-equals-true
267+ " S604" , # call-with-shell-equals-true
268+ " S608" , # hardcoded-sql-expression
269+ " S609" , # unix-command-wildcard-injection
234270 " SIM105" , # Use contextlib.suppress({exception}) instead of try-except-pass
235271 " SIM117" , # Merge with-statements that use the same scope
236272 " SIM118" , # Use {key} in {dict} instead of {key} in {dict}.keys()
237273 " SIM201" , # Use {left} != {right} instead of not {left} == {right}
274+ " SIM208" , # Use {expr} instead of not (not {expr})
238275 " SIM212" , # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
239276 " SIM300" , # Yoda conditions. Use 'age == 42' instead of '42 == age'.
240277 " SIM401" , # Use get from dict with default instead of an if block
278+ " T100" , # Trace found: {name} used
241279 " T20" , # flake8-print
280+ " TID251" , # Banned imports
242281 " TRY004" , # Prefer TypeError exception for invalid type
243- " RUF006" , # Store a reference to the return value of asyncio.create_task
282+ " TRY200" , # Use raise from to specify exception cause
283+ " TRY302" , # Remove exception handler; error is immediately re-raised
244284 " UP" , # pyupgrade
245285 " W" , # pycodestyle
246286]
@@ -253,9 +293,19 @@ ignore = [
253293 " D407" , # Section name underlining
254294 " E501" , # line too long
255295 " E731" , # do not assign a lambda expression, use a def
296+ # False positives https://github.com/astral-sh/ruff/issues/5386
297+ " PLC0208" , # Use a sequence type instead of a `set` when iterating over values
298+ " PLR0911" , # Too many return statements ({returns} > {max_returns})
299+ " PLR0912" , # Too many branches ({branches} > {max_branches})
300+ " PLR0913" , # Too many arguments to function call ({c_args} > {max_args})
301+ " PLR0915" , # Too many statements ({statements} > {max_statements})
302+ " PLR2004" , # Magic value used in comparison, consider replacing {value} with a constant variable
303+ " PLW2901" , # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
304+ " UP006" , # keep type annotation style as is
305+ " UP007" , # keep type annotation style as is
306+ # Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
307+ # "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
256308]
257- # # Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923
258- # "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
259309
260310exclude = []
261311
@@ -272,3 +322,23 @@ fixture-parentheses = false
272322
273323[tool .ruff .mccabe ]
274324max-complexity = 25
325+
326+ [tool .ruff .flake8-tidy-imports .banned-api ]
327+ "pytz".msg = " use zoneinfo instead"
328+
329+ [tool .ruff .isort ]
330+ force-sort-within-sections = true
331+ section-order = [" future" , " standard-library" , " first-party" , " third-party" , " local-folder" ]
332+ known-third-party = [
333+ " tests" ,
334+ ]
335+ known-first-party = [
336+ " plugwise" ,
337+ " voluptuous" ,
338+ " pytest" ,
339+ ]
340+ forced-separate = [
341+ " tests" ,
342+ ]
343+ combine-as-imports = true
344+ split-on-trailing-comma = false
0 commit comments