Skip to content

Commit 3d37c4b

Browse files
committed
refactor(typing): Use namespace import for typing_extensions
why: CLAUDE.md requires namespace imports for typing modules. what: - Change `from typing_extensions import X` to `import typing_extensions` - Update all usages to use `typing_extensions.X` namespace
1 parent 40740bc commit 3d37c4b

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/vcspull/cli/_output.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from dataclasses import dataclass, field
99
from enum import Enum
1010

11-
from typing_extensions import NotRequired
11+
import typing_extensions
1212

1313
JsonPrimitive: t.TypeAlias = str | int | float | bool | None
1414
JsonValue: t.TypeAlias = JsonPrimitive | dict[str, "JsonValue"] | list["JsonValue"]
@@ -25,17 +25,17 @@ class PlanEntryPayload(t.TypedDict):
2525
path: str
2626
workspace_root: str
2727
action: str
28-
detail: NotRequired[str]
29-
url: NotRequired[str]
30-
branch: NotRequired[str]
31-
remote_branch: NotRequired[str]
32-
current_rev: NotRequired[str]
33-
target_rev: NotRequired[str]
34-
ahead: NotRequired[int]
35-
behind: NotRequired[int]
36-
dirty: NotRequired[bool]
37-
error: NotRequired[str]
38-
diagnostics: NotRequired[list[str]]
28+
detail: typing_extensions.NotRequired[str]
29+
url: typing_extensions.NotRequired[str]
30+
branch: typing_extensions.NotRequired[str]
31+
remote_branch: typing_extensions.NotRequired[str]
32+
current_rev: typing_extensions.NotRequired[str]
33+
target_rev: typing_extensions.NotRequired[str]
34+
ahead: typing_extensions.NotRequired[int]
35+
behind: typing_extensions.NotRequired[int]
36+
dirty: typing_extensions.NotRequired[bool]
37+
error: typing_extensions.NotRequired[str]
38+
diagnostics: typing_extensions.NotRequired[list[str]]
3939

4040

4141
class PlanSummaryPayload(t.TypedDict):
@@ -49,7 +49,7 @@ class PlanSummaryPayload(t.TypedDict):
4949
blocked: int
5050
errors: int
5151
total: int
52-
duration_ms: NotRequired[int]
52+
duration_ms: typing_extensions.NotRequired[int]
5353

5454

5555
class PlanWorkspacePayload(t.TypedDict):

src/vcspull/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import typing as t
3434
from typing import TypeAlias
3535

36-
from typing_extensions import NotRequired, TypedDict
36+
import typing_extensions
3737

3838
if t.TYPE_CHECKING:
3939
from libvcs._internal.types import VCSLiteral
@@ -50,16 +50,16 @@
5050
RawConfig: TypeAlias = RawConfigDict
5151

5252

53-
class ConfigDict(TypedDict):
53+
class ConfigDict(typing_extensions.TypedDict):
5454
"""Configuration map for vcspull after shorthands and variables resolved."""
5555

5656
vcs: VCSLiteral | None
5757
name: str
5858
path: pathlib.Path
5959
url: str
6060
workspace_root: str
61-
remotes: NotRequired[GitSyncRemoteDict | None]
62-
shell_command_after: NotRequired[list[str] | None]
61+
remotes: typing_extensions.NotRequired[GitSyncRemoteDict | None]
62+
shell_command_after: typing_extensions.NotRequired[list[str] | None]
6363

6464

6565
ConfigDir = dict[str, ConfigDict]

tests/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import typing as t
77

8-
from typing_extensions import Self
8+
import typing_extensions
99

1010
from vcspull._internal.config_reader import ConfigReader
1111

@@ -40,7 +40,7 @@ def unset(self, envvar: str) -> None:
4040
self._reset[envvar] = self._environ[envvar]
4141
del self._environ[envvar]
4242

43-
def __enter__(self) -> Self:
43+
def __enter__(self) -> typing_extensions.Self:
4444
"""Context manager entry for setting and resetting environmental variable."""
4545
return self
4646

0 commit comments

Comments
 (0)