Skip to content

Commit b8d8fe1

Browse files
committed
Update type annotations to support Python 3.8
1 parent 5e17e93 commit b8d8fe1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

urlpattern.pyi

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from typing_extensions import TypeAlias, TypedDict, overload
1+
from typing import Optional, TypedDict, Union, overload
22

3-
URLPatternInput: TypeAlias = str | URLPatternInit
3+
from typing_extensions import TypeAlias
4+
5+
URLPatternInput: TypeAlias = Union[str, URLPatternInit]
46

57
class URLPatternOptions(TypedDict, total=False):
68
ignoreCase: bool
@@ -11,16 +13,18 @@ class URLPattern:
1113
self,
1214
input: URLPatternInput,
1315
baseURL: str,
14-
options: URLPatternOptions | None = None,
16+
options: Optional[URLPatternOptions] = None,
1517
) -> None: ...
1618
@overload
1719
def __init__(
18-
self, input: URLPatternInput, options: URLPatternOptions | None = None
20+
self, input: URLPatternInput, options: Optional[URLPatternOptions] = None
1921
) -> None: ...
20-
def test(self, input: URLPatternInput = {}, baseURL: str | None = None) -> bool: ...
22+
def test(
23+
self, input: URLPatternInput = {}, baseURL: Optional[str] = None
24+
) -> bool: ...
2125
def exec(
22-
self, input: URLPatternInput = {}, baseURL: str | None = None
23-
) -> URLPatternResult | None: ...
26+
self, input: URLPatternInput = {}, baseURL: Optional[str] = None
27+
) -> Optional[URLPatternResult]: ...
2428
@property
2529
def protocol(self) -> str: ...
2630
@property
@@ -65,4 +69,4 @@ class URLPatternComponentResult(TypedDict):
6569
input: str
6670
groups: dict[str, str]
6771

68-
URLPatternCompatible: TypeAlias = str | URLPatternInit | URLPattern
72+
URLPatternCompatible: TypeAlias = Union[str, URLPatternInit, URLPattern]

0 commit comments

Comments
 (0)