Skip to content

Commit 17bfa0f

Browse files
committed
Increase type hint coverage
1 parent 0940221 commit 17bfa0f

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

flake8_encodings/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class Visitor(flake8_helper.Visitor):
107107
The functionality for checking classes has moved to the :class:`~.ClassVisitor` subclass.
108108
"""
109109

110-
def check_open_encoding(self, node: ast.Call):
110+
def check_open_encoding(self, node: ast.Call) -> None:
111111
"""
112112
Check the call represented by the given AST node is using encodings correctly.
113113
@@ -141,7 +141,7 @@ def check_open_encoding(self, node: ast.Call):
141141

142142
check_encoding = check_open_encoding # deprecated
143143

144-
def visit_Call(self, node: ast.Call): # noqa: D102
144+
def visit_Call(self, node: ast.Call) -> None: # noqa: D102
145145

146146
if isinstance(node.func, ast.Name):
147147

@@ -195,7 +195,7 @@ def __init__(self):
195195
self.filename = PathPlus("<unknown>")
196196
self.jedi_script = jedi.Script('')
197197

198-
def first_visit(self, node: ast.AST, filename: PathPlus):
198+
def first_visit(self, node: ast.AST, filename: PathPlus) -> None:
199199
"""
200200
Like :meth:`ast.NodeVisitor.visit`, but configures type inference.
201201
@@ -212,7 +212,7 @@ def first_visit(self, node: ast.AST, filename: PathPlus):
212212
self.jedi_script = jedi.Script(self.filename.read_text(), path=self.filename)
213213
self.visit(node)
214214

215-
def check_configparser_encoding(self, node: ast.Call):
215+
def check_configparser_encoding(self, node: ast.Call) -> None:
216216
"""
217217
Check the call represented by the given AST node is using encodings correctly.
218218
@@ -230,7 +230,7 @@ def check_configparser_encoding(self, node: ast.Call):
230230
if kwargs["encoding"].value is None:
231231
self.report_error(node, ENC012)
232232

233-
def check_pathlib_encoding(self, node: ast.Call, method_name: str):
233+
def check_pathlib_encoding(self, node: ast.Call, method_name: str) -> None:
234234
"""
235235
Check the call represented by the given AST node is using encodings correctly.
236236
@@ -279,7 +279,7 @@ def check_pathlib_encoding(self, node: ast.Call, method_name: str):
279279
if kwargs["encoding"].value is None:
280280
self.report_error(node, encoding_none)
281281

282-
def visit_Call(self, node: ast.Call): # noqa: D102
282+
def visit_Call(self, node: ast.Call) -> None: # noqa: D102
283283

284284
if isinstance(node.func, ast.Name):
285285

tests/test_plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
pytest.param(False, id="no_jedi", marks=pytest.mark.skipif(has_jedi, reason=skip_reason)),
2828
]
2929
)
30-
def test_plugin(tmp_pathplus: PathPlus, advanced_data_regression: AdvancedDataRegressionFixture, has_jedi):
30+
def test_plugin(
31+
tmp_pathplus: PathPlus,
32+
advanced_data_regression: AdvancedDataRegressionFixture,
33+
has_jedi: bool,
34+
):
3135
(tmp_pathplus / "code.py").write_text(example_source)
3236

3337
plugin = Plugin(ast.parse(example_source), filename=str(tmp_pathplus / "code.py"))

0 commit comments

Comments
 (0)