Skip to content

Commit

Permalink
ruff: enforce lazy evaluation of annotations
Browse files Browse the repository at this point in the history
All the annotations here were added via `ruff check --fix .`.
  • Loading branch information
WhyNotHugo committed Sep 27, 2023
1 parent a487c48 commit 7ca21b6
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@
]
line-length = 99

[tool.ruff.isort]
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
"tests/**/*.py" = ["ANN"] # TODO: tests are missing type annotations
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
https://github.com/sphinx-doc/sphinx/issues/7008), so this setup was created using the given code
snippets and the existing test cases for the autodoc extension.
"""
from __future__ import annotations

from unittest.mock import Mock

import pytest
Expand Down
2 changes: 2 additions & 0 deletions tests/roots/test-docstrings/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import sys

Expand Down
3 changes: 3 additions & 0 deletions tests/roots/test-docstrings/conflicting_sphinx_extension.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations


def setup(app):
"""
Sphinx extension which also registers a "setting" directive
Expand Down
1 change: 1 addition & 0 deletions tests/roots/test-docstrings/dummy_django_app/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Dummy Django settings file
"""
from __future__ import annotations

SECRET_KEY = "dummy-key"

Expand Down
2 changes: 2 additions & 0 deletions tests/test_attribute_docstrings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest

try:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_autodoc_skip.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down
2 changes: 2 additions & 0 deletions tests/test_class_docstrings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down
2 changes: 2 additions & 0 deletions tests/test_data_docstrings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down
2 changes: 2 additions & 0 deletions tests/test_django_configured.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down
2 changes: 2 additions & 0 deletions tests/test_django_setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest
from sphinx.errors import ConfigError

Expand Down
2 changes: 2 additions & 0 deletions tests/test_method_docstrings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down
2 changes: 2 additions & 0 deletions tests/test_roles.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest


Expand Down

0 comments on commit 7ca21b6

Please sign in to comment.