Skip to content

Commit 049b37f

Browse files
Apply ruff/pyupgrade rule UP006
UP006 Use `dict` instead of `Dict` for type annotation UP006 Use `list` instead of `List` for type annotation UP006 Use `set` instead of `Set` for type annotation
1 parent 5c15902 commit 049b37f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

readme_renderer/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import pathlib
66
from importlib.metadata import metadata
77
import sys
8-
from typing import Optional, List
8+
from typing import Optional
99

1010

11-
def main(cli_args: Optional[List[str]] = None) -> None:
11+
def main(cli_args: Optional[list[str]] = None) -> None:
1212
parser = argparse.ArgumentParser(
1313
description="Renders a .md, .rst, or .txt README to HTML",
1414
)

readme_renderer/clean.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Dict, Optional, Set
15+
from typing import Optional
1616

1717
import nh3
1818

@@ -67,8 +67,8 @@
6767

6868
def clean(
6969
html: str,
70-
tags: Optional[Set[str]] = None,
71-
attributes: Optional[Dict[str, Set[str]]] = None
70+
tags: Optional[set[str]] = None,
71+
attributes: Optional[dict[str, set[str]]] = None
7272
) -> Optional[str]:
7373
if tags is None:
7474
tags = ALLOWED_TAGS

readme_renderer/markdown.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import re
1616
import warnings
17-
from typing import cast, Any, Dict, Callable, Match, Optional
17+
from typing import cast, Any, Callable, Match, Optional
1818

1919
from html import unescape
2020

@@ -32,7 +32,7 @@
3232
try:
3333
import cmarkgfm
3434
from cmarkgfm.cmark import Options as cmarkgfmOptions
35-
variants: Dict[str, Callable[[str], str]] = {
35+
variants: dict[str, Callable[[str], str]] = {
3636
"GFM": lambda raw: cast(str, cmarkgfm.github_flavored_markdown_to_html(
3737
raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE
3838
)),

readme_renderer/rst.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import io
16-
from typing import Any, Dict, IO, Optional
16+
from typing import Any, IO, Optional
1717

1818
from docutils.core import publish_parts
1919
from docutils.nodes import Element
@@ -26,7 +26,7 @@
2626
class ReadMeHTMLTranslator(HTMLTranslator):
2727

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

3131
def emptytag(
3232
self,

0 commit comments

Comments
 (0)