-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from hivesolutions/src/netius/adapters/fs.pyi
feat: add src/netius/adapters to typing
- Loading branch information
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from netius import BaseAdapter | ||
|
||
class MongoAdapter(BaseAdapter): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from netius import BaseAdapter | ||
|
||
class NullAdapter(BaseAdapter): | ||
pass |