Skip to content

Commit

Permalink
lint: Enable flake8-annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
  • Loading branch information
jku committed Apr 22, 2024
1 parent 0375eb3 commit 3a8af59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Expand Up @@ -83,6 +83,7 @@ line-length=80
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
Expand All @@ -107,6 +108,7 @@ select = [
"W", # pycodestyle-warning
]
ignore = [
"ANN101", "ANN102", # nonsense, deprecated in ruff
"D400", "D415", "D213", "D205", "D202", "D107", "D407", "D413", "D212", "D104", "D406", "D105", "D411", "D401", "D200", "D203",
"PLR0913", "PLR2004",
"ISC001", # incompatible with ruff formatter
Expand All @@ -127,6 +129,9 @@ ignore = [
"S603", # bandit: this flags all uses of subprocess.run as vulnerable
]

[tool.ruff.lint.flake8-annotations]
mypy-init-return = true

# mypy section
# Read more here: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
[tool.mypy]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_fetcher_ng.py
Expand Up @@ -105,7 +105,7 @@ def test_http_error(self) -> None:

# Response read timeout error
@patch.object(requests.Session, "get")
def test_response_read_timeout(self, mock_session_get: Any) -> None:
def test_response_read_timeout(self, mock_session_get: Mock) -> None:
mock_response = Mock()
attr = {
"iter_content.side_effect": requests.exceptions.ConnectionError(
Expand All @@ -125,7 +125,7 @@ def test_response_read_timeout(self, mock_session_get: Any) -> None:
"get",
side_effect=requests.exceptions.Timeout("Simulated timeout"),
)
def test_session_get_timeout(self, mock_session_get: Any) -> None:
def test_session_get_timeout(self, mock_session_get: Mock) -> None:
with self.assertRaises(exceptions.SlowRetrievalError):
self.fetcher.fetch(self.url)
mock_session_get.assert_called_once()
Expand Down
2 changes: 1 addition & 1 deletion tuf/api/_payload.py
Expand Up @@ -1491,7 +1491,7 @@ def __init__(
self.unrecognized_fields = unrecognized_fields

@property
def custom(self) -> Any:
def custom(self) -> Any: # noqa: ANN401
"""Get implementation specific data related to the target.
python-tuf does not use or validate this data.
Expand Down

0 comments on commit 3a8af59

Please sign in to comment.