Skip to content

Commit

Permalink
feat: typing using pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-gomes authored and hgomes committed Dec 14, 2023
1 parent e8b159a commit b498404
Show file tree
Hide file tree
Showing 125 changed files with 10,189 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/typings/netius/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
This type stub file was generated by pyright.
"""

from . import adapters, auth, base
from .adapters import *
from .auth import *
from .base import *

__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
16 changes: 16 additions & 0 deletions src/typings/netius/adapters/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
This type stub file was generated by pyright.
"""

from . import base, fs, memory, mongo, null
from .base import BaseAdapter
from .fs import FsAdapter
from .memory import MemoryAdapter
from .mongo import MongoAdapter
from .null import NullAdapter

__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
59 changes: 59 additions & 0 deletions src/typings/netius/adapters/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
This type stub file was generated by pyright.
"""

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class BaseAdapter:
"""
Top level abstract representation of a netius adapter.
The adapter is responsible for the storage/retrieval
of key based values, and may be used as the storage
engine back-end for a series or purposes (eg: email
storage, torrent hash table storage, sessions, etc.)
"""
def set(self, value, owner=...): # -> None:
...

def get(self, key): # -> str:
...

def get_file(self, key, mode=...): # -> StringIO:
...

def delete(self, key, owner=...): # -> None:
...

def append(self, key, value): # -> None:
...

def truncate(self, key, count): # -> None:
...

def size(self, key): # -> Literal[0]:
...

def sizes(self, owner=...): # -> list[int]:
...

def total(self, owner=...): # -> int:
...

def reserve(self, owner=...): # -> None:
...

def count(self, owner=...): # -> Literal[0]:
...

def list(self, owner=...): # -> tuple[()]:
...

def generate(self): # -> str:
...



36 changes: 36 additions & 0 deletions src/typings/netius/adapters/fs.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class FsAdapter(base.BaseAdapter):
def __init__(self, base_path=...) -> None:
...

def set(self, value, owner=...): # -> str:
...

def get_file(self, key, mode=...): # -> IO[Any]:
...

def delete(self, key, owner=...): # -> None:
...

def size(self, key): # -> int:
...

def count(self, owner=...): # -> int:
...

def list(self, owner=...): # -> list[str]:
...



42 changes: 42 additions & 0 deletions src/typings/netius/adapters/memory.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class MemoryAdapter(base.BaseAdapter):
def __init__(self) -> None:
...

def set(self, value, owner=...): # -> str:
...

def get_file(self, key, mode=...): # -> StringIO:
...

def delete(self, key, owner=...): # -> None:
...

def append(self, key, value): # -> None:
...

def truncate(self, key, count): # -> None:
...

def size(self, key): # -> int:
...

def count(self, owner=...): # -> int:
...

def list(self, owner=...): # -> dict_keys[Any, Any]:
...



21 changes: 21 additions & 0 deletions src/typings/netius/adapters/mongo.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class MongoAdapter(base.BaseAdapter):
def set(self, value, owner=...): # -> None:
...

def get(self, key): # -> None:
...



16 changes: 16 additions & 0 deletions src/typings/netius/adapters/null.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class NullAdapter(base.BaseAdapter):
...


19 changes: 19 additions & 0 deletions src/typings/netius/auth/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
This type stub file was generated by pyright.
"""

from . import address, allow, base, deny, dummy, memory, passwd, simple
from .address import AddressAuth
from .allow import AllowAuth
from .base import Auth
from .deny import DenyAuth
from .dummy import DummyAuth
from .memory import MemoryAuth
from .passwd import PasswdAuth
from .simple import SimpleAuth

__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
29 changes: 29 additions & 0 deletions src/typings/netius/auth/address.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class AddressAuth(base.Auth):
def __init__(self, allowed=..., *args, **kwargs) -> None:
...

@classmethod
def auth(cls, allowed=..., *args, **kwargs): # -> bool:
...

@classmethod
def is_simple(cls): # -> Literal[True]:
...

def auth_i(self, *args, **kwargs): # -> bool:
...



23 changes: 23 additions & 0 deletions src/typings/netius/auth/allow.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class AllowAuth(base.Auth):
@classmethod
def auth(cls, *args, **kwargs): # -> Literal[True]:
...

@classmethod
def is_simple(cls): # -> Literal[True]:
...



22 changes: 22 additions & 0 deletions src/typings/netius/auth/base.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
This type stub file was generated by pyright.
"""

from typing import Literal

HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"]
class Auth:
@classmethod
def verify(cls, encoded: str, decoded: str) -> bool:
...

@classmethod
def generate(cls, password: str, type: HashType = ..., salt: str = ...) -> str:
...

@classmethod
def unpack(cls, password: str) -> tuple[HashType, str, str, str]:
...



23 changes: 23 additions & 0 deletions src/typings/netius/auth/deny.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class DenyAuth(base.Auth):
@classmethod
def auth(cls, *args, **kwargs): # -> Literal[False]:
...

@classmethod
def is_simple(cls): # -> Literal[True]:
...



29 changes: 29 additions & 0 deletions src/typings/netius/auth/dummy.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__author__ = ...
__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class DummyAuth(base.Auth):
def __init__(self, value=..., *args, **kwargs) -> None:
...

@classmethod
def auth(cls, value=..., *args, **kwargs): # -> bool:
...

@classmethod
def is_simple(cls): # -> Literal[True]:
...

def auth_i(self, *args, **kwargs): # -> bool:
...



36 changes: 36 additions & 0 deletions src/typings/netius/auth/memory.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
This type stub file was generated by pyright.
"""

from . import base

__version__ = ...
__revision__ = ...
__date__ = ...
__copyright__ = ...
__license__ = ...
class MemoryAuth(base.Auth):
def __init__(self, registry=..., *args, **kwargs) -> None:
...

@classmethod
def auth(cls, username, password, registry=..., *args, **kwargs): # -> bool:
...

@classmethod
def meta(cls, username, registry=..., *args, **kwargs): # -> dict[Any, Any]:
...

@classmethod
def get_registry(cls): # -> None:
...

@classmethod
def load_registry(cls):
...

def auth_i(self, username, password, *args, **kwargs): # -> bool:
...



Loading

0 comments on commit b498404

Please sign in to comment.