diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/__init__.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/__init__.py
index 1c58accb4166..19bf705795a9 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/__init__.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/__init__.py
@@ -1,13 +1,10 @@
import argparse
-import os
import sys
import textwrap
import traceback
from io import StringIO
from pprint import pprint
-from typing import Any, Dict
-from .md import Converter
from . import manual
from . import options
from . import parallel
@@ -26,7 +23,7 @@ def pretty_print_exc(e: BaseException, *, _desc_text: str = "error") -> None:
for arg in args:
pprint(arg, stream=buf)
if extra_info := buf.getvalue():
- print(f"\x1b[1;34mextra info:\x1b[0m", file=sys.stderr)
+ print("\x1b[1;34mextra info:\x1b[0m", file=sys.stderr)
print(textwrap.indent(extra_info, "\t"), file=sys.stderr, end="")
else:
print(e)
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/asciidoc.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/asciidoc.py
index 7fc14c1631ef..0c2531209876 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/asciidoc.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/asciidoc.py
@@ -1,6 +1,6 @@
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
-from typing import Any, cast, Optional
+from typing import cast
from urllib.parse import quote
from .md import Renderer
@@ -104,7 +104,7 @@ class AsciiDocRenderer(Renderer):
def hardbreak(self, token: Token, tokens: Sequence[Token], i: int) -> str:
return " +\n"
def softbreak(self, token: Token, tokens: Sequence[Token], i: int) -> str:
- return f" "
+ return " "
def code_inline(self, token: Token, tokens: Sequence[Token], i: int) -> str:
self._parstack[-1].continuing = True
return f"``{asciidoc_escape(token.content)}``"
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/commonmark.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/commonmark.py
index 9649eb653d44..440cf35f0d38 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/commonmark.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/commonmark.py
@@ -1,6 +1,6 @@
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
-from typing import Any, cast, Optional
+from typing import cast, Optional
from .md import md_escape, md_make_code, Renderer
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/docbook.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/docbook.py
index 1c1e95a29ef2..d54392cca553 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/docbook.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/docbook.py
@@ -1,7 +1,6 @@
from collections.abc import Mapping, Sequence
-from typing import Any, cast, Optional, NamedTuple
+from typing import cast, Optional, NamedTuple
-import markdown_it
from markdown_it.token import Token
from xml.sax.saxutils import escape, quoteattr
@@ -197,7 +196,7 @@ class DocBookRenderer(Renderer):
spacing = ' spacing="compact"' if token.meta.get('compact', False) else ''
return f""
def ordered_list_close(self, token: Token, tokens: Sequence[Token], i: int) -> str:
- return f""
+ return ""
def heading_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
hlevel = int(token.tag[1:])
result = self._close_headings(hlevel)
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/html.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/html.py
index ed9cd5485546..d25253d1a2f9 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/html.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/html.py
@@ -211,7 +211,7 @@ class HTMLRenderer(Renderer):
self._ordered_list_nesting += 1
return f'
"
def example_open(self, token: Token, tokens: Sequence[Token], i: int) -> str:
if id := cast(str, token.attrs.get('id', '')):
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manpage.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manpage.py
index a01aa1b4634b..024ec8d134dd 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manpage.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manpage.py
@@ -1,10 +1,9 @@
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
-from typing import Any, cast, Iterable, Optional
+from typing import cast, Iterable, Optional
import re
-import markdown_it
from markdown_it.token import Token
from .md import Renderer
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manual.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manual.py
index 1963989d5365..bfd69ec05cb8 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manual.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/manual.py
@@ -7,9 +7,8 @@ import xml.sax.saxutils as xml
from abc import abstractmethod
from collections.abc import Mapping, Sequence
from pathlib import Path
-from typing import Any, cast, ClassVar, Generic, get_args, NamedTuple, Optional, Union
+from typing import Any, cast, ClassVar, Generic, get_args, NamedTuple
-import markdown_it
from markdown_it.token import Token
from . import md, options
@@ -17,7 +16,6 @@ from .docbook import DocBookRenderer, Heading, make_xml_id
from .html import HTMLRenderer, UnresolvedXrefError
from .manual_structure import check_structure, FragmentType, is_include, TocEntry, TocEntryType, XrefTarget
from .md import Converter, Renderer
-from .utils import Freezeable
class BaseConverter(Converter[md.TR], Generic[md.TR]):
# per-converter configuration for ns:arg=value arguments to include blocks, following
@@ -519,7 +517,7 @@ class HTMLConverter(BaseConverter[ManualHTMLRenderer]):
# we use blender-style //path to denote paths relative to the origin file
# (usually index.html). this makes everything a lot easier and clearer.
if not into.startswith("//") or '/' in into[2:]:
- raise RuntimeError(f"html:into-file must be a relative-to-origin //filename", into)
+ raise RuntimeError("html:into-file must be a relative-to-origin //filename", into)
into = token.meta['include-args']['into-file'] = into[2:]
if into in self._redirection_targets:
raise RuntimeError(f"redirection target {into} in line {token.map[0] + 1} is already in use")
@@ -617,7 +615,7 @@ class HTMLConverter(BaseConverter[ManualHTMLRenderer]):
for item in xref_queue:
try:
target = item if isinstance(item, XrefTarget) else self._render_xref(*item)
- except UnresolvedXrefError as e:
+ except UnresolvedXrefError:
if failed:
raise
deferred.append(item)
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/md.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/md.py
index ce79b0dee794..78e05642552b 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/md.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/md.py
@@ -1,6 +1,6 @@
from abc import ABC
from collections.abc import Mapping, MutableMapping, Sequence
-from typing import Any, Callable, cast, Generic, get_args, Iterable, Literal, NoReturn, Optional, TypeVar
+from typing import Any, cast, Generic, get_args, Iterable, Literal, NoReturn, Optional, TypeVar
import dataclasses
import re
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/options.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/options.py
index 06e5f9711216..7637241322f2 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/options.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/options.py
@@ -11,7 +11,6 @@ from markdown_it.token import Token
from typing import Any, Generic, Optional
from urllib.parse import quote
-import markdown_it
from . import md
from . import parallel
@@ -265,7 +264,7 @@ class DocBookConverter(BaseConverter[OptionsDocBookRenderer]):
' Configuration Options',
]
result += [
- f'',
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/parallel.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/parallel.py
index c968d3a1322c..ad58bf026406 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/parallel.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/parallel.py
@@ -4,7 +4,7 @@
import multiprocessing
-from typing import Any, Callable, ClassVar, Iterable, Optional, TypeVar
+from typing import Any, Callable, Iterable, Optional, TypeVar
R = TypeVar('R')
S = TypeVar('S')
diff --git a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/types.py b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/types.py
index c6146429ea02..1d586ca240f7 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/types.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/types.py
@@ -1,5 +1,5 @@
from collections.abc import Sequence
-from typing import Any, Callable, Optional, Tuple, NamedTuple
+from typing import Callable, Optional, NamedTuple
from markdown_it.token import Token
diff --git a/pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py b/pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py
index 72700d3dbab3..d808c5b50c34 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py
@@ -2,9 +2,8 @@ import nixos_render_docs as nrd
from sample_md import sample1
-from typing import Mapping, Optional
+from typing import Mapping
-import markdown_it
class Converter(nrd.md.Converter[nrd.commonmark.CommonMarkRenderer]):
def __init__(self, manpage_urls: Mapping[str, str]):
@@ -27,7 +26,7 @@ def test_indented_fence() -> None:
def test_full() -> None:
c = Converter({ 'man(1)': 'http://example.org' })
- assert c._render(sample1) == f"""\
+ assert c._render(sample1) == """\
**Warning:** foo
**Note:** nested
diff --git a/pkgs/tools/nix/nixos-render-docs/src/tests/test_manpage.py b/pkgs/tools/nix/nixos-render-docs/src/tests/test_manpage.py
index 9b7e1652f0f6..b6e4a94ef1c6 100644
--- a/pkgs/tools/nix/nixos-render-docs/src/tests/test_manpage.py
+++ b/pkgs/tools/nix/nixos-render-docs/src/tests/test_manpage.py
@@ -2,9 +2,8 @@ import nixos_render_docs as nrd
from sample_md import sample1
-from typing import Mapping, Optional
+from typing import Mapping
-import markdown_it
class Converter(nrd.md.Converter[nrd.manpage.ManpageRenderer]):
def __init__(self, manpage_urls: Mapping[str, str], options_by_id: dict[str, str] = {}):