Skip to content

Commit

Permalink
chore(ruff) Automated fixes for typing annotations
Browse files Browse the repository at this point in the history
Fixed 8 errors:
- src/django_docutils/lib/directives/code.py:
    1 × I001 (unsorted-imports)
    1 × UP006 (non-pep585-annotation)
- src/django_docutils/lib/utils.py:
    1 × I001 (unsorted-imports)
    1 × UP006 (non-pep585-annotation)
    1 × F401 (unused-import)
- tests/test_docutils_roles.py:
    2 × UP006 (non-pep585-annotation)
    1 × I001 (unsorted-imports)

Found 437 errors (8 fixed, 429 remaining).
55 files left unchanged

uv run ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; uv run ruff format .
  • Loading branch information
tony committed Jan 4, 2025
1 parent a13ec99 commit 11446bb
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/django_docutils/lib/directives/code.py
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@

import re
import typing as t
from collections.abc import Callable

from docutils import nodes
from docutils.parsers.rst import Directive, directives
@@ -75,7 +76,7 @@ def patch_bash_session_lexer() -> None:
# 'linenos': HtmlFormatter(noclasses=INLINESTYLES, linenos=True),
}

DEFAULT_OPTION_SPEC: dict[str, t.Callable[[str], t.Any]] = dict.fromkeys(
DEFAULT_OPTION_SPEC: dict[str, Callable[[str], t.Any]] = dict.fromkeys(
VARIANTS,
directives.flag,
)
4 changes: 2 additions & 2 deletions src/django_docutils/lib/utils.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
"""

import re
import typing as t
from collections.abc import Generator

from docutils import nodes

@@ -90,7 +90,7 @@ def chop_after_heading_smartly(source: str) -> str:
return chop_after_title(source)


def find_root_sections(document: nodes.document) -> t.Generator[nodes.Node, None, None]:
def find_root_sections(document: nodes.document) -> Generator[nodes.Node, None, None]:
"""Yield top level section nodes.
Parameters
5 changes: 3 additions & 2 deletions tests/test_docutils_roles.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
"""Tests for docutils roles."""

import typing as t
from collections.abc import Sequence

import pytest
from django.template import Context, Template
@@ -85,7 +86,7 @@ class SphinxLikeRole:
options: dict[str, t.Any]
#: A list of strings, the directive content for customisation
#: (from the "role" directive).
content: t.Sequence[str]
content: Sequence[str]

def __call__(
self,
@@ -95,7 +96,7 @@ def __call__(
lineno: int,
inliner: Inliner,
options: t.Optional[dict[str, t.Any]] = None,
content: t.Sequence[str] = (),
content: Sequence[str] = (),
) -> tuple[list[nodes.Node], list[t.Any]]:
"""Return example class-based role."""
self.rawtext = rawtext

0 comments on commit 11446bb

Please sign in to comment.