Commit 0ec03b4 1 parent 2ed5506 commit 0ec03b4 Copy full SHA for 0ec03b4
File tree 8 files changed +38
-46
lines changed
8 files changed +38
-46
lines changed Original file line number Diff line number Diff line change 7
7
additional_dependencies :
8
8
- tomli
9
9
exclude_types : [csv, json]
10
- - repo : https://github.com/asottile/pyupgrade
11
- rev : v3.15.0
12
- hooks :
13
- - id : pyupgrade
14
- args : [--py39-plus]
15
- - repo : https://github.com/pycqa/flake8
16
- rev : 6.1.0
17
- hooks :
18
- - id : flake8
19
- files : ^(xknxproject|examples|docs)/.+\.py$
20
10
- repo : https://github.com/charliermarsh/ruff-pre-commit
21
11
# Ruff version.
22
12
rev : ' v0.1.11'
Original file line number Diff line number Diff line change @@ -103,26 +103,42 @@ output-format = "colorized"
103
103
testpaths = " test"
104
104
105
105
[tool .ruff ]
106
- target-version = " py39"
107
- select = [
108
- " C4" , # comprehensions
109
- " D" , # pydocstyle
110
- " E" , # pycodestyle
111
- " F" , # pyflakes
112
- " I" , # isort
113
- " RUF" , # ruff specific
114
- " T20" , # print
115
- " UP" , # pyupgrade
116
- " W" , # pydocstyle warning
106
+ lint.select = [
107
+ " A" , # builtins shadowing
108
+ " ASYNC" , # async
109
+ " B" , # bugbear
110
+ " C4" , # comprehensions
111
+ " D" , # pydocstyle
112
+ " E" , # pycodestyle
113
+ " F" , # pyflakes
114
+ " G" , # logging
115
+ " I" , # isort
116
+ " LOG" , # logging
117
+ " PTH" , # pathlib
118
+ " RUF" , # ruff specific
119
+ " SLF" , # private member access
120
+ " SIM" , # simplify
121
+ " T20" , # print
122
+ " UP" , # pyupgrade
123
+ " W" , # pydocstyle warning
117
124
]
118
- ignore = [
125
+ lint. ignore = [
119
126
" D202" ,
120
127
" D203" ,
121
128
" D212" ,
122
- " E501" , # line too long
129
+ " E501" , # line too long
130
+ " SIM102" , # collapsible-if
131
+ " SIM105" , # suppressible-exception
123
132
]
124
133
extend-exclude = [" script" ]
125
134
126
- [tool .ruff .isort ]
135
+ [tool .ruff .lint . isort ]
127
136
force-sort-within-sections = true
128
137
combine-as-imports = true
138
+
139
+ [tool .ruff .lint .per-file-ignores ]
140
+ "test/*" = [
141
+ " RUF012" , # Mutable class attributes should be annotated with `typing.ClassVar`
142
+ " SLF" , # private member access
143
+ " SIM117" , # multiple-with-statements
144
+ ]
Original file line number Diff line number Diff line change 1
1
-r requirements_production.txt
2
2
pre-commit==3.6.0
3
- flake8==7.0.0
4
3
pylint==3.0.3
5
4
pytest==8.0.0
6
5
pytest-cov==4.1.0
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ def remove_xknxproject_version(obj: KNXProject) -> KNXProject:
15
15
assert len (version_string .split ("." )) == 3
16
16
return obj
17
17
18
- with open (stub_path , encoding = "utf-8" ) as stub_file :
18
+ with stub_path . open (encoding = "utf-8" ) as stub_file :
19
19
stub = remove_xknxproject_version (json .load (stub_file ))
20
20
to_be_verified = remove_xknxproject_version (to_be_verified )
21
21
for key , value in stub .items ():
22
22
assert key in to_be_verified , f"`{ key } ` key missing in generated object"
23
23
assert value == to_be_verified [key ], f"`{ key } ` item does not match"
24
24
25
- for key in to_be_verified . keys () :
25
+ for key in to_be_verified :
26
26
assert key in stub , f"`{ key } ` key of generated object missing in stub"
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ wheel_build_env = .pkg
22
22
basepython = python3
23
23
commands =
24
24
pre-commit run codespell {posargs: --all-files}
25
- pre-commit run flake8 {posargs: --all-files}
26
- pre-commit run pyupgrade {posargs: --all-files}
27
25
pre-commit run check-json {posargs: --all-files}
28
26
pre-commit run trailing-whitespace {posargs: --all-files}
29
27
Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ def parse_dpt_types(dpt_string: str | None) -> list[DPTType]:
30
30
for _dpt in dict .fromkeys (dpt_string .split ()):
31
31
dpt_parts = _dpt .split ("-" )
32
32
try :
33
- if MAIN_DPT == dpt_parts [0 ]:
33
+ if dpt_parts [0 ] == MAIN_DPT :
34
34
supported_dpts .append (
35
35
DPTType (
36
36
main = int (dpt_parts [1 ]),
37
37
sub = None ,
38
38
)
39
39
)
40
- if MAIN_AND_SUB_DPT == dpt_parts [0 ]:
40
+ if dpt_parts [0 ] == MAIN_AND_SUB_DPT :
41
41
supported_dpts .append (
42
42
DPTType (
43
43
main = int (dpt_parts [1 ]),
Original file line number Diff line number Diff line change @@ -152,7 +152,9 @@ def _get_xml_namespace(project_zip: ZipFile) -> str:
152
152
namespace = namespace_match .group (1 ) # type: ignore[union-attr]
153
153
except (AttributeError , IndexError , UnicodeDecodeError ):
154
154
_LOGGER .error ("Could not parse XML namespace from %s" , line )
155
- raise UnexpectedFileContent ("Could not parse XML namespace." )
155
+ raise UnexpectedFileContent (
156
+ "Could not parse XML namespace."
157
+ ) from None
156
158
157
159
_LOGGER .debug ("Namespace: %s" , namespace )
158
160
return namespace
@@ -164,7 +166,7 @@ def _get_schema_version(namespace: str) -> int:
164
166
schema_version = int (namespace .split ("/" )[- 1 ])
165
167
except ValueError :
166
168
_LOGGER .error ("Could not parse schema version from %s" , namespace )
167
- raise UnexpectedFileContent ("Could not parse schema version." )
169
+ raise UnexpectedFileContent ("Could not parse schema version." ) from None
168
170
169
171
_LOGGER .debug ("Schema version: %s" , schema_version )
170
172
return schema_version
You can’t perform that action at this time.
0 commit comments