Skip to content

Commit aa53c38

Browse files
committed
Python 3.10 type hinting compatibility
1 parent e538f2a commit aa53c38

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/lmstudio/plugin/_dev_runner.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
from contextlib import asynccontextmanager
99
from pathlib import Path
1010
from functools import partial
11-
from typing import AsyncGenerator, Iterable, TypeAlias, assert_never
11+
from typing import AsyncGenerator, Iterable, TypeAlias
12+
13+
from typing_extensions import (
14+
# Native in 3.11+
15+
assert_never,
16+
)
17+
1218

1319
from .runner import (
1420
ENV_CLIENT_ID,

src/lmstudio/plugin/config_schemas.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
Any,
66
ClassVar,
77
Generic,
8-
Self,
98
Sequence,
109
TypeVar,
1110
cast,
11+
)
12+
13+
from typing_extensions import (
14+
# Native in 3.11+
15+
Self,
1216
dataclass_transform,
1317
)
1418

src/lmstudio/plugin/hooks/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import asyncio
44

55
from contextlib import asynccontextmanager
6-
from datetime import datetime, UTC
6+
from datetime import datetime, timezone
77
from pathlib import Path
88
from random import randrange
99
from typing import (
@@ -90,7 +90,7 @@ def _parse_config(
9090

9191
@classmethod
9292
def _create_ui_block_id(self) -> str:
93-
return f"{datetime.now(UTC)}-{randrange(0, 2**32):08x}"
93+
return f"{datetime.now(timezone.utc)}-{randrange(0, 2**32):08x}"
9494

9595

9696
StatusUpdateCallback: TypeAlias = Callable[[str, StatusStepStatus, str], Any]

src/lmstudio/plugin/hooks/prompt_preprocessor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
Generic,
1414
Iterable,
1515
TypeAlias,
16+
)
17+
from typing_extensions import (
18+
# Native in 3.11+
1619
assert_never,
1720
)
1821

0 commit comments

Comments
 (0)