Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add src/netius/adapters to typing #37

Merged
merged 8 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/netius/adapters/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import Any, BinaryIO, Sequence

class BaseAdapter:
def set(self, value: Any, owner: str = ...): ...
def get(self, key: str) -> bytes | None: ...
def get_file(self, key: str, mode: str = ...) -> BinaryIO: ...
def delete(self, key: str, owner: str = ...): ...
def append(self, key: str, value: Any): ...
def truncate(self, key: str, count: int): ...
def size(self, key: str) -> int: ...
def sizes(self, owner: str | None = ...) -> list[int]: ...
def total(self, owner: str | None = ...) -> int: ...
def reserve(self, owner: str = ...): ...
def count(self, owner: str | None = ...) -> int: ...
def list(self, owner: str | None = ...) -> Sequence[str]: ...
def generate(self) -> str: ...
11 changes: 11 additions & 0 deletions src/netius/adapters/fs.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from os import PathLike

from netius import BaseAdapter

class FsAdapter(BaseAdapter):
base_path: str

def __init__(self, base_path: str | None = ...) -> None: ...
def _path(self, owner: str | None = ...) -> str: ...
def _ensure(self, owner: str) -> str: ...
def _symlink(self, source: PathLike[str], target: PathLike[str]) -> None: ...
8 changes: 8 additions & 0 deletions src/netius/adapters/memory.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from typing import Any, BinaryIO, Callable

from netius import BaseAdapter

class MemoryAdapter(BaseAdapter):
def __init__(self): ...
def _ensure(self, owner: str) -> dict[str, Any]: ...
def _build_close(self, file: BinaryIO, key: str) -> Callable[[], None]: ...
4 changes: 4 additions & 0 deletions src/netius/adapters/mongo.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from netius import BaseAdapter

class MongoAdapter(BaseAdapter):
pass
4 changes: 4 additions & 0 deletions src/netius/adapters/null.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from netius import BaseAdapter

class NullAdapter(BaseAdapter):
pass