Skip to content

Commit 23a1747

Browse files
committed
Remove typing_extensions usage
1 parent 9404052 commit 23a1747

File tree

6 files changed

+5
-36
lines changed

6 files changed

+5
-36
lines changed

mautrix/api.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
from __future__ import annotations
77

8-
from typing import ClassVar, Mapping
8+
from typing import ClassVar, Literal, Mapping
99
from enum import Enum
1010
from json.decoder import JSONDecodeError
1111
from time import time
@@ -14,7 +14,6 @@
1414
import json
1515
import logging
1616
import platform
17-
import sys
1817

1918
from aiohttp import ClientSession, __version__ as aiohttp_version
2019
from aiohttp.client_exceptions import ClientError, ContentTypeError
@@ -25,11 +24,6 @@
2524
from mautrix.util.logging import TraceLogger
2625
from mautrix.util.opt_prometheus import Counter
2726

28-
if sys.version_info >= (3, 8):
29-
from typing import Literal
30-
else:
31-
from typing_extensions import Literal
32-
3327
if __optional_imports__:
3428
# Safe to import, but it's not actually needed, so don't force-import the whole types module.
3529
from mautrix.types import JSON

mautrix/client/api/modules/media_repository.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
from __future__ import annotations
77

8-
from typing import AsyncIterable
9-
import sys
8+
from typing import AsyncIterable, Literal
109

1110
from mautrix import __optional_imports__
1211
from mautrix.api import MediaPath, Method
@@ -15,11 +14,6 @@
1514

1615
from ..base import BaseClientAPI
1716

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal
20-
else:
21-
from typing_extensions import Literal
22-
2317
try:
2418
from mautrix.util import magic
2519
except ImportError:

mautrix/client/state_store/memory.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
from __future__ import annotations
77

8-
from typing import Any
9-
import sys
8+
from typing import Any, TypedDict
109

1110
from mautrix.types import (
1211
Member,
@@ -20,11 +19,6 @@
2019

2120
from .abstract import StateStore
2221

23-
if sys.version_info >= (3, 8):
24-
from typing import TypedDict
25-
else:
26-
from typing_extensions import TypedDict
27-
2822

2923
class SerializedStateStore(TypedDict):
3024
members: dict[RoomID, dict[UserID, Any]]

mautrix/crypto/base.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
from __future__ import annotations
77

8-
from typing import Any, Awaitable, Callable, Dict
8+
from typing import Any, Awaitable, Callable, Dict, TypedDict
99
import asyncio
1010
import functools
1111
import json
12-
import sys
1312

1413
import olm
1514

@@ -27,11 +26,6 @@
2726

2827
from .. import client as cli, crypto
2928

30-
if sys.version_info >= (3, 8):
31-
from typing import TypedDict
32-
else:
33-
from typing_extensions import TypedDict
34-
3529

3630
class SignedObject(TypedDict):
3731
signatures: Dict[UserID, Dict[str, str]]

mautrix/util/file_store.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
from __future__ import annotations
77

8-
from typing import IO, Any
8+
from typing import IO, Any, Protocol
99
from abc import ABC, abstractmethod
1010
from pathlib import Path
1111
import json
1212
import pickle
13-
import sys
1413
import time
1514

16-
if sys.version_info >= (3, 8):
17-
from typing import Protocol
18-
else:
19-
from typing_extensions import Protocol
20-
2115

2216
class Filer(Protocol):
2317
def dump(self, obj: Any, file: IO) -> None:

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
aiohttp
22
attrs
33
yarl
4-
typing_extensions; python_version<"3.8"

0 commit comments

Comments
 (0)