Skip to content

Commit

Permalink
Use new annotation style
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Knittl-Frank committed Dec 18, 2023
1 parent f676927 commit e23db32
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/sphinxcontrib/email/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any, Dict
from __future__ import annotations

from typing import Any

from sphinx.application import Sphinx
from sphinx.util import logging
Expand All @@ -19,7 +21,7 @@
logger = logging.getLogger("sphinxcontrib-email")


def setup(app: Sphinx) -> Dict[str, Any]:
def setup(app: Sphinx) -> dict[str, Any]:
app.add_config_value(name="email_automode", default=False, rebuild="env")
app.connect(event="html-page-context", callback=html_page_context_handler)
app.add_role(name="email", role=EmailRole())
Expand Down
4 changes: 2 additions & 2 deletions src/sphinxcontrib/email/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from __future__ import annotations

import lxml.html # nosec # noqa DUO107
from sphinx.application import Sphinx
Expand All @@ -10,7 +10,7 @@


def html_page_context_handler(
app: Sphinx, pagename: str, templatename: str, context: Dict, doctree: bool
app: Sphinx, pagename: str, templatename: str, context: dict, doctree: bool
):
"""Search html for 'mailto' links and obfuscate them"""
if not app.config["email_automode"]:
Expand Down
5 changes: 3 additions & 2 deletions src/sphinxcontrib/email/roles.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import re
from typing import List, Tuple

from docutils import nodes
from docutils.nodes import Node, system_message
Expand All @@ -12,7 +13,7 @@


class EmailRole(SphinxRole):
def run(self) -> Tuple[List[Node], List[system_message]]:
def run(self) -> tuple[list[Node], list[system_message]]:
"""Role to obfuscate e-mail addresses.
Handle addresses of the form
Expand Down
2 changes: 2 additions & 0 deletions src/sphinxcontrib/email/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re
import textwrap
import xml.sax.saxutils # nosec
Expand Down

0 comments on commit e23db32

Please sign in to comment.