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 5 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
18 changes: 18 additions & 0 deletions src/netius/adapters/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import netius as netius

import typing

class BaseAdapter:
def set(self, value: typing.Any, owner: str = ...) -> None: ...
def get(self, key: str) -> str | netius.legacy.StringIO: ...
def get_file(self, key: str, mode: str = ...) -> netius.legacy.StringIO: ...
def delete(self, key: str, owner: str = ...) -> None: ...
def append(self, key:str , value: typing.Any) -> None: ...
hugo-gomes marked this conversation as resolved.
Show resolved Hide resolved
def truncate(self, key:str , count: int) -> None: ...
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 = ...) -> None: ...
def count(self, owner: str | None = ...) -> int: ...
def list(self, owner: str | None = ...) -> tuple[()]: ...
def generate(self) -> str: ...
17 changes: 17 additions & 0 deletions src/netius/adapters/fs.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import netius as netius
import netius.adapters.base
import netius.adapters.base as base

import typing

class FsAdapter(netius.adapters.base.BaseAdapter):
def __init__(self, base_path: str | None = ...) -> None: ...
def set(self, value: typing.Any, owner: str = ...) -> str: ...
def get_file(self, key: str, mode: str = ...) -> netius.legacy.StringIO: ...
def delete(self, key: str, owner: str = ...) -> None: ...
def size(self, key:str ) -> int: ...
def count(self, owner: str | None = ...) -> int: ...
def list(self, owner: str | None = ...) -> list[str]: ...
def _path(self, owner: str | None = ...) -> str: ...
def _ensure(self, owner: str) -> str: ...
def _symlink(self, source: typing.StrOrBytesPath, target: typing.StrOrBytesPath) -> None: ...
18 changes: 18 additions & 0 deletions src/netius/adapters/memory.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import netius as netius
import netius.adapters.base
import netius.adapters.base as base

import typing

class MemoryAdapter(netius.adapters.base.BaseAdapter):
def __init__(self) -> None: ...
def set(self, value, owner: str = ...) -> str: ...
def get_file(self, key: str, mode: str = ...) -> netius.legacy.StringIO: ...
def delete(self, key: str, owner: str = ...) -> None: ...
def append(self, key: str, value: typing.Any) -> None: ...
def truncate(self, key: str, count: int) -> None: ...
def size(self, key: str) -> int: ...
def count(self, owner: str | None = ...) -> int: ...
def list(self, owner: str | None = ...) -> tuple[()]: ...
def _ensure(self, owner: str) -> dict: ...
def _build_close(self, file: netius.legacy.StringIO, key: str) -> function: ...
hugo-gomes marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions src/netius/adapters/mongo.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import netius.adapters.base
import netius.adapters.base as base

class MongoAdapter(netius.adapters.base.BaseAdapter):
def set(self, value: str, owner: str = ...): ...
def get(self, key: str): ...
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 @@
import netius.adapters.base
import netius.adapters.base as base

class NullAdapter(netius.adapters.base.BaseAdapter): ...