Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
# Generated from filesystem/filesystem.proto. DO NOT EDIT.
# Generated by protoc-gen-connectrpc-py v0.12.1 with parameter "".
# ruff: noqa: PGH004
# ruff: noqa
# fmt: off
from __future__ import annotations
from typing import Protocol, TYPE_CHECKING
from connectrpc.client import ConnectClient, ConnectClientSync
from connectrpc.code import Code
from connectrpc.errors import ConnectError
from connectrpc.method import IdempotencyLevel, MethodInfo
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, DEFAULT_READ_MAX_BYTES, Endpoint, EndpointSync
from protobuf import DescService
from . import filesystem_pb
from .filesystem_pb import CreateWatcherRequest, CreateWatcherResponse, GetWatcherEventsRequest, GetWatcherEventsResponse, ListDirRequest, ListDirResponse, MakeDirRequest, MakeDirResponse, MoveRequest, MoveResponse, RemoveRequest, RemoveResponse, RemoveWatcherRequest, RemoveWatcherResponse, StatRequest, StatResponse, WatchDirRequest, WatchDirResponse
if TYPE_CHECKING:
from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping
from connectrpc.codec import Codec
from connectrpc.compression import Compression
from connectrpc.interceptor import Interceptor, InterceptorSync
from connectrpc.request import Headers, RequestContext
class Filesystem(Protocol):
async def stat(self, request: StatRequest, ctx: RequestContext[StatRequest, StatResponse], /) -> StatResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def make_dir(self, request: MakeDirRequest, ctx: RequestContext[MakeDirRequest, MakeDirResponse], /) -> MakeDirResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def move(self, request: MoveRequest, ctx: RequestContext[MoveRequest, MoveResponse], /) -> MoveResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def list_dir(self, request: ListDirRequest, ctx: RequestContext[ListDirRequest, ListDirResponse], /) -> ListDirResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def remove(self, request: RemoveRequest, ctx: RequestContext[RemoveRequest, RemoveResponse], /) -> RemoveResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def watch_dir(self, request: WatchDirRequest, ctx: RequestContext[WatchDirRequest, WatchDirResponse], /) -> AsyncIterator[WatchDirResponse]:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def create_watcher(self, request: CreateWatcherRequest, ctx: RequestContext[CreateWatcherRequest, CreateWatcherResponse], /) -> CreateWatcherResponse:
"""
Non-streaming versions of WatchDir
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def get_watcher_events(self, request: GetWatcherEventsRequest, ctx: RequestContext[GetWatcherEventsRequest, GetWatcherEventsResponse], /) -> GetWatcherEventsResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
async def remove_watcher(self, request: RemoveWatcherRequest, ctx: RequestContext[RemoveWatcherRequest, RemoveWatcherResponse], /) -> RemoveWatcherResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
@classmethod
def desc(cls) -> DescService:
"""Returns the descriptor for this service."""
return next(s for s in filesystem_pb.desc().services if s.type_name == 'filesystem.Filesystem')
class FilesystemASGIApplication(ConnectASGIApplication[Filesystem]):
def __init__(
self,
service: Filesystem | AsyncGenerator[Filesystem],
*,
interceptors: Iterable[Interceptor] = (),
read_max_bytes: int | None = DEFAULT_READ_MAX_BYTES,
compressions: Iterable[Compression] | None = None,
codecs: Iterable[Codec] | None = None,
) -> None:
super().__init__(
service=service,
endpoints=lambda svc: {
"/filesystem.Filesystem/Stat": Endpoint.unary(
method=MethodInfo(
name="Stat",
service_name="filesystem.Filesystem",
input=StatRequest,
output=StatResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.stat,
),
"/filesystem.Filesystem/MakeDir": Endpoint.unary(
method=MethodInfo(
name="MakeDir",
service_name="filesystem.Filesystem",
input=MakeDirRequest,
output=MakeDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.make_dir,
),
"/filesystem.Filesystem/Move": Endpoint.unary(
method=MethodInfo(
name="Move",
service_name="filesystem.Filesystem",
input=MoveRequest,
output=MoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.move,
),
"/filesystem.Filesystem/ListDir": Endpoint.unary(
method=MethodInfo(
name="ListDir",
service_name="filesystem.Filesystem",
input=ListDirRequest,
output=ListDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.list_dir,
),
"/filesystem.Filesystem/Remove": Endpoint.unary(
method=MethodInfo(
name="Remove",
service_name="filesystem.Filesystem",
input=RemoveRequest,
output=RemoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.remove,
),
"/filesystem.Filesystem/WatchDir": Endpoint.server_stream(
method=MethodInfo(
name="WatchDir",
service_name="filesystem.Filesystem",
input=WatchDirRequest,
output=WatchDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.watch_dir,
),
"/filesystem.Filesystem/CreateWatcher": Endpoint.unary(
method=MethodInfo(
name="CreateWatcher",
service_name="filesystem.Filesystem",
input=CreateWatcherRequest,
output=CreateWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.create_watcher,
),
"/filesystem.Filesystem/GetWatcherEvents": Endpoint.unary(
method=MethodInfo(
name="GetWatcherEvents",
service_name="filesystem.Filesystem",
input=GetWatcherEventsRequest,
output=GetWatcherEventsResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.get_watcher_events,
),
"/filesystem.Filesystem/RemoveWatcher": Endpoint.unary(
method=MethodInfo(
name="RemoveWatcher",
service_name="filesystem.Filesystem",
input=RemoveWatcherRequest,
output=RemoveWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=svc.remove_watcher,
),
},
interceptors=interceptors,
read_max_bytes=read_max_bytes,
compressions=compressions,
codecs=codecs,
)
@property
def path(self) -> str:
"""Returns the URL path to mount the application to when serving multiple applications."""
return "/filesystem.Filesystem"
class FilesystemClient(ConnectClient):
async def stat(
self,
request: StatRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> StatResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="Stat",
service_name="filesystem.Filesystem",
input=StatRequest,
output=StatResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def make_dir(
self,
request: MakeDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> MakeDirResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="MakeDir",
service_name="filesystem.Filesystem",
input=MakeDirRequest,
output=MakeDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def move(
self,
request: MoveRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> MoveResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="Move",
service_name="filesystem.Filesystem",
input=MoveRequest,
output=MoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def list_dir(
self,
request: ListDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ListDirResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="ListDir",
service_name="filesystem.Filesystem",
input=ListDirRequest,
output=ListDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def remove(
self,
request: RemoveRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> RemoveResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="Remove",
service_name="filesystem.Filesystem",
input=RemoveRequest,
output=RemoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def watch_dir(
self,
request: WatchDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> AsyncIterator[WatchDirResponse]:
return self.execute_server_stream(
request=request,
method=MethodInfo(
name="WatchDir",
service_name="filesystem.Filesystem",
input=WatchDirRequest,
output=WatchDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def create_watcher(
self,
request: CreateWatcherRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> CreateWatcherResponse:
"""
Non-streaming versions of WatchDir
"""
return await self.execute_unary(
request=request,
method=MethodInfo(
name="CreateWatcher",
service_name="filesystem.Filesystem",
input=CreateWatcherRequest,
output=CreateWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def get_watcher_events(
self,
request: GetWatcherEventsRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> GetWatcherEventsResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="GetWatcherEvents",
service_name="filesystem.Filesystem",
input=GetWatcherEventsRequest,
output=GetWatcherEventsResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
async def remove_watcher(
self,
request: RemoveWatcherRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> RemoveWatcherResponse:
return await self.execute_unary(
request=request,
method=MethodInfo(
name="RemoveWatcher",
service_name="filesystem.Filesystem",
input=RemoveWatcherRequest,
output=RemoveWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
class FilesystemSync(Protocol):
def stat(self, request: StatRequest, ctx: RequestContext[StatRequest, StatResponse], /) -> StatResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def make_dir(self, request: MakeDirRequest, ctx: RequestContext[MakeDirRequest, MakeDirResponse], /) -> MakeDirResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def move(self, request: MoveRequest, ctx: RequestContext[MoveRequest, MoveResponse], /) -> MoveResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def list_dir(self, request: ListDirRequest, ctx: RequestContext[ListDirRequest, ListDirResponse], /) -> ListDirResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def remove(self, request: RemoveRequest, ctx: RequestContext[RemoveRequest, RemoveResponse], /) -> RemoveResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def watch_dir(self, request: WatchDirRequest, ctx: RequestContext[WatchDirRequest, WatchDirResponse], /) -> Iterator[WatchDirResponse]:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def create_watcher(self, request: CreateWatcherRequest, ctx: RequestContext[CreateWatcherRequest, CreateWatcherResponse], /) -> CreateWatcherResponse:
"""
Non-streaming versions of WatchDir
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def get_watcher_events(self, request: GetWatcherEventsRequest, ctx: RequestContext[GetWatcherEventsRequest, GetWatcherEventsResponse], /) -> GetWatcherEventsResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
def remove_watcher(self, request: RemoveWatcherRequest, ctx: RequestContext[RemoveWatcherRequest, RemoveWatcherResponse], /) -> RemoveWatcherResponse:
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
@classmethod
def desc(cls) -> DescService:
"""Returns the descriptor for this service."""
return next(s for s in filesystem_pb.desc().services if s.type_name == 'filesystem.Filesystem')
class FilesystemWSGIApplication(ConnectWSGIApplication):
def __init__(
self,
service: FilesystemSync,
interceptors: Iterable[InterceptorSync] = (),
read_max_bytes: int | None = DEFAULT_READ_MAX_BYTES,
compressions: Iterable[Compression] | None = None,
codecs: Iterable[Codec] | None = None,
) -> None:
super().__init__(
endpoints={
"/filesystem.Filesystem/Stat": EndpointSync.unary(
method=MethodInfo(
name="Stat",
service_name="filesystem.Filesystem",
input=StatRequest,
output=StatResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.stat,
),
"/filesystem.Filesystem/MakeDir": EndpointSync.unary(
method=MethodInfo(
name="MakeDir",
service_name="filesystem.Filesystem",
input=MakeDirRequest,
output=MakeDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.make_dir,
),
"/filesystem.Filesystem/Move": EndpointSync.unary(
method=MethodInfo(
name="Move",
service_name="filesystem.Filesystem",
input=MoveRequest,
output=MoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.move,
),
"/filesystem.Filesystem/ListDir": EndpointSync.unary(
method=MethodInfo(
name="ListDir",
service_name="filesystem.Filesystem",
input=ListDirRequest,
output=ListDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.list_dir,
),
"/filesystem.Filesystem/Remove": EndpointSync.unary(
method=MethodInfo(
name="Remove",
service_name="filesystem.Filesystem",
input=RemoveRequest,
output=RemoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.remove,
),
"/filesystem.Filesystem/WatchDir": EndpointSync.server_stream(
method=MethodInfo(
name="WatchDir",
service_name="filesystem.Filesystem",
input=WatchDirRequest,
output=WatchDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.watch_dir,
),
"/filesystem.Filesystem/CreateWatcher": EndpointSync.unary(
method=MethodInfo(
name="CreateWatcher",
service_name="filesystem.Filesystem",
input=CreateWatcherRequest,
output=CreateWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.create_watcher,
),
"/filesystem.Filesystem/GetWatcherEvents": EndpointSync.unary(
method=MethodInfo(
name="GetWatcherEvents",
service_name="filesystem.Filesystem",
input=GetWatcherEventsRequest,
output=GetWatcherEventsResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.get_watcher_events,
),
"/filesystem.Filesystem/RemoveWatcher": EndpointSync.unary(
method=MethodInfo(
name="RemoveWatcher",
service_name="filesystem.Filesystem",
input=RemoveWatcherRequest,
output=RemoveWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
function=service.remove_watcher,
),
},
interceptors=interceptors,
read_max_bytes=read_max_bytes,
compressions=compressions,
codecs=codecs,
)
@property
def path(self) -> str:
"""Returns the URL path to mount the application to when serving multiple applications."""
return "/filesystem.Filesystem"
class FilesystemClientSync(ConnectClientSync):
def stat(
self,
request: StatRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> StatResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="Stat",
service_name="filesystem.Filesystem",
input=StatRequest,
output=StatResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def make_dir(
self,
request: MakeDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> MakeDirResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="MakeDir",
service_name="filesystem.Filesystem",
input=MakeDirRequest,
output=MakeDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def move(
self,
request: MoveRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> MoveResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="Move",
service_name="filesystem.Filesystem",
input=MoveRequest,
output=MoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def list_dir(
self,
request: ListDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ListDirResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="ListDir",
service_name="filesystem.Filesystem",
input=ListDirRequest,
output=ListDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def remove(
self,
request: RemoveRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> RemoveResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="Remove",
service_name="filesystem.Filesystem",
input=RemoveRequest,
output=RemoveResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def watch_dir(
self,
request: WatchDirRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> Iterator[WatchDirResponse]:
return self.execute_server_stream(
request=request,
method=MethodInfo(
name="WatchDir",
service_name="filesystem.Filesystem",
input=WatchDirRequest,
output=WatchDirResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def create_watcher(
self,
request: CreateWatcherRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> CreateWatcherResponse:
"""
Non-streaming versions of WatchDir
"""
return self.execute_unary(
request=request,
method=MethodInfo(
name="CreateWatcher",
service_name="filesystem.Filesystem",
input=CreateWatcherRequest,
output=CreateWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def get_watcher_events(
self,
request: GetWatcherEventsRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> GetWatcherEventsResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="GetWatcherEvents",
service_name="filesystem.Filesystem",
input=GetWatcherEventsRequest,
output=GetWatcherEventsResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)
def remove_watcher(
self,
request: RemoveWatcherRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> RemoveWatcherResponse:
return self.execute_unary(
request=request,
method=MethodInfo(
name="RemoveWatcher",
service_name="filesystem.Filesystem",
input=RemoveWatcherRequest,
output=RemoveWatcherResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
),
headers=headers,
timeout_ms=timeout_ms,
)