Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions readme_renderer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import pathlib
from importlib.metadata import metadata
import sys
from typing import Optional, List
from typing import Optional


def main(cli_args: Optional[List[str]] = None) -> None:
def main(cli_args: Optional[list[str]] = None) -> None:
parser = argparse.ArgumentParser(
description="Renders a .md, .rst, or .txt README to HTML",
)
Expand Down
6 changes: 3 additions & 3 deletions readme_renderer/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict, Optional, Set
from typing import Optional

import nh3

Expand Down Expand Up @@ -67,8 +67,8 @@

def clean(
html: str,
tags: Optional[Set[str]] = None,
attributes: Optional[Dict[str, Set[str]]] = None
tags: Optional[set[str]] = None,
attributes: Optional[dict[str, set[str]]] = None
) -> Optional[str]:
if tags is None:
tags = ALLOWED_TAGS
Expand Down
5 changes: 3 additions & 2 deletions readme_renderer/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

import re
import warnings
from typing import cast, Any, Dict, Callable, Match, Optional
from typing import cast, Any, Callable, Optional
from re import Match

from html import unescape

Expand All @@ -32,7 +33,7 @@
try:
import cmarkgfm
from cmarkgfm.cmark import Options as cmarkgfmOptions
variants: Dict[str, Callable[[str], str]] = {
variants: dict[str, Callable[[str], str]] = {
"GFM": lambda raw: cast(str, cmarkgfm.github_flavored_markdown_to_html(
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE
)),
Expand Down
4 changes: 2 additions & 2 deletions readme_renderer/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import io
from typing import Any, Dict, IO, Optional
from typing import Any, IO, Optional

from docutils.core import publish_parts
from docutils.nodes import Element
Expand All @@ -26,7 +26,7 @@
class ReadMeHTMLTranslator(HTMLTranslator):

# Overrides base class not to output `<object>` tag for SVG images.
object_image_types: Dict[str, str] = {}
object_image_types: dict[str, str] = {}

def emptytag(
self,
Expand Down