33from collections .abc import AsyncGenerator
44from contextlib import asynccontextmanager
55from pathlib import Path
6- from typing import Annotated , Literal , final , override
6+ from typing import Literal , final , override
77
88from attrs import Factory , define , field
99from loguru import logger
10- from pydantic import BaseModel , Field
1110
1211from lsp_client .jsonrpc .parse import RawPackage
1312from lsp_client .utils .workspace import Workspace
1615from .local import LocalServer
1716
1817
19- class MountBase (BaseModel ):
18+ @define
19+ class MountBase :
2020 type : str
2121 target : str
2222 source : str | None = None
@@ -35,6 +35,7 @@ def __str__(self) -> str:
3535 return "," .join (self ._parts ())
3636
3737
38+ @define
3839class BindMount (MountBase ):
3940 type : str = "bind"
4041
@@ -63,6 +64,7 @@ def from_path(cls, path: Path) -> BindMount:
6364 return cls (source = str (absolute_path ), target = str (absolute_path ))
6465
6566
67+ @define
6668class VolumeMount (MountBase ):
6769 type : str = "volume"
6870
@@ -87,6 +89,7 @@ def _parts(self) -> list[str]:
8789 return parts
8890
8991
92+ @define
9093class TmpfsMount (MountBase ):
9194 type : str = "tmpfs"
9295
@@ -104,10 +107,7 @@ def _parts(self) -> list[str]:
104107 return parts
105108
106109
107- MountPoint = Annotated [
108- BindMount | VolumeMount | TmpfsMount ,
109- Field (discriminator = "type" ),
110- ]
110+ MountPoint = BindMount | VolumeMount | TmpfsMount
111111
112112Mount = MountPoint | str | Path
113113
0 commit comments