Skip to content

Commit 28bbd28

Browse files
committed
Make typing compatible with python 3.9
1 parent 2743baf commit 28bbd28

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

quartodoc/pandoc/blocks.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
"""
44
from __future__ import annotations
55

6-
import sys
6+
import collections.abc as abc
77
import itertools
8+
import sys
89
import typing
9-
import collections.abc as abc
1010

11-
from typing import Literal, Optional, Sequence
11+
from textwrap import indent
12+
from dataclasses import dataclass
13+
from typing import Literal, Optional, Sequence, Union
1214
if sys.version_info >= (3, 10):
1315
from typing import TypeAlias
1416
else:
1517
TypeAlias = "TypeAlias"
1618

17-
from textwrap import indent
18-
from dataclasses import dataclass
19-
2019
from quartodoc.pandoc.components import Attr
2120
from quartodoc.pandoc.inlines import (
2221
Inline,
@@ -83,8 +82,8 @@ def as_list_item(self):
8382

8483
# TypeAlias declared here to avoid forward-references which
8584
# break beartype
86-
ContentItem: TypeAlias = str | Inline | Block
87-
BlockContent: TypeAlias = ContentItem | Sequence[ContentItem]
85+
ContentItem: TypeAlias = Union[str, Inline, Block]
86+
BlockContent: TypeAlias = Union[ContentItem, Sequence[ContentItem]]
8887
DefinitionItem: TypeAlias = tuple[InlineContent, BlockContent]
8988

9089

quartodoc/pandoc/inlines.py

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

99
from dataclasses import dataclass
1010
from pathlib import Path
11-
from typing import Optional, Sequence
11+
from typing import Optional, Sequence, Union
1212
if sys.version_info >= (3, 10):
1313
from typing import TypeAlias
1414
else:
@@ -66,7 +66,7 @@ def as_list_item(self):
6666

6767
# TypeAlias declared here to avoid forward-references which
6868
# break beartype
69-
InlineContent: TypeAlias = str | Inline | Sequence[str | Inline]
69+
InlineContent: TypeAlias = Union[str, Inline, Union[Sequence[str], Inline]]
7070

7171

7272
@dataclass

0 commit comments

Comments
 (0)