From b4984041e4482c8935b7911053c25599dce868ce Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 15:37:15 +0000 Subject: [PATCH 01/20] feat: typing using pyright --- src/typings/netius/__init__.pyi | 14 + src/typings/netius/adapters/__init__.pyi | 16 + src/typings/netius/adapters/base.pyi | 59 + src/typings/netius/adapters/fs.pyi | 36 + src/typings/netius/adapters/memory.pyi | 42 + src/typings/netius/adapters/mongo.pyi | 21 + src/typings/netius/adapters/null.pyi | 16 + src/typings/netius/auth/__init__.pyi | 19 + src/typings/netius/auth/address.pyi | 29 + src/typings/netius/auth/allow.pyi | 23 + src/typings/netius/auth/base.pyi | 22 + src/typings/netius/auth/deny.pyi | 23 + src/typings/netius/auth/dummy.pyi | 29 + src/typings/netius/auth/memory.pyi | 36 + src/typings/netius/auth/passwd.pyi | 29 + src/typings/netius/auth/simple.pyi | 24 + src/typings/netius/base/__init__.pyi | 30 + src/typings/netius/base/agent.pyi | 56 + src/typings/netius/base/async_neo.pyi | 127 +++ src/typings/netius/base/async_old.pyi | 180 ++++ src/typings/netius/base/asynchronous.pyi | 15 + src/typings/netius/base/client.pyi | 186 ++++ src/typings/netius/base/common.pyi | 1074 +++++++++++++++++++ src/typings/netius/base/compat.pyi | 162 +++ src/typings/netius/base/config.pyi | 78 ++ src/typings/netius/base/conn.pyi | 238 ++++ src/typings/netius/base/container.pyi | 85 ++ src/typings/netius/base/diag.pyi | 43 + src/typings/netius/base/errors.pyi | 143 +++ src/typings/netius/base/legacy.pyi | 240 +++++ src/typings/netius/base/log.pyi | 20 + src/typings/netius/base/observer.pyi | 42 + src/typings/netius/base/poll.pyi | 240 +++++ src/typings/netius/base/protocol.pyi | 152 +++ src/typings/netius/base/request.pyi | 48 + src/typings/netius/base/server.pyi | 153 +++ src/typings/netius/base/stream.pyi | 54 + src/typings/netius/base/tls.pyi | 25 + src/typings/netius/base/transport.pyi | 120 +++ src/typings/netius/base/util.pyi | 51 + src/typings/netius/clients/__init__.pyi | 21 + src/typings/netius/clients/apn.pyi | 59 + src/typings/netius/clients/dht.pyi | 86 ++ src/typings/netius/clients/dns.pyi | 141 +++ src/typings/netius/clients/http.pyi | 286 +++++ src/typings/netius/clients/mjpg.pyi | 49 + src/typings/netius/clients/raw.pyi | 42 + src/typings/netius/clients/smtp.pyi | 229 ++++ src/typings/netius/clients/ssdp.pyi | 54 + src/typings/netius/clients/torrent.pyi | 132 +++ src/typings/netius/clients/ws.pyi | 77 ++ src/typings/netius/common/__init__.pyi | 34 + src/typings/netius/common/asn.pyi | 66 ++ src/typings/netius/common/calc.pyi | 160 +++ src/typings/netius/common/dhcp.pyi | 62 ++ src/typings/netius/common/dkim.pyi | 42 + src/typings/netius/common/ftp.pyi | 34 + src/typings/netius/common/geo.pyi | 26 + src/typings/netius/common/http.pyi | 210 ++++ src/typings/netius/common/http2.pyi | 468 ++++++++ src/typings/netius/common/mime.pyi | 81 ++ src/typings/netius/common/parser.pyi | 41 + src/typings/netius/common/pop.pyi | 33 + src/typings/netius/common/rsa.pyi | 134 +++ src/typings/netius/common/setup.pyi | 21 + src/typings/netius/common/smtp.pyi | 34 + src/typings/netius/common/socks.pyi | 75 ++ src/typings/netius/common/stream.pyi | 79 ++ src/typings/netius/common/structures.pyi | 37 + src/typings/netius/common/style.pyi | 11 + src/typings/netius/common/tftp.pyi | 16 + src/typings/netius/common/tls.pyi | 40 + src/typings/netius/common/torrent.pyi | 67 ++ src/typings/netius/common/util.pyi | 181 ++++ src/typings/netius/common/ws.pyi | 19 + src/typings/netius/examples/__init__.pyi | 13 + src/typings/netius/examples/http.pyi | 16 + src/typings/netius/examples/upnp.pyi | 22 + src/typings/netius/extra/__init__.pyi | 20 + src/typings/netius/extra/desktop.pyi | 25 + src/typings/netius/extra/dhcp_s.pyi | 34 + src/typings/netius/extra/file.pyi | 63 ++ src/typings/netius/extra/filea.pyi | 38 + src/typings/netius/extra/hello.pyi | 38 + src/typings/netius/extra/hello_w.pyi | 17 + src/typings/netius/extra/proxy_d.pyi | 35 + src/typings/netius/extra/proxy_f.pyi | 29 + src/typings/netius/extra/proxy_r.pyi | 110 ++ src/typings/netius/extra/smtp_r.pyi | 53 + src/typings/netius/middleware/__init__.pyi | 17 + src/typings/netius/middleware/annoyer.pyi | 29 + src/typings/netius/middleware/base.pyi | 22 + src/typings/netius/middleware/blacklist.pyi | 31 + src/typings/netius/middleware/dummy.pyi | 29 + src/typings/netius/middleware/flood.pyi | 31 + src/typings/netius/middleware/proxy.pyi | 48 + src/typings/netius/mock/__init__.pyi | 11 + src/typings/netius/mock/appier.pyi | 17 + src/typings/netius/pool/__init__.pyi | 15 + src/typings/netius/pool/common.pyi | 171 +++ src/typings/netius/pool/file.pyi | 54 + src/typings/netius/pool/notify.pyi | 18 + src/typings/netius/pool/task.pyi | 28 + src/typings/netius/servers/__init__.pyi | 26 + src/typings/netius/servers/dhcp.pyi | 80 ++ src/typings/netius/servers/echo.pyi | 24 + src/typings/netius/servers/echo_ws.pyi | 22 + src/typings/netius/servers/ftp.pyi | 201 ++++ src/typings/netius/servers/http.pyi | 170 +++ src/typings/netius/servers/http2.pyi | 323 ++++++ src/typings/netius/servers/mjpg.pyi | 42 + src/typings/netius/servers/pop.pyi | 159 +++ src/typings/netius/servers/proxy.pyi | 93 ++ src/typings/netius/servers/smtp.pyi | 163 +++ src/typings/netius/servers/socks.pyi | 86 ++ src/typings/netius/servers/tftp.pyi | 99 ++ src/typings/netius/servers/torrent.pyi | 316 ++++++ src/typings/netius/servers/ws.pyi | 67 ++ src/typings/netius/servers/wsgi.pyi | 44 + src/typings/netius/sh/__init__.pyi | 11 + src/typings/netius/sh/base.pyi | 13 + src/typings/netius/sh/dkim.pyi | 20 + src/typings/netius/sh/rsa.pyi | 23 + src/typings/netius/sh/smtp.pyi | 17 + src/typings/netius/test/__init__.pyi | 9 + 125 files changed, 10189 insertions(+) create mode 100644 src/typings/netius/__init__.pyi create mode 100644 src/typings/netius/adapters/__init__.pyi create mode 100644 src/typings/netius/adapters/base.pyi create mode 100644 src/typings/netius/adapters/fs.pyi create mode 100644 src/typings/netius/adapters/memory.pyi create mode 100644 src/typings/netius/adapters/mongo.pyi create mode 100644 src/typings/netius/adapters/null.pyi create mode 100644 src/typings/netius/auth/__init__.pyi create mode 100644 src/typings/netius/auth/address.pyi create mode 100644 src/typings/netius/auth/allow.pyi create mode 100644 src/typings/netius/auth/base.pyi create mode 100644 src/typings/netius/auth/deny.pyi create mode 100644 src/typings/netius/auth/dummy.pyi create mode 100644 src/typings/netius/auth/memory.pyi create mode 100644 src/typings/netius/auth/passwd.pyi create mode 100644 src/typings/netius/auth/simple.pyi create mode 100644 src/typings/netius/base/__init__.pyi create mode 100644 src/typings/netius/base/agent.pyi create mode 100644 src/typings/netius/base/async_neo.pyi create mode 100644 src/typings/netius/base/async_old.pyi create mode 100644 src/typings/netius/base/asynchronous.pyi create mode 100644 src/typings/netius/base/client.pyi create mode 100644 src/typings/netius/base/common.pyi create mode 100644 src/typings/netius/base/compat.pyi create mode 100644 src/typings/netius/base/config.pyi create mode 100644 src/typings/netius/base/conn.pyi create mode 100644 src/typings/netius/base/container.pyi create mode 100644 src/typings/netius/base/diag.pyi create mode 100644 src/typings/netius/base/errors.pyi create mode 100644 src/typings/netius/base/legacy.pyi create mode 100644 src/typings/netius/base/log.pyi create mode 100644 src/typings/netius/base/observer.pyi create mode 100644 src/typings/netius/base/poll.pyi create mode 100644 src/typings/netius/base/protocol.pyi create mode 100644 src/typings/netius/base/request.pyi create mode 100644 src/typings/netius/base/server.pyi create mode 100644 src/typings/netius/base/stream.pyi create mode 100644 src/typings/netius/base/tls.pyi create mode 100644 src/typings/netius/base/transport.pyi create mode 100644 src/typings/netius/base/util.pyi create mode 100644 src/typings/netius/clients/__init__.pyi create mode 100644 src/typings/netius/clients/apn.pyi create mode 100644 src/typings/netius/clients/dht.pyi create mode 100644 src/typings/netius/clients/dns.pyi create mode 100644 src/typings/netius/clients/http.pyi create mode 100644 src/typings/netius/clients/mjpg.pyi create mode 100644 src/typings/netius/clients/raw.pyi create mode 100644 src/typings/netius/clients/smtp.pyi create mode 100644 src/typings/netius/clients/ssdp.pyi create mode 100644 src/typings/netius/clients/torrent.pyi create mode 100644 src/typings/netius/clients/ws.pyi create mode 100644 src/typings/netius/common/__init__.pyi create mode 100644 src/typings/netius/common/asn.pyi create mode 100644 src/typings/netius/common/calc.pyi create mode 100644 src/typings/netius/common/dhcp.pyi create mode 100644 src/typings/netius/common/dkim.pyi create mode 100644 src/typings/netius/common/ftp.pyi create mode 100644 src/typings/netius/common/geo.pyi create mode 100644 src/typings/netius/common/http.pyi create mode 100644 src/typings/netius/common/http2.pyi create mode 100644 src/typings/netius/common/mime.pyi create mode 100644 src/typings/netius/common/parser.pyi create mode 100644 src/typings/netius/common/pop.pyi create mode 100644 src/typings/netius/common/rsa.pyi create mode 100644 src/typings/netius/common/setup.pyi create mode 100644 src/typings/netius/common/smtp.pyi create mode 100644 src/typings/netius/common/socks.pyi create mode 100644 src/typings/netius/common/stream.pyi create mode 100644 src/typings/netius/common/structures.pyi create mode 100644 src/typings/netius/common/style.pyi create mode 100644 src/typings/netius/common/tftp.pyi create mode 100644 src/typings/netius/common/tls.pyi create mode 100644 src/typings/netius/common/torrent.pyi create mode 100644 src/typings/netius/common/util.pyi create mode 100644 src/typings/netius/common/ws.pyi create mode 100644 src/typings/netius/examples/__init__.pyi create mode 100644 src/typings/netius/examples/http.pyi create mode 100644 src/typings/netius/examples/upnp.pyi create mode 100644 src/typings/netius/extra/__init__.pyi create mode 100644 src/typings/netius/extra/desktop.pyi create mode 100644 src/typings/netius/extra/dhcp_s.pyi create mode 100644 src/typings/netius/extra/file.pyi create mode 100644 src/typings/netius/extra/filea.pyi create mode 100644 src/typings/netius/extra/hello.pyi create mode 100644 src/typings/netius/extra/hello_w.pyi create mode 100644 src/typings/netius/extra/proxy_d.pyi create mode 100644 src/typings/netius/extra/proxy_f.pyi create mode 100644 src/typings/netius/extra/proxy_r.pyi create mode 100644 src/typings/netius/extra/smtp_r.pyi create mode 100644 src/typings/netius/middleware/__init__.pyi create mode 100644 src/typings/netius/middleware/annoyer.pyi create mode 100644 src/typings/netius/middleware/base.pyi create mode 100644 src/typings/netius/middleware/blacklist.pyi create mode 100644 src/typings/netius/middleware/dummy.pyi create mode 100644 src/typings/netius/middleware/flood.pyi create mode 100644 src/typings/netius/middleware/proxy.pyi create mode 100644 src/typings/netius/mock/__init__.pyi create mode 100644 src/typings/netius/mock/appier.pyi create mode 100644 src/typings/netius/pool/__init__.pyi create mode 100644 src/typings/netius/pool/common.pyi create mode 100644 src/typings/netius/pool/file.pyi create mode 100644 src/typings/netius/pool/notify.pyi create mode 100644 src/typings/netius/pool/task.pyi create mode 100644 src/typings/netius/servers/__init__.pyi create mode 100644 src/typings/netius/servers/dhcp.pyi create mode 100644 src/typings/netius/servers/echo.pyi create mode 100644 src/typings/netius/servers/echo_ws.pyi create mode 100644 src/typings/netius/servers/ftp.pyi create mode 100644 src/typings/netius/servers/http.pyi create mode 100644 src/typings/netius/servers/http2.pyi create mode 100644 src/typings/netius/servers/mjpg.pyi create mode 100644 src/typings/netius/servers/pop.pyi create mode 100644 src/typings/netius/servers/proxy.pyi create mode 100644 src/typings/netius/servers/smtp.pyi create mode 100644 src/typings/netius/servers/socks.pyi create mode 100644 src/typings/netius/servers/tftp.pyi create mode 100644 src/typings/netius/servers/torrent.pyi create mode 100644 src/typings/netius/servers/ws.pyi create mode 100644 src/typings/netius/servers/wsgi.pyi create mode 100644 src/typings/netius/sh/__init__.pyi create mode 100644 src/typings/netius/sh/base.pyi create mode 100644 src/typings/netius/sh/dkim.pyi create mode 100644 src/typings/netius/sh/rsa.pyi create mode 100644 src/typings/netius/sh/smtp.pyi create mode 100644 src/typings/netius/test/__init__.pyi diff --git a/src/typings/netius/__init__.pyi b/src/typings/netius/__init__.pyi new file mode 100644 index 00000000..ee6f3bdb --- /dev/null +++ b/src/typings/netius/__init__.pyi @@ -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__ = ... diff --git a/src/typings/netius/adapters/__init__.pyi b/src/typings/netius/adapters/__init__.pyi new file mode 100644 index 00000000..91af2c13 --- /dev/null +++ b/src/typings/netius/adapters/__init__.pyi @@ -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__ = ... diff --git a/src/typings/netius/adapters/base.pyi b/src/typings/netius/adapters/base.pyi new file mode 100644 index 00000000..26ff92cc --- /dev/null +++ b/src/typings/netius/adapters/base.pyi @@ -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: + ... + + + diff --git a/src/typings/netius/adapters/fs.pyi b/src/typings/netius/adapters/fs.pyi new file mode 100644 index 00000000..09f12125 --- /dev/null +++ b/src/typings/netius/adapters/fs.pyi @@ -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]: + ... + + + diff --git a/src/typings/netius/adapters/memory.pyi b/src/typings/netius/adapters/memory.pyi new file mode 100644 index 00000000..1016feee --- /dev/null +++ b/src/typings/netius/adapters/memory.pyi @@ -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]: + ... + + + diff --git a/src/typings/netius/adapters/mongo.pyi b/src/typings/netius/adapters/mongo.pyi new file mode 100644 index 00000000..d8b5e2a5 --- /dev/null +++ b/src/typings/netius/adapters/mongo.pyi @@ -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: + ... + + + diff --git a/src/typings/netius/adapters/null.pyi b/src/typings/netius/adapters/null.pyi new file mode 100644 index 00000000..5de62e41 --- /dev/null +++ b/src/typings/netius/adapters/null.pyi @@ -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): + ... + + diff --git a/src/typings/netius/auth/__init__.pyi b/src/typings/netius/auth/__init__.pyi new file mode 100644 index 00000000..bf8e7198 --- /dev/null +++ b/src/typings/netius/auth/__init__.pyi @@ -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__ = ... diff --git a/src/typings/netius/auth/address.pyi b/src/typings/netius/auth/address.pyi new file mode 100644 index 00000000..2358742f --- /dev/null +++ b/src/typings/netius/auth/address.pyi @@ -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: + ... + + + diff --git a/src/typings/netius/auth/allow.pyi b/src/typings/netius/auth/allow.pyi new file mode 100644 index 00000000..3ddc63de --- /dev/null +++ b/src/typings/netius/auth/allow.pyi @@ -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]: + ... + + + diff --git a/src/typings/netius/auth/base.pyi b/src/typings/netius/auth/base.pyi new file mode 100644 index 00000000..b1e490a8 --- /dev/null +++ b/src/typings/netius/auth/base.pyi @@ -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]: + ... + + + diff --git a/src/typings/netius/auth/deny.pyi b/src/typings/netius/auth/deny.pyi new file mode 100644 index 00000000..1a976c25 --- /dev/null +++ b/src/typings/netius/auth/deny.pyi @@ -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]: + ... + + + diff --git a/src/typings/netius/auth/dummy.pyi b/src/typings/netius/auth/dummy.pyi new file mode 100644 index 00000000..8e9f3cb8 --- /dev/null +++ b/src/typings/netius/auth/dummy.pyi @@ -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: + ... + + + diff --git a/src/typings/netius/auth/memory.pyi b/src/typings/netius/auth/memory.pyi new file mode 100644 index 00000000..c94fc855 --- /dev/null +++ b/src/typings/netius/auth/memory.pyi @@ -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: + ... + + + diff --git a/src/typings/netius/auth/passwd.pyi b/src/typings/netius/auth/passwd.pyi new file mode 100644 index 00000000..83680704 --- /dev/null +++ b/src/typings/netius/auth/passwd.pyi @@ -0,0 +1,29 @@ +""" +This type stub file was generated by pyright. +""" + +from . import base + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class PasswdAuth(base.Auth): + def __init__(self, path=..., *args, **kwargs) -> None: + ... + + @classmethod + def auth(cls, username, password, path=..., *args, **kwargs): # -> bool: + ... + + @classmethod + def get_passwd(cls, path, cache=...): # -> dict[Any, Any]: + ... + + def auth_i(self, username, password, *args, **kwargs): # -> bool: + ... + + + diff --git a/src/typings/netius/auth/simple.pyi b/src/typings/netius/auth/simple.pyi new file mode 100644 index 00000000..60b450ff --- /dev/null +++ b/src/typings/netius/auth/simple.pyi @@ -0,0 +1,24 @@ +""" +This type stub file was generated by pyright. +""" + +from . import base + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class SimpleAuth(base.Auth): + def __init__(self, username=..., password=..., *args, **kwargs) -> None: + ... + + @classmethod + def auth(cls, username, password, target=..., *args, **kwargs): # -> bool: + ... + + def auth_i(self, username, password, *args, **kwargs): # -> bool: + ... + + + diff --git a/src/typings/netius/base/__init__.pyi b/src/typings/netius/base/__init__.pyi new file mode 100644 index 00000000..9636e772 --- /dev/null +++ b/src/typings/netius/base/__init__.pyi @@ -0,0 +1,30 @@ +""" +This type stub file was generated by pyright. +""" + +from . import agent, asynchronous, client, common, compat, config, conn, container, errors, legacy, log, observer, poll, protocol, request, server, stream, tls, transport, util +from .agent import Agent, ClientAgent, ServerAgent +from .asynchronous import Executor, Future, Handle, Task, ThreadPoolExecutor, async_test, async_test_all, coroutine, coroutine_return, ensure_generator, get_asyncio, is_asynclib, is_await, is_coroutine, is_coroutine_native, is_coroutine_object, is_future, is_neo, notify, sleep, wait, wakeup +from .client import Client, DatagramClient, StreamClient +from .common import Base, BaseThread, IDENTIFIER, IDENTIFIER_LONG, IDENTIFIER_SHORT, NAME, SSL_CA_PATH, SSL_CER_PATH, SSL_DH_PATH, SSL_KEY_PATH, TCP_TYPE, UDP_TYPE, VERSION, build_future, compat_loop, ensure, ensure_asyncio, ensure_loop, ensure_main, ensure_pool, get_event_loop, get_loop, get_main, get_poll, new_loop, new_loop_asyncio, new_loop_main, stop_loop +from .compat import BaseLoop, CompatLoop, build_datagram, connect_stream, is_asyncio, is_compat +from .config import conf, conf_ctx, conf_d, conf_prefix, conf_r, conf_s, conf_suffix +from .conn import CHUNK_SIZE, CLOSED, Connection, OPEN, PENDING +from .container import Container, ContainerServer +from .errors import AssertionError, DataError, GeneratorError, NetiusError, NotImplemented, ParserError, PauseError, RuntimeError, SecurityError, StopError, WakeupError +from .log import SILENT, rotating_handler, smtp_handler +from .observer import Observable +from .poll import EpollPoll, KqueuePoll, Poll, PollPoll, SelectPoll +from .protocol import DatagramProtocol, Protocol, StreamProtocol +from .request import Request, Response +from .server import DatagramServer, Server, StreamServer +from .stream import Stream +from .tls import dnsname_match, dump_certificate, fingerprint, match_fingerprint, match_hostname +from .transport import Transport, TransportDatagram, TransportStream +from .util import camel_to_underscore, verify + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/base/agent.pyi b/src/typings/netius/base/agent.pyi new file mode 100644 index 00000000..0e891ed0 --- /dev/null +++ b/src/typings/netius/base/agent.pyi @@ -0,0 +1,56 @@ +""" +This type stub file was generated by pyright. +""" + +from . import observer + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Agent(observer.Observable): + """ + Top level class for the entry point classes of the multiple + client and server protocol implementations. + + These classes should contain a series of utilities that facilitate + the interaction with the Protocol, Event Loop and Transport + objects (with the end developer in mind). + + Most of the interaction for a simple protocol should be implemented + using static or class methods, avoiding internal object state and + instantiation of the concrete Agent class. + + For complex protocols instantiation may be useful to provided extra + flexibility and context for abstract operations. + """ + @classmethod + def cleanup_s(cls): # -> None: + ... + + def cleanup(self, destroy=...): # -> None: + ... + + def destroy(self): # -> None: + ... + + + +class ClientAgent(Agent): + _clients = ... + @classmethod + def cleanup_s(cls): # -> None: + ... + + @classmethod + def get_client_s(cls, *args, **kwargs): # -> Self: + ... + + + +class ServerAgent(Agent): + ... + + diff --git a/src/typings/netius/base/async_neo.pyi b/src/typings/netius/base/async_neo.pyi new file mode 100644 index 00000000..677ebfc1 --- /dev/null +++ b/src/typings/netius/base/async_neo.pyi @@ -0,0 +1,127 @@ +""" +This type stub file was generated by pyright. +""" + +from . import async_old + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Future(async_old.Future): + """ + Specialized Future class that supports the async/await + syntax to be used in a future, so that it becomes compliant + with the basic Python asyncio strategy for futures. + + Using this future it should be possible to ``await Future()` + for a simpler usage. + """ + def __iter__(self): # -> Generator[Self, Any, Any | None]: + ... + + def __await__(self): # -> Generator[Self, Any, Any | None]: + ... + + + +class AwaitWrapper: + """ + Wrapper class meant to be used to encapsulate "old" + generator based objects as async generator objects that + are eligible to be used with the async/await syntax. + + It's also possible to pass simple values instead of + generator functions and still use the wrapper. + """ + _is_generator = ... + def __init__(self, generator, generate=...) -> None: + ... + + def __await__(self): # -> Generator[Any, Any, Any | None] | Generator[None, Any, Generator[Any, Any, None] | Any]: + ... + + def __iter__(self): # -> Self: + ... + + def __next__(self): + ... + + def next(self): + ... + + def generate(self, value): # -> Generator[Any, Any, None]: + ... + + + +class CoroutineWrapper: + """ + Wrapper class meant to encapsulate a coroutine object + as a standard iterator sequence to be used in chain/iterator + like execution environment. + + This is only required for the native coroutine objects + so that they can comply with the required netius interface. + """ + def __init__(self, coroutine) -> None: + ... + + def __iter__(self): # -> Self: + ... + + def __next__(self): + ... + + def next(self): + ... + + def restore(self, value): # -> None: + ... + + + +def coroutine(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], AwaitWrapper]: + ... + +def ensure_generator(value): # -> tuple[Literal[True], Any] | tuple[Literal[True], CoroutineWrapper] | tuple[Literal[False], Any]: + ... + +def get_asyncio(): # -> Any | None: + ... + +def is_coroutine(callable): # -> bool: + ... + +def is_coroutine_object(generator): # -> bool: + ... + +def is_coroutine_native(generator): # -> bool: + ... + +def is_future(future): # -> bool: + ... + +def sleep(*args, **kwargs): # -> AwaitWrapper: + ... + +def wait(*args, **kwargs): # -> AwaitWrapper: + ... + +def coroutine_return(coroutine): # -> AwaitWrapper: + """ + Allows for the abstraction of the return value of a coroutine + object to be the result of the future yield as the first element + of the generator. + + This allows the possibility to provide compatibility with the legacy + not return allowed generators. + + :type coroutine: CoroutineObject + :param coroutine: The coroutine object that is going to be yield back + and have its last future result returned from the generator. + """ + ... + diff --git a/src/typings/netius/base/async_old.pyi b/src/typings/netius/base/async_old.pyi new file mode 100644 index 00000000..2f8242fd --- /dev/null +++ b/src/typings/netius/base/async_old.pyi @@ -0,0 +1,180 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Future: + """ + Base future object that represents a promise that a certain + operation is going to be accomplished. + + Should be used as a placeholder for the callbacks for error + and success and the for the final result of the execution. + + Most of the implementation takes inspiration on the reference + Python implementation on futures. + + :see: https://en.wikipedia.org/wiki/Futures_and_promises + """ + def __init__(self, loop=...) -> None: + ... + + def __iter__(self): # -> Generator[Self, Any, None]: + ... + + def cleanup(self): # -> None: + ... + + def running(self): # -> bool: + ... + + def done(self): # -> bool: + ... + + def cancelled(self): # -> bool: + ... + + def finished(self): # -> bool: + ... + + def result(self): # -> None: + ... + + def exception(self, timeout=...): # -> None: + ... + + def partial(self, value): # -> None: + ... + + def add_done_callback(self, function): # -> None: + ... + + def add_partial_callback(self, function): # -> None: + ... + + def add_ready_callback(self, function): # -> None: + ... + + def add_closed_callback(self, function): # -> None: + ... + + def approve(self, cleanup=...): # -> None: + ... + + def cancel(self, cleanup=..., force=...): # -> bool: + ... + + def set_result(self, result, cleanup=..., force=...): # -> None: + ... + + def set_exception(self, exception, cleanup=..., force=...): # -> None: + ... + + @property + def ready(self): # -> Literal[True]: + ... + + @property + def closed(self): # -> Literal[False]: + ... + + + +class Task(Future): + def __init__(self, future=...) -> None: + ... + + + +class Handle: + def __init__(self, callable_t=...) -> None: + ... + + def cancel(self): # -> None: + ... + + + +class Executor: + def submit(self, callable, *args, **kwargs): + ... + + + +class ThreadPoolExecutor(Executor): + def __init__(self, owner) -> None: + ... + + def submit(self, callable, *args, **kwargs): + ... + + + +def coroutine(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], Generator[Any, Any, None]]: + ... + +def async_test_all(factory=..., close=...): # -> Callable[..., _Wrapped[Callable[..., Any], Any, Callable[..., Any], Any]]: + ... + +def async_test(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], Any]: + ... + +def ensure_generator(value): # -> tuple[Literal[True], Any] | tuple[Literal[False], Any]: + ... + +def get_asyncio(): # -> None: + ... + +def is_coroutine(callable): # -> bool: + ... + +def is_coroutine_object(generator): # -> bool: + ... + +def is_coroutine_native(generator): # -> Literal[False]: + ... + +def is_future(future): # -> bool: + ... + +def is_neo(): # -> bool: + ... + +def is_asynclib(): # -> bool: + ... + +def is_await(): # -> bool: + ... + +def wakeup(force=...): + ... + +def sleep(timeout, compat=..., future=...): # -> Generator[Any, Any, None]: + ... + +def wait(event, timeout=..., future=...): # -> Generator[Any, Any, None]: + ... + +def notify(event, data=...): + ... + +def coroutine_return(coroutine): # -> Generator[Any, Any, None]: + """ + Allows for the abstraction of the return value of a coroutine + object to be the result of the future yield as the first element + of the generator. + + This allows the possibility to provide compatibility with the legacy + not return allowed generators. + + :type coroutine: CoroutineObject + :param coroutine: The coroutine object that is going to be yield back + and have its last future result returned from the generator. + """ + ... + diff --git a/src/typings/netius/base/asynchronous.pyi b/src/typings/netius/base/asynchronous.pyi new file mode 100644 index 00000000..37db4196 --- /dev/null +++ b/src/typings/netius/base/asynchronous.pyi @@ -0,0 +1,15 @@ +""" +This type stub file was generated by pyright. +""" + +from .async_old import * +from .async_neo import * + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +if is_neo(): + ... diff --git a/src/typings/netius/base/client.pyi b/src/typings/netius/base/client.pyi new file mode 100644 index 00000000..ad5fa124 --- /dev/null +++ b/src/typings/netius/base/client.pyi @@ -0,0 +1,186 @@ +""" +This type stub file was generated by pyright. +""" + +from .conn import * +from .common import * + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_SIZE = ... +GC_TIMEOUT = ... +class Client(Base): + """ + Abstract client implementation, should provide the required + mechanisms for basic socket client handling and thread starting + and managing techniques. Proper and concrete implementation for + the various socket types should inherit from this class. + """ + _client = ... + def __init__(self, thread=..., daemon=..., *args, **kwargs) -> None: + ... + + @classmethod + def get_client_s(cls, *args, **kwargs): # -> Self: + ... + + @classmethod + def cleanup_s(cls): # -> None: + ... + + def ensure_loop(self, env=...): # -> None: + """ + Ensures that the proper main loop thread requested in the building + of the entity is started if that was requested. + + This mechanism is required because the thread construction and + starting should be deferred until an operation in the connection + is requested (lazy thread construction). + + The call to this method should be properly inserted on the code so + that it is only called when a main (polling) loop is required. + + :type env: bool + :param env: If the environment variables should be used for the + setting of some of the parameters of the new client/poll to be used. + """ + ... + + def join(self, timeout=...): # -> None: + ... + + + +class DatagramClient(Client): + def __init__(self, *args, **kwargs) -> None: + ... + + def boot(self): # -> None: + ... + + def cleanup(self): # -> None: + ... + + def on_read(self, _socket): # -> None: + ... + + def on_write(self, _socket): # -> None: + ... + + def on_error(self, _socket): # -> None: + ... + + def on_exception(self, exception): # -> None: + ... + + def on_expected(self, exception): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def keep_gc(self, timeout=..., run=...): # -> None: + ... + + def gc(self, callbacks=...): # -> None: + ... + + def add_request(self, request): # -> None: + ... + + def remove_request(self, request): # -> None: + ... + + def get_request(self, id): + ... + + def ensure_socket(self): # -> None: + ... + + def ensure_write(self): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: + ... + + def remove_write(self): # -> None: + ... + + def enable_read(self): # -> None: + ... + + def disable_read(self): # -> None: + ... + + def send(self, data, address, delay=..., ensure_loop=..., callback=...): # -> None: + ... + + + +class StreamClient(Client): + def __init__(self, *args, **kwargs) -> None: + ... + + def cleanup(self): # -> None: + ... + + def ticks(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def acquire_c(self, host, port, ssl=..., key_file=..., cer_file=..., validate=..., callback=...): + ... + + def release_c(self, connection): # -> None: + ... + + def remove_c(self, connection): # -> None: + ... + + def validate_c(self, connection, close=...): + ... + + def connect(self, host, port, ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=..., ensure_loop=..., env=...): + ... + + def acquire(self, connection): # -> None: + ... + + def on_read(self, _socket): + ... + + def on_write(self, _socket): # -> None: + ... + + def on_error(self, _socket): # -> None: + ... + + def on_exception(self, exception, connection): # -> None: + ... + + def on_expected(self, exception, connection): # -> None: + ... + + def on_connect(self, connection): # -> None: + ... + + def on_upgrade(self, connection): # -> None: + ... + + def on_ssl(self, connection): # -> None: + ... + + def on_acquire(self, connection): # -> None: + ... + + def on_release(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + + diff --git a/src/typings/netius/base/common.pyi b/src/typings/netius/base/common.pyi new file mode 100644 index 00000000..772cba5e --- /dev/null +++ b/src/typings/netius/base/common.pyi @@ -0,0 +1,1074 @@ +""" +This type stub file was generated by pyright. +""" + +import os +from .conn import * +from .poll import * +from .asynchronous import * + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +NAME = ... +VERSION = ... +PLATFORM = ... +IDENTIFIER_TINY = ... +IDENTIFIER_SHORT = ... +IDENTIFIER_LONG = ... +IDENTIFIER = ... +WSAEWOULDBLOCK = ... +WSAECONNABORTED = ... +WSAECONNRESET = ... +SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE = ... +POLL_ORDER = ... +SILENT_ERRORS = ... +VALID_ERRORS = ... +SSL_SILENT_ERRORS = ... +SSL_VALID_ERRORS = ... +SSL_ERROR_NAMES = ... +SSL_VALID_REASONS = ... +TCP_TYPE = ... +UDP_TYPE = ... +STATE_STOP = ... +STATE_START = ... +STATE_PAUSE = ... +STATE_CONFIG = ... +STATE_POLL = ... +STATE_TICK = ... +STATE_READ = ... +STATE_WRITE = ... +STATE_ERRROR = ... +STATE_STRINGS = ... +KEEPALIVE_TIMEOUT = ... +KEEPALIVE_INTERVAL = ... +KEEPALIVE_COUNT = ... +ALLOW_BLOCK = ... +LOG_FORMAT = ... +BASE_PATH = ... +EXTRAS_PATH = ... +SSL_KEY_PATH = ... +SSL_CER_PATH = ... +SSL_CA_PATH = ... +SSL_DH_PATH = ... +if not os.path.exists(SSL_CA_PATH): + SSL_CA_PATH = ... +if not os.path.exists(SSL_DH_PATH): + SSL_DH_PATH = ... +class AbstractBase(observer.Observable): + """ + Base network structure to be used by all the network + capable infra-structures (eg: servers and clients). + + Should handle all the non blocking event loop stuff, + so that the read and write operations are easy to handle. + + This is considered to be the main event loop code. + """ + _MAIN = ... + _MAIN_C = ... + def __init__(self, name=..., handlers=..., *args, **kwargs) -> None: + ... + + @classmethod + def test_poll(cls, preferred=...): # -> type[EpollPoll] | type[KqueuePoll] | type[PollPoll] | type[SelectPoll]: + ... + + @classmethod + def get_loop(cls, compat=..., asyncio=...): # -> AbstractEventLoop | None: + ... + + @classmethod + def get_main(cls, compat=...): # -> None: + ... + + @classmethod + def get_asyncio(cls): # -> AbstractEventLoop | None: + ... + + @classmethod + def set_main(cls, instance, set_compat=...): # -> None: + ... + + @classmethod + def unset_main(cls, set_compat=...): # -> None: + ... + + @classmethod + def patch_asyncio(cls): # -> None: + ... + + @classmethod + def waitpid(cls, pid): # -> None: + ... + + def destroy(self): # -> None: + ... + + def call_safe(self, callable, args=..., kwargs=...): # -> None: + """ + Calls the provided callable object using a safe strategy + meaning that in case there's an exception raised in the + middle of the callable execution it is going to be caught + and the details of it logged. + + :type callable: Function + :param callable: The callable function that is going to + be called using the safe approach. + :type args: List + :param args: The normal (non keyword) arguments to be sent + to the callable. + :type kwargs: Dictionary + :param kwargs: The set of keyword arguments that are going + to be sent to the callable. + :rtype: Object + :return: The result of the calling of the callable. + """ + ... + + def wait_event(self, callable, name=...): # -> None: + ... + + def unwait_event(self, callable, name=...): # -> None: + ... + + def delay(self, callable, timeout=..., immediately=..., verify=..., safe=...): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: + ... + + def delay_s(self, callable, timeout=..., immediately=..., verify=..., wakeup=...): # -> None: + """ + Safe version of the delay operation to be used to insert a callable + from a different thread (implies lock mechanisms). + + This method should only be used from different threads as there's + a huge performance impact created from using this method instead of + the local event loop one (delay()). + + :type callable: Function + :param callable: The callable that should be called on the next tick + according to the event loop rules. + :type timeout: int + :param timeout: The timeout for the callable to be called, this value + may not reflect an accurate value and depends greatly on the minimum + resolution value of the polling mechanism. + :type immediately: bool + :param immediately: If the callable should be called as soon as possible, + this is equivalent to setting timeout to -1. + :type verify: bool + :param verify: If the delayed sequences should be verified for possible + duplicated, avoiding possible issues. + :type wakeup: bool + :param wakeup: If the main event loop should be awaken so that the + callable is processed as soon as possible. + """ + ... + + def delay_m(self): # -> None: + """ + Runs the merge operation so that the delay next list (used by the delay + safe operation) is merged with the delayed and the delayed ordered + structures, making the events (effectively) ready to be executed by delays. + """ + ... + + def ensure(self, coroutine, args=..., kwargs=..., thread=..., future=..., immediately=...): # -> Future: + """ + Main method for the queuing/startup of an asynchronous coroutine + of async method, this should be called at the most higher level + of the execution of a chained coroutine sequence. + + It should ensure that the provided callable is wrapped into a + coroutine if that's the case, so that chained calling is not + violated by a non compliant element. + + The method should create a proper sequence/pipelined handling of + the various chained coroutine calls so that they are called one + after the other using futures for such handling. The final "simple" + abstraction should expose one "parent" future object as the interface. + + Multiple calls to this method should generate different async + contexts (with different parent future instances). + + :type coroutine: Coroutine/CoroutineObject/Callable + :param coroutine: The callable or coroutine that is going to be + "inserted" for an asynchronous execution, if a callable is provided + a coroutine is created wrapping the execution of such callable. + :type args: List + :param args: The list of "normal" arguments to be sent to the + coroutine as parts of its signature. + :type kwargs: Dictionary + :param kwargs: The keyword arguments to be sent to the coroutine. + :type thread: bool + :param thread: If the execution of the coroutine should be done + using a different thread (via thread pool), this may be interesting + if the coroutine includes blocking i/o calls. + :type future: Future + :param future: If provided ensures that non new future object is going + to be created for this async context to be created. + :type immediately: bool + :param immediately: If the callback should be scheduler in the event + pool to be executed immediately (as soon as possible). + :rtype: Future + :return: The future that has been created for this new async context + or the provided one if one was provided (this is considered to be the + parent future of the complete coroutine chain). + """ + ... + + def resolve_hostname(self, hostname, type=...): # -> Future: + """ + Resolve the provided hostname according to the provided type + resolution. The resolution process itself is asynchronous and + implementation independent, returning a future for the control + of the execution. + + :type hostname: String + :param hostname: The name of the host to be resolved. + :type type: String + :param type: The type of resolutions to be used (eg: a, aaaa, mx, etc.) + :rtype: Future + :return: The future to be used in the operation execution. + """ + ... + + def run_forever(self): # -> None: + ... + + def run_coroutine(self, coroutine, args=..., kwargs=..., thread=..., close=...): # -> None: + ... + + def wakeup(self, force=...): # -> None: + ... + + def sleep(self, timeout, future=...): # -> Future: + ... + + def wait(self, event, timeout=..., future=...): # -> Future: + ... + + def notify(self, event, data=...): # -> None: + ... + + def load(self, full=...): # -> None: + """ + Starts the loading process for the current engine, this should be + a singleton (run once) operation to be executed once per instance. + + Some of the responsibilities of the loading process should include: + logging loading, system signal binding and welcome message printing. + + The method should be protected against double execution issues, meaning + that should be safely called at any stage of the life cycle. + + :type full: bool + :param full: If the loading process should be performed completely, + meaning that even the long tasks should be executed. + """ + ... + + def unload(self, full=...): # -> None: + """ + Unloads the structures associated with the current engine, so that + the state of the current engine is reversed to the original one. + + Note that this is not related in any way with the event loop and only + static structures are affected. + + After a call to this method, the load method may be called again. + + :type full: bool + :param full: If the complete set of structure unloading operations + should be performed, this is related with the full flag of load. + """ + ... + + def boot(self): # -> None: + ... + + def welcome(self): # -> None: + ... + + def load_logging(self, level=..., format=..., unique=...): # -> None: + ... + + def unload_logging(self, safe=...): # -> None: + ... + + def extra_logging(self, level, formatter): # -> None: + """ + Loads the complete set of logging handlers defined in the + current logging value, should be a map of definitions. + + This handlers will latter be used for piping the various + logging messages to certain output channels. + + The creation of the handler is done using a special keyword + arguments strategy so that python and configuration files + are properly set as compatible. + + :type level: String/int + :param level: The base severity level for which the new handler + will be configured in case no extra level definition is set. + :type formatter: Formatter + :param formatter: The logging formatter instance to be set in + the handler for formatting messages to the output. + """ + ... + + def level_logging(self, level): # -> None: + """ + Changes the verbosity level of the current logging infra-structure + into the provided level of verbosity. + + The provided value may be an integer (internal value) or a string + representation of the requested verbosity level. + + :type level: int/String + :param level: The (logging) for which the logging infra-structure + must be changed, either an integer or string value. + """ + ... + + def load_diag(self, env=...): # -> None: + ... + + def load_middleware(self, suffix=...): # -> None: + ... + + def unload_middleware(self): # -> None: + ... + + def register_middleware(self, middleware_c, *args, **kwargs): + ... + + def call_middleware(self, name, *args, **kwargs): # -> None: + ... + + def bind_signals(self, signals=..., handler=...): # -> None: + ... + + def unbind_signals(self, signals=...): # -> None: + ... + + def bind_env(self): # -> None: + """ + Binds the current environment values to the current instance. + This method has a global behaviour on the current event loop. + """ + ... + + def forever(self, env=...): # -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def pause(self): # -> None: + ... + + def resume(self): # -> None: + ... + + def close(self): # -> None: + ... + + def finish(self): # -> None: + ... + + def main(self): # -> None: + ... + + def is_main(self): # -> bool: + ... + + def is_running(self): # -> bool: + ... + + def is_started(self): + ... + + def is_stopped(self): + ... + + def is_paused(self): + ... + + def is_edge(self): # -> bool: + ... + + def is_empty(self): # -> bool: + ... + + def is_sub_read(self, socket): # -> bool: + ... + + def is_sub_write(self, socket): # -> bool: + ... + + def is_sub_error(self, socket): # -> bool: + ... + + def sub_all(self, socket): # -> None: + ... + + def unsub_all(self, socket): # -> None: + ... + + def sub_read(self, socket): # -> None: + ... + + def sub_write(self, socket): # -> None: + ... + + def sub_error(self, socket): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + def cleanup(self, destroy=...): # -> None: + ... + + def loop(self): # -> None: + ... + + def block(self): # -> None: + """ + Runs the sub-blocking operation, by "forking" the current loop + execution into an inner one for a new context. + + The execution of this method is not recommended and should be + used with extreme care to avoid unwanted behaviour. + """ + ... + + def fork(self, timeout=...): # -> bool: + ... + + def finalize(self): # -> None: + ... + + def ticks(self): # -> None: + ... + + def reads(self, reads, state=...): # -> None: + ... + + def writes(self, writes, state=...): # -> None: + ... + + def errors(self, errors, state=...): # -> None: + ... + + def datagram(self, family=..., type=..., local_host=..., local_port=..., remote_host=..., remote_port=..., callback=...): # -> BaseConnection: + """ + Builds a datagram based connection for the provided family and + type of socket, receiving an optional callback parameter to + be called once the "connection" object is ready to be used. + + :type family: int + :param family: The kind of socket family that is going to be + used in the creation of the datagram "connection". + :type type: int + :param type: Socket type (datagram, stream, etc.) to be used + for the creation of the datagram connection, in principle should + not be changed from the default value. + :type local_host: String + :param local_host: The locale host to be used in a possible bind + operation in the datagram so that the the socket listens to new + incoming datagrams on that host. + :type local_port: String + :param local_host: The local port to be used in a possible bind + operation in the datagram so that the the socket listens to new + incoming datagrams on that port. + :type remote_host: String + :param remote_host: The remote host to be used in a possible connect + (bind) operation in the datagram so that the default send operation + does not require explicit host setting. + :type remote_port: String + :param remote_port: The remote port to be used in a possible connect + (bind) operation in the datagram so that the default send operation + does not require explicit port setting. + :type callback: Function + :param callback: Callback function to be called once the datagram + connection is considered to be ready. + :rtype: Connection + :return: The datagram based connection that encapsulates the datagram + based connection logic. + """ + ... + + def connect(self, host, port, receive_buffer=..., send_buffer=..., ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=..., callback=..., env=...): + ... + + def acquire(self, connection): # -> None: + ... + + def pregister(self, pool): # -> None: + ... + + def punregister(self, pool): # -> None: + ... + + def pcallback(self, event, socket, pool): # -> None: + ... + + def nensure(self): # -> None: + ... + + def nstart(self): # -> None: + ... + + def nstop(self): # -> None: + ... + + def tensure(self): # -> None: + ... + + def tstart(self): # -> None: + ... + + def tstop(self): # -> None: + ... + + def texecute(self, callable, args=..., kwargs=..., callback=...): # -> None: + ... + + def files(self): # -> None: + ... + + def fopen(self, *args, **kwargs): # -> None: + ... + + def fclose(self, *args, **kwargs): # -> None: + ... + + def fread(self, *args, **kwargs): # -> None: + ... + + def fwrite(self, *args, **kwargs): # -> None: + ... + + def fensure(self): # -> None: + ... + + def fstart(self): # -> None: + ... + + def fstop(self): # -> None: + ... + + def on_connection_c(self, connection): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_stream_c(self, stream): # -> None: + ... + + def on_stream_d(self, stream): # -> None: + ... + + def on_fork(self): # -> None: + ... + + def on_join(self): # -> None: + ... + + def on_child(self, pipe=...): # -> None: + ... + + def on_command(self, command): # -> None: + ... + + def on_diag(self): # -> None: + ... + + def on_start(self): # -> None: + ... + + def on_stop(self): # -> None: + ... + + def on_pause(self): # -> None: + ... + + def on_resume(self): # -> None: + ... + + def on_read(self, _socket): + ... + + def on_write(self, _socket): # -> None: + ... + + def on_error(self, _socket): # -> None: + ... + + def on_exception(self, exception, connection): # -> None: + ... + + def on_expected(self, exception, connection): # -> None: + ... + + def on_connect(self, connection): # -> None: + ... + + def on_upgrade(self, connection): # -> None: + ... + + def on_client_ssl(self, connection): # -> None: + ... + + def on_acquire(self, connection): # -> None: + ... + + def on_acquire_base(self, connection): # -> None: + ... + + def on_release(self, connection): # -> None: + ... + + def on_release_base(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_data_base(self, connection, data): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def info_string(self, full=..., safe=...): # -> str: + ... + + def connections_dict(self, full=...): # -> list[Any]: + ... + + def connection_dict(self, id, full=...): # -> None: + ... + + def build_connection(self, socket, address=..., datagram=..., ssl=...): # -> BaseConnection: + """ + Creates a new connection for the provided socket + object and string based address, the returned + value should be a workable object. + + :type socket: Socket + :param socket: The socket object to be encapsulated + by the object to be created (connection). + :type address: String + :param address: The address as a string to be used to + describe the connection object to be created. + :type datagram: bool + :param datagram: If the connection to be created should + be datagram based or not. + :type ssl: bool + :param ssl: If the connection to be created is meant to + be secured using the SSL framework for encryption. + :rtype: Connection + :return: The connection object that encapsulates the + provided socket and address values. + """ + ... + + def base_connection(self, *args, **kwargs): # -> BaseConnection: + ... + + def new_connection(self, connection): # -> None: + ... + + def del_connection(self, connection): # -> None: + ... + + def add_callback(self, socket, callback): # -> None: + ... + + def remove_callback(self, socket, callback): # -> None: + ... + + def load_config(self, path=..., **kwargs): # -> None: + ... + + def apply_config(self, path, kwargs): + ... + + def exec_safe(self, connection, callable, *args, **kwargs): # -> Literal[False]: + ... + + def is_devel(self): # -> bool: + """ + Verifies if the current running environment is meant to be used + for development purposes as opposed to a production environment. + + The method should always be used in situations where some critical + and internal information is meant to be displayed in a development + environment but hidden in a production one. + + This method should be used at runtime as opposed to the private + configuration based one. + + :rtype: bool + :return: If the current environment is development oriented or + if it's considered to be a production one (invalid result). + """ + ... + + def is_debug(self): # -> bool: + ... + + def is_info(self): # -> bool: + ... + + def is_warning(self): # -> bool: + ... + + def is_error(self): # -> bool: + ... + + def is_critical(self): # -> bool: + ... + + def debug(self, object): # -> None: + ... + + def info(self, object): # -> None: + ... + + def warning(self, object): # -> None: + ... + + def error(self, object): # -> None: + ... + + def critical(self, object): # -> None: + ... + + def log_stack(self, method=..., info=...): # -> None: + ... + + def log_info(self, method=...): # -> None: + ... + + def log(self, *args, **kwargs): # -> None: + ... + + def log_python_3(self, object, level=...): # -> None: + ... + + def log_python_2(self, object, level=...): # -> None: + ... + + def build_poll(self): # -> EpollPoll | KqueuePoll | PollPoll | SelectPoll: + ... + + def build_future(self, compat=..., asyncio=...): # -> Future: + """ + Creates a future object that is bound to the current event + loop context, this allows for latter access to the owning loop. + + :type compat: bool + :param compat: If the compatibility mode retrieval should be used + meaning that a compatible loop instance is retrieved instead. + :type asyncio: bool + :param asyncio: If the asyncio loop retrieval strategy should be + used or if instead the netius native one should be used. + :rtype: Future + :return: The generated future that should be bound to the + current context. + """ + ... + + def get_id(self, unique=...): # -> str: + ... + + def get_poll(self): # -> EpollPoll | KqueuePoll | PollPoll | SelectPoll: + ... + + def get_poll_name(self): # -> str: + ... + + def get_state(self): + ... + + def set_state(self, state): # -> None: + ... + + def get_state_s(self, lower=...): + """ + Retrieves a string describing the current state + of the system, this string should be as descriptive + as possible. + + An optional parameter controls if the string should + be lower cased or not. + + :type lower: bool + :param lower: If the returned string should be converted + into a lower cased version. + :rtype: String + :return: A string describing the current sate of the loop + system, should be as descriptive as possible. + """ + ... + + def get_env(self, name, default=..., cast=..., expand=...): # -> str | None: + """ + Retrieves the value of the environment variable with the + requested name, defaulting to the provided value in case + it's not possible to find such variable. + + An optional cast type may be provided in order to cast the + value of the environment variable in to the target type. + + An optional expand flag may be set so that the variable gets + expanded as a file system file, for this the newline values + should be escaped as explicit '\n' string sequences (two chars). + + Current implementation forwards the request to the current + configuration registry so that other data providers may + also be used in search for configuration. + + :type name: String + :param name: The name of the environment variable that is + meant to be retrieved from the current environment + :type default: Object + :param default: The default value to be returned in case + no value is found for the provided name. + :type cast: Type + :param cast: The cast type to be used to cast the value + of the requested environment variable. + :type expand: bool + :param expand: If the variable should be expanded as a file + object and stored in a temporary storage, for this situation + the resulting object should be a string with the file path. + :rtype: Object + :return: The value of the requested environment variable + properly casted into the target value. + """ + ... + + def expand(self, value, encoding=..., force=...): # -> str: + """ + Expands the provided string/bytes value into a file in the + current file system so that it may be correctly used by interfaces + that require certain values to be file system based. + + The generated file is going to be removed on the cleanup operation + so that no temporary file leaking occurs (garbage collection). + + In case the force value is provided the the file is created even + for situations where the provided value is invalid/unset. + + :type value: String + :param value: The string/bytes based value that is going to be + expanded into a proper file system based (temporary) file. + :type encoding: String + :param encoding: The encoding that is going to be used to convert + the value into a bytes based one in case the provided value is not + bytes compliant (and must be converted). + :type force: bool + :param force: If the expansion operation should be performed even + for situations where the value is considered invalid/unset. + :rtype: String + :return: The path to the temporary file that has just been generated + for the expansion of the provided value. + """ + ... + + def get_protocols(self): # -> None: + """ + Retrieves the complete set of protocols (as ALPN strings) that are + going to be handled by the current protocol infra-structure. + + :rtype: List + :return: The list containing the complete set of protocols handled + by the current infra-structure. + :see: https://tools.ietf.org/html/rfc7301 + """ + ... + + def get_adapter(self, name=..., *args, **kwargs): # -> Any: + """ + Retrieves an instance of a storage adapter described + by the provided name, note that the dynamic (extra) + arguments are going to be used in the construction of + the adapter instance. + + :type name: String + :param name: The name of the adapter to be retrieved + this should be equivalent to the adapter class name. + :rtype: Adapter + :return: An instance (properly configured) of the + requested adapter (defined by the name argument). + """ + ... + + def get_auth(self, name=..., *args, **kwargs): # -> Any: + """ + Gathers the proper authentication handler that is being + requested with the provided name. The retrieved auth + is a static class that should be used from its interface + based on class based methods. + + The state of theses authentication (handlers) is based + on the "global" state of the environment (no instances). + + :type name: String + :param name: The name of the authentication (handler) + class that should be retrieved. + :rtype: Auth + :return: An authentication based class that may be used + for the interaction of authentication methods. + """ + ... + + def get_connection(self, socket): + """ + "Resolves" the connection associated with the provided socket + returning the structured connection object for it. + + In case no connection exists the method raises an exception + invalidating the current logic stack. + + :type socket: Socket + :param socket: The socket for which the connection is going to + be returned. + :rtype: Connection + :return: The connection object associated with the provided + socket reference. + """ + ... + + @property + def is_parent(self): # -> bool: + ... + + @property + def is_child(self): # -> bool: + ... + + @property + def is_forked(self): # -> bool: + ... + + + +class DiagBase(AbstractBase): + def __init__(self, *args, **kwargs) -> None: + ... + + def reads(self, *args, **kwargs): # -> None: + ... + + def writes(self, *args, **kwargs): # -> None: + ... + + def errors(self, *args, **kwargs): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + + +class BaseThread(threading.Thread): + """ + The top level thread class that is meant to encapsulate + a running base object and run it in a new context. + + This base thread may be used to run a network loop allowing + a main thread to continue with execution logic. + """ + def __init__(self, owner=..., daemon=..., *args, **kwargs) -> None: + ... + + def run(self): # -> None: + ... + + + +def new_loop_main(factory=..., _compat=..., **kwargs): # -> CompatLoop | AbstractBase | DiagBase: + ... + +def new_loop_asyncio(**kwargs): # -> AbstractEventLoop | None: + ... + +def new_loop(factory=..., _compat=..., asyncio=..., **kwargs): # -> AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None: + ... + +def ensure_main(factory=..., **kwargs): # -> None: + ... + +def ensure_asyncio(**kwargs): # -> AbstractEventLoop | None: + ... + +def ensure_loop(factory=..., asyncio=..., **kwargs): # -> None: + ... + +def get_main(factory=..., ensure=..., **kwargs): # -> None: + ... + +def get_loop(factory=..., ensure=..., _compat=..., asyncio=..., **kwargs): # -> AbstractEventLoop | None: + ... + +def get_event_loop(*args, **kwargs): # -> AbstractEventLoop | None: + """ + Compatibility alias function with the ``get_loop()`` function + to ensure proper compatibility with asyncio. + + :rtype: EventLoop + :return: The event loop for the current context of execution + (if any) otherwise None (invalid). + """ + ... + +def stop_loop(compat=..., asyncio=...): # -> None: + ... + +def compat_loop(loop): + """ + Retrieves the asyncio API compatible version of the provided + loop in case such version exists in the current object, otherwise + returns the proper object (assumed to be asyncio API compatible). + + :type loop: EventLoop + :param loop: The base event loop object from which an asyncio + API compatible object is meant to be retrieved. + :rtype: EventLoop + :return: The asyncio API compatible event loop object. + """ + ... + +def get_poll(): # -> None: + ... + +def build_future(compat=..., asyncio=...): # -> None: + ... + +def ensure(coroutine, args=..., kwargs=..., thread=...): + ... + +def ensure_pool(coroutine, args=..., kwargs=...): + ... + +is_diag = ... +if is_diag: + Base = ... +else: + Base = ... diff --git a/src/typings/netius/base/compat.pyi b/src/typings/netius/base/compat.pyi new file mode 100644 index 00000000..d56c48a6 --- /dev/null +++ b/src/typings/netius/base/compat.pyi @@ -0,0 +1,162 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +asyncio = ... +BaseLoop = ... +class CompatLoop(BaseLoop): + """ + Top level compatibility class that adds compatibility support + for the asyncio event loop strategy. + + This is required to be able to access netius event loop on a + asyncio like manner. + + :see: https://docs.python.org/3/library/asyncio-eventloop.html + """ + def __init__(self, loop) -> None: + ... + + def __getattr__(self, name): # -> Any: + ... + + def time(self): # -> float: + ... + + def call_soon(self, callback, *args): # -> Handle: + ... + + def call_soon_threadsafe(self, callback, *args): # -> Handle: + ... + + def call_at(self, when, callback, *args): # -> Handle: + ... + + def call_later(self, delay, callback, *args): # -> Handle: + """ + Calls the provided callback with the provided parameters after + the defined delay (in seconds), should ensure proper sleep operation. + + :type delay: float + :param delay: The delay in seconds after which the callback is going + to be called with the provided arguments. + :type callback: Function + :param callback: The function to be called after the provided delay. + :rtype: Handle + :return: The handle object to the operation, that may be used to cancel it. + """ + ... + + def create_future(self): # -> Any: + ... + + def create_task(self, coroutine): # -> Task: + ... + + def create_server(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def create_connection(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def create_datagram_endpoint(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def getaddrinfo(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def getnameinfo(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def run_until_complete(self, future): # -> Any: + ... + + def run_forever(self): # -> Any: + ... + + def run_in_executor(self, *args, **kwargs): # -> AwaitWrapper: + ... + + def stop(self): # -> None: + ... + + def close(self): # -> None: + ... + + def get_exception_handler(self): # -> Callable[..., None]: + ... + + def set_exception_handler(self, handler): # -> None: + ... + + def default_exception_handler(self, context): # -> None: + ... + + def call_exception_handler(self, context): # -> None: + ... + + def get_debug(self): # -> Any: + ... + + def set_debug(self, enabled): # -> None: + ... + + def set_default_executor(self, executor): # -> None: + ... + + def get_task_factory(self): # -> type[Task]: + ... + + def set_task_factory(self, factory): # -> None: + ... + + def is_running(self): # -> Any: + ... + + def is_closed(self): # -> Any: + ... + + + +def is_compat(): # -> bool: + """ + Determines if the compatibility mode for the netius + event loop is required. + + Under this mode the event loop for netius tries to emulate + the behaviour of the asyncio event loop so that it may + be used with 3rd party protocol classes (not compliant + with the netius protocol). + + :rtype: bool + :return: If the netius infra-structure should run under + the compatibility mode. + """ + ... + +def is_asyncio(): # -> bool: + """ + Checks if the asyncio mode of execution (external event + loop) is the required approach under the current runtime. + + If that's the case the netius event loop is not going to + be used and the asyncio one is going to be used instead. + + :rtype: bool + :return: If the asyncio event loop model is enabled and + proper library support available. + """ + ... + +def build_datagram(*args, **kwargs): # -> AbstractEventLoop | None: + ... + +def connect_stream(*args, **kwargs): # -> AbstractEventLoop | None: + ... + diff --git a/src/typings/netius/base/config.pyi b/src/typings/netius/base/config.pyi new file mode 100644 index 00000000..897336f3 --- /dev/null +++ b/src/typings/netius/base/config.pyi @@ -0,0 +1,78 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +FILE_NAME = ... +FILE_TEMPLATE = ... +HOME_FILE = ... +IMPORT_NAMES = ... +CASTS = ... +ENV_ENCODINGS = ... +CONFIGS = ... +CONFIG_F = ... +HOMES = ... +__builtins__ = ... +def conf(name, default=..., cast=..., ctx=...): + """ + Retrieves the configuration value for the provided value + defaulting to the provided default value in case no value + is found for the provided name. + + An optional cast operation may be performed on the value + in case it's requested. + + :type name: String + :param name: The name of the configuration value to be + retrieved. + :type default: Object + :param default: The default value to be retrieved in case + no value was found for the provided name. + :type cast: Type/String + :param cast: The cast operation to be performed in the + resolved value (optional). + :type ctx: Dictionary + :param ctx: The context dictionary to be used for situations + where a more contextual configuration is meant to be used instead + of the process wide global configuration. + :rtype: Object + :return: The value for the configuration with the requested + name or the default value if no value was found. + """ + ... + +def conf_prefix(prefix, ctx=...): # -> dict[Any, Any]: + ... + +def conf_suffix(suffix, ctx=...): # -> dict[Any, Any]: + ... + +def conf_s(name, value, ctx=...): # -> None: + ... + +def conf_r(name, ctx=...): # -> None: + ... + +def conf_d(ctx=...): # -> dict[Any, Any]: + ... + +def conf_ctx(): # -> dict[str, dict[Any, Any]]: + ... + +def load(names=..., path=..., encoding=..., ctx=...): # -> None: + ... + +def load_file(name=..., path=..., encoding=..., ctx=...): # -> None: + ... + +def load_env(ctx=...): # -> None: + ... + +def get_homes(file_path=..., default=..., encoding=..., force_default=...): # -> list[Any] | list[str] | Literal['']: + ... + diff --git a/src/typings/netius/base/conn.pyi b/src/typings/netius/base/conn.pyi new file mode 100644 index 00000000..d4c5da72 --- /dev/null +++ b/src/typings/netius/base/conn.pyi @@ -0,0 +1,238 @@ +""" +This type stub file was generated by pyright. +""" + +from . import observer + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +OPEN = ... +CLOSED = ... +PENDING = ... +CHUNK_SIZE = ... +class BaseConnection(observer.Observable): + """ + Abstract connection object that should encapsulate + a socket object enabling it to be accessed in much + more "protected" way avoiding possible sync problems. + + It should also abstract the developer from all the + select associated complexities adding and removing the + underlying socket from the selecting mechanism for the + appropriate operations. + """ + def __init__(self, owner=..., socket=..., address=..., datagram=..., ssl=..., max_pending=..., min_pending=...) -> None: + ... + + def destroy(self): # -> None: + ... + + def open(self, connect=...): # -> None: + ... + + def close(self, flush=..., destroy=...): # -> None: + ... + + def close_flush(self): # -> None: + ... + + def upgrade(self, key_file=..., cer_file=..., ca_file=..., server=...): # -> None: + ... + + def set_connecting(self): # -> None: + ... + + def set_connected(self): # -> None: + ... + + def set_upgraded(self): # -> None: + ... + + def set_data(self, data, address=...): # -> None: + ... + + def ensure_write(self, flush=...): # -> None: + ... + + def remove_write(self): # -> None: + ... + + def enable_read(self): # -> None: + """ + Enables read operations for the current connection + this will set the read enable flag and then subscribe + to the read operations in case the underlying poll + method is not of type edge (level based). + + This is a dangerous operation as it may cause the system + to stall if misused. + """ + ... + + def disable_read(self): # -> None: + """ + Disables any read operation on the current socket, does that + by disabling the current read enable and then unsubscribing + the current connection from the read operation. + + This is an extremely dangerous operation and the correct knowledge + of the event poll is required to avoid stalling. + """ + ... + + def send(self, data, address=..., delay=..., force=..., callback=...): # -> int: + """ + The main send call to be used by a proxy connection and + from different threads. + + This method is the equivalent on a socket basis to both the + send and the send to method, meaning that datagram send operations + are also allowed by using the address parameter. + + In case the sending should be forced as delayed (next tick) + the delay flag should be set and the sending will be delayed. + This is especially useful to avoid a stack overflow situation + because of extended callback calling, for example while sending + very large chunks of information (eg: multi megabyte files). + + An optional callback attribute may be sent, so that when the + send is complete it's called with a reference to the data object. + + Calling this method should be done with care as this can + create dead lock or socket corruption situations, extreme + knowledge of the internals of the system is required. + + :type data: String + :param data: The buffer containing the data to be sent + through this connection to the other endpoint. + :type address: Tuple + :param address: The target address for the send operation, + this is relevant only for datagram based connections. + :type delay: bool + :param delay: If the send operation should be delayed until + the next tick operation or if it should be performed as + soon as possible (as defined in specification). + :type force: bool + :param force: If the sending of the data should be "forced", + meaning that even if the connection is not open the data + is added to the current pending queue. Useful for client + connections wanting to write ahead. + :type callback: Function + :param callback: Function to be called when the data set + to be send is completely sent to the socket. + """ + ... + + def recv(self, size=..., force=...): # -> Literal[b""]: + ... + + def pend(self, data, back=...): # -> None: + ... + + def restore(self, data, back=...): # -> None: + """ + Restore data to the pending (to receive) so that they are + going to be "received" in the next receive operation. + + :type data: String + :param data: The buffer of data that is going to be restored + to the internal receive buffers. + :type back: bool + :param back: If the data should be restore to the "back" of + the internal buffers, or if instead it should be added to the + front (next to be received) part of the buffer. + """ + ... + + def run_starter(self): # -> bool: + ... + + def end_starter(self): # -> None: + ... + + def add_starter(self, starter, back=...): # -> None: + ... + + def remove_starter(self, starter): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, Any | None]: + ... + + def ssl_certificate(self, binary=...): # -> None: + ... + + def ssl_verify_host(self, host=...): # -> None: + ... + + def ssl_verify_fingerprint(self, fingerprint=...): # -> None: + ... + + def ssl_dump_certificate(self, dump=...): # -> None: + ... + + def ssl_protocol(self): # -> None: + ... + + def ssl_alpn_protocol(self): # -> None: + ... + + def ssl_npn_protocol(self): # -> None: + ... + + def is_open(self): # -> bool: + ... + + def is_closed(self): # -> bool: + ... + + def is_pending(self): # -> bool: + ... + + def is_connected(self): # -> bool: + ... + + def is_connecting(self): # -> bool: + ... + + def is_upgrading(self): # -> bool: + ... + + def is_throttleable(self): # -> Literal[True]: + ... + + def is_exhausted(self): # -> bool: + ... + + def is_restored(self): # -> bool: + ... + + def is_pending_data(self): # -> bool: + ... + + + +class DiagConnection(BaseConnection): + def __init__(self, *args, **kwargs) -> None: + ... + + def recv(self, *args, **kwargs): # -> Literal[b""]: + ... + + def send(self, data, *args, **kwargs): # -> int: + ... + + def info_dict(self, full=...): # -> dict[str, Any | None]: + ... + + + +is_diag = ... +if is_diag: + Connection = ... +else: + Connection = ... diff --git a/src/typings/netius/base/container.pyi b/src/typings/netius/base/container.pyi new file mode 100644 index 00000000..3ab69c84 --- /dev/null +++ b/src/typings/netius/base/container.pyi @@ -0,0 +1,85 @@ +""" +This type stub file was generated by pyright. +""" + +from . import server +from .common import * + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Container(Base): + def __init__(self, *args, **kwargs) -> None: + ... + + def start(self, owner): # -> None: + ... + + def cleanup(self): # -> None: + ... + + def loop(self): # -> None: + ... + + def ticks(self): # -> None: + ... + + def connections_dict(self, full=...): # -> dict[Any, Any]: + ... + + def connection_dict(self, id, full=...): # -> None: + ... + + def on_start(self): # -> None: + ... + + def on_stop(self): # -> None: + ... + + def add_base(self, base): # -> None: + ... + + def remove_base(self, base): # -> None: + ... + + def start_base(self, base): # -> None: + ... + + def start_all(self): # -> None: + ... + + def apply_all(self): # -> None: + ... + + def apply_base(self, base): # -> None: + ... + + def call_all(self, name, *args, **kwargs): # -> None: + ... + + def trigger_all(self, name, *args, **kwargs): # -> None: + ... + + + +class ContainerServer(server.StreamServer): + def __init__(self, *args, **kwargs) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def cleanup(self): # -> None: + ... + + def add_base(self, base): # -> None: + ... + + + diff --git a/src/typings/netius/base/diag.pyi b/src/typings/netius/base/diag.pyi new file mode 100644 index 00000000..61998dc5 --- /dev/null +++ b/src/typings/netius/base/diag.pyi @@ -0,0 +1,43 @@ +""" +This type stub file was generated by pyright. +""" + +import appier + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +loaded = ... +class DiagApp(appier.APIApp): + def __init__(self, system, *args, **kwargs) -> None: + ... + + @appier.route("/logger", "GET") + def show_logger(self): # -> dict[str, Any]: + ... + + @appier.route("/logger/set", ("GET", "POST")) + def set_logger(self): # -> dict[str, Any]: + ... + + @appier.route("/environ", "GET") + def show_environ(self): + ... + + @appier.route("/info", "GET") + def system_info(self): + ... + + @appier.route("/connections", "GET") + def list_connections(self): + ... + + @appier.route("/connections/", "GET") + def show_connection(self, id): + ... + + + diff --git a/src/typings/netius/base/errors.pyi b/src/typings/netius/base/errors.pyi new file mode 100644 index 00000000..157c228c --- /dev/null +++ b/src/typings/netius/base/errors.pyi @@ -0,0 +1,143 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class NetiusError(Exception): + """ + The top level base error to be used in the + netius infra-structure. + + Note that this class inherits from the runtime + error meaning that all the errors are runtime. + """ + def __init__(self, *args, **kwargs) -> None: + ... + + def get_kwarg(self, name, default=...): + ... + + @property + def uid(self): # -> UUID: + ... + + + +class RuntimeError(NetiusError): + """ + Error to be used for situations where an exception + is raised during a typical runtime situation. + + This error class is meant to be used as the parent + class in every exception raised during normal execution. + """ + ... + + +class StopError(RuntimeError): + """ + Error to be used for situations where a stop + intention is meant to be raised to upper layers. + + This error represent an operation and not a real + error and should be used as such. + """ + ... + + +class PauseError(RuntimeError): + """ + Error to be used for situations where a pause + intention is meant to be raised to upper layers. + + This error represent an operation and not a real + error and should be used as such. + """ + ... + + +class WakeupError(RuntimeError): + """ + Error used to send a wakeup intent from one context + or thread to another. + + This is especially useful on the context of signal + handling where an interruption may happen at any time. + """ + ... + + +class DataError(RuntimeError): + """ + Error to be used for situations where the + data that has been received/sent is invalid. + + This error may be used for situations where + the data in the buffer is not sufficient for + parsing the values. + """ + ... + + +class ParserError(RuntimeError): + """ + Error caused by a malformed data that invalidated + the possibility to parse it. + + This error should only be used under a parser infra- + structure and never outside it. + """ + def __init__(self, *args, **kwargs) -> None: + ... + + + +class GeneratorError(RuntimeError): + """ + Error generated by a problem in the generation of + and encoded data (reverse of parser error). + + This error should be raise only in a generator of + an encoded stream buffer. + """ + ... + + +class SecurityError(RuntimeError): + """ + Error caused by a failed security verification this + errors should be properly audited in order to avoid + extra problems that may arise from them. + + This kind of problems is considered to be runtime + as they should not be related with programming. + """ + ... + + +class NotImplemented(RuntimeError): + """ + Error caused by the non implementation of a certain + method/feature at a certain level. This may mean that + the wrong level of abstraction is being called or a + certain feature is pending development. + + This kind of problems is considered to be development + as they may be related with programming. + """ + ... + + +class AssertionError(RuntimeError): + """ + Error raised for failure to meet any pre-condition or + assertion for a certain data set. + """ + ... + + diff --git a/src/typings/netius/base/legacy.pyi b/src/typings/netius/base/legacy.pyi new file mode 100644 index 00000000..9063ee05 --- /dev/null +++ b/src/typings/netius/base/legacy.pyi @@ -0,0 +1,240 @@ +""" +This type stub file was generated by pyright. +""" + +import contextlib + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +ArgSpec = ... +@contextlib.contextmanager +def ctx_absolute(): # -> Generator[None, Any, None]: + ... + +PYTHON_3 = ... +PYTHON_35 = ... +PYTHON_36 = ... +PYTHON_39 = ... +PYTHON_ASYNC = ... +PYTHON_ASYNC_GEN = ... +PYTHON_V = ... +if PYTHON_3: + LONG = ... +else: + LONG = ... +if PYTHON_3: + BYTES = ... +else: + BYTES = ... +if PYTHON_3: + UNICODE = ... +else: + UNICODE = ... +if PYTHON_3: + OLD_UNICODE = ... +else: + OLD_UNICODE = ... +if PYTHON_3: + STRINGS = ... +else: + STRINGS = ... +if PYTHON_3: + ALL_STRINGS = ... +else: + ALL_STRINGS = ... +if PYTHON_3: + INTEGERS = ... +else: + INTEGERS = ... +_ord = ... +_chr = ... +_str = str +_bytes = bytes +_range = range +_xrange = ... +if PYTHON_3: + Request = ... +else: + Request = ... +if PYTHON_3: + HTTPHandler = ... +else: + HTTPHandler = ... +if PYTHON_3: + HTTPError = ... +else: + HTTPError = ... +if PYTHON_3: + HTTPConnection = ... +else: + HTTPConnection = ... +if PYTHON_3: + HTTPSConnection = ... +else: + HTTPSConnection = ... +_execfile = ... +_reduce = ... +_reload = ... +_unichr = ... +def with_meta(meta, *bases): + ... + +def eager(iterable): # -> list[Any]: + ... + +def iteritems(associative): + ... + +def iterkeys(associative): + ... + +def itervalues(associative): + ... + +def items(associative): # -> list[Any]: + ... + +def keys(associative): # -> list[Any]: + ... + +def values(associative): # -> list[Any]: + ... + +def xrange(start, stop=..., step=...): # -> _range: + ... + +def range(start, stop=..., step=...): # -> list[Any] | _range: + ... + +def ord(value): # -> int: + ... + +def chr(value): # -> _bytes | str: + ... + +def chri(value): # -> str: + ... + +def bytes(value, encoding=..., errors=..., force=...): # -> _bytes: + ... + +def str(value, encoding=..., errors=..., force=...): + ... + +def u(value, encoding=..., errors=..., force=...): + ... + +def ascii(value, encoding=..., errors=...): # -> bytes | str: + ... + +def orderable(value): # -> Orderable: + ... + +def is_str(value): # -> Any: + ... + +def is_unicode(value): # -> Any: + ... + +def is_bytes(value): # -> Any: + ... + +def is_string(value, all=...): # -> bool: + ... + +def is_generator(value): # -> bool: + ... + +def is_async_generator(value): # -> bool: + ... + +def is_unittest(name=...): # -> bool: + ... + +def execfile(path, global_vars, local_vars=..., encoding=...): # -> None: + ... + +def walk(path, visit, arg): # -> None: + ... + +def getargspec(func): # -> ArgSpec: + ... + +def has_module(name): # -> bool: + ... + +def new_module(name): # -> ModuleType: + ... + +def reduce(*args, **kwargs): + ... + +def reload(*args, **kwargs): # -> ModuleType: + ... + +def unichr(*args, **kwargs): # -> str: + ... + +def urlopen(*args, **kwargs): # -> _UrlopenRet: + ... + +def build_opener(*args, **kwargs): # -> OpenerDirector: + ... + +def urlparse(*args, **kwargs): + ... + +def urlunparse(*args, **kwargs): # -> Literal[b""]: + ... + +def parse_qs(*args, **kwargs): # -> dict[Any, list[Any]]: + ... + +def urlencode(*args, **kwargs): # -> str: + ... + +def quote(*args, **kwargs): # -> str: + ... + +def quote_plus(*args, **kwargs): # -> str: + ... + +def unquote(*args, **kwargs): # -> str: + ... + +def unquote_plus(*args, **kwargs): # -> str: + ... + +def cmp_to_key(*args, **kwargs): # -> dict[str, Callable[[Any], SupportsAllComparisons]] | dict[str, Any]: + ... + +def tobytes(self, *args, **kwargs): + ... + +def tostring(self, *args, **kwargs): + ... + +def StringIO(*args, **kwargs): # -> StringIO: + ... + +def BytesIO(*args, **kwargs): # -> BytesIO | StringIO: + ... + +class Orderable(tuple): + """ + Simple tuple type wrapper that provides a simple + first element ordering, that is compatible with + both the Python 2 and Python 3+ infra-structures. + """ + def __cmp__(self, value): + ... + + def __lt__(self, value) -> bool: + ... + + + diff --git a/src/typings/netius/base/log.pyi b/src/typings/netius/base/log.pyi new file mode 100644 index 00000000..6e5c5e45 --- /dev/null +++ b/src/typings/netius/base/log.pyi @@ -0,0 +1,20 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SILENT = ... +def rotating_handler(path=..., max_bytes=..., max_log=..., encoding=..., delay=...): # -> RotatingFileHandler: + ... + +def smtp_handler(host=..., port=..., sender=..., receivers=..., subject=..., username=..., password=..., stls=...): # -> SMTPHandler: + ... + +def in_signature(callable, name): # -> list[str] | bool | Literal[''] | None: + ... + diff --git a/src/typings/netius/base/observer.pyi b/src/typings/netius/base/observer.pyi new file mode 100644 index 00000000..d5c4c50c --- /dev/null +++ b/src/typings/netius/base/observer.pyi @@ -0,0 +1,42 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Observable: + """ + The base class that implements the observable + patter allowing the object to handle a series of + event in a dynamic fashion. + + This class should be friendly to multiple inheritance + and should avoid variable naming collision. + """ + def __init__(self, *args, **kwargs) -> None: + ... + + def build(self): # -> None: + ... + + def destroy(self): # -> None: + ... + + def bind(self, name, method, oneshot=...): # -> None: + ... + + def unbind(self, name, method=...): # -> None: + ... + + def unbind_all(self): # -> None: + ... + + def trigger(self, name, *args, **kwargs): # -> None: + ... + + + diff --git a/src/typings/netius/base/poll.pyi b/src/typings/netius/base/poll.pyi new file mode 100644 index 00000000..163ca1f5 --- /dev/null +++ b/src/typings/netius/base/poll.pyi @@ -0,0 +1,240 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +POLL_TIMEOUT = ... +class Poll: + """ + The top level abstract implementation of a poll object + should be used for inheritance and reference on the + various methods that are part of the api. + """ + def __init__(self) -> None: + ... + + @classmethod + def name(cls): # -> str: + ... + + @classmethod + def test(cls): # -> Literal[True]: + ... + + def open(self, timeout=...): # -> None: + ... + + def close(self): # -> None: + ... + + def poll(self): # -> list[Any]: + ... + + def poll_owner(self): # -> dict[Any, Any]: + ... + + def is_open(self): # -> bool: + ... + + def is_edge(self): # -> Literal[False]: + ... + + def is_empty(self): # -> bool: + ... + + def sub_all(self, socket, owner=...): # -> None: + ... + + def unsub_all(self, socket): # -> None: + ... + + def is_sub_read(self, socket): # -> bool: + ... + + def is_sub_write(self, socket): # -> bool: + ... + + def is_sub_error(self, socket): # -> bool: + ... + + def sub_read(self, socket, owner=...): # -> None: + ... + + def sub_write(self, socket, owner=...): # -> None: + ... + + def sub_error(self, socket, owner=...): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + + +class EpollPoll(Poll): + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def test(cls): # -> bool: + ... + + def open(self, timeout=...): # -> None: + ... + + def close(self): # -> None: + ... + + def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: + ... + + def is_edge(self): # -> Literal[True]: + ... + + def sub_read(self, socket, owner=...): # -> None: + ... + + def sub_write(self, socket, owner=...): # -> None: + ... + + def sub_error(self, socket, owner=...): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + + +class KqueuePoll(Poll): + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def test(cls): # -> bool: + ... + + def open(self, timeout=...): # -> None: + ... + + def close(self): # -> None: + ... + + def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: + ... + + def is_edge(self): # -> Literal[True]: + ... + + def sub_read(self, socket, owner=...): # -> None: + ... + + def sub_write(self, socket, owner=...): # -> None: + ... + + def sub_error(self, socket, owner=...): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + + +class PollPoll(Poll): + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def test(cls): # -> bool: + ... + + def open(self, timeout=...): # -> None: + ... + + def close(self): # -> None: + ... + + def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: + ... + + def is_edge(self): # -> Literal[False]: + ... + + def sub_read(self, socket, owner=...): # -> None: + ... + + def sub_write(self, socket, owner=...): # -> None: + ... + + def sub_error(self, socket, owner=...): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + + +class SelectPoll(Poll): + def __init__(self, *args, **kwargs) -> None: + ... + + def open(self, timeout=...): # -> None: + ... + + def close(self): # -> None: + ... + + def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: + ... + + def is_edge(self): # -> Literal[False]: + ... + + def sub_read(self, socket, owner=...): # -> None: + ... + + def sub_write(self, socket, owner=...): # -> None: + ... + + def sub_error(self, socket, owner=...): # -> None: + ... + + def unsub_read(self, socket): # -> None: + ... + + def unsub_write(self, socket): # -> None: + ... + + def unsub_error(self, socket): # -> None: + ... + + + diff --git a/src/typings/netius/base/protocol.pyi b/src/typings/netius/base/protocol.pyi new file mode 100644 index 00000000..fcc07b3d --- /dev/null +++ b/src/typings/netius/base/protocol.pyi @@ -0,0 +1,152 @@ +""" +This type stub file was generated by pyright. +""" + +from . import observer + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Protocol(observer.Observable): + """ + Abstract class from which concrete implementation of + protocol logic should inherit. + + The logic of a protocol should implement both a reaction + to the arrival of information (receive) and the sending + of processed data (send). + """ + def __init__(self, owner=...) -> None: + ... + + def open(self): # -> None: + ... + + def close(self): # -> None: + ... + + def finish(self): # -> None: + ... + + def open_c(self): # -> None: + ... + + def close_c(self): # -> None: + ... + + def finish_c(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[Any, Any]: + ... + + def connection_made(self, transport): # -> None: + ... + + def connection_lost(self, exception): # -> None: + ... + + def transport(self): # -> None: + ... + + def loop(self): # -> None: + ... + + def loop_set(self, loop): # -> None: + ... + + def loop_unset(self): # -> None: + ... + + def pause_writing(self): # -> None: + ... + + def resume_writing(self): # -> None: + ... + + def delay(self, callable, timeout=...): + ... + + def debug(self, object): # -> None: + ... + + def info(self, object): # -> None: + ... + + def warning(self, object): # -> None: + ... + + def error(self, object): # -> None: + ... + + def critical(self, object): # -> None: + ... + + def is_pending(self): # -> bool: + ... + + def is_open(self): # -> bool: + ... + + def is_closed(self): # -> bool: + ... + + def is_closing(self): # -> bool: + ... + + def is_closed_or_closing(self): # -> bool: + ... + + def is_devel(self): # -> Literal[False]: + ... + + + +class DatagramProtocol(Protocol): + def __init__(self) -> None: + ... + + def datagram_received(self, data, address): # -> None: + ... + + def error_received(self, exception): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def send(self, data, address, delay=..., force=..., callback=...): # -> int: + ... + + def send_to(self, data, address, delay=..., force=..., callback=...): # -> int: + ... + + def add_request(self, request): # -> None: + ... + + def remove_request(self, request): # -> None: + ... + + def get_request(self, id): + ... + + + +class StreamProtocol(Protocol): + def data_received(self, data): # -> None: + ... + + def eof_received(self): # -> None: + ... + + def on_data(self, data): # -> None: + ... + + def send(self, data, delay=..., force=..., callback=...): # -> int: + ... + + + diff --git a/src/typings/netius/base/request.pyi b/src/typings/netius/base/request.pyi new file mode 100644 index 00000000..1418c080 --- /dev/null +++ b/src/typings/netius/base/request.pyi @@ -0,0 +1,48 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +REQUEST_TIMEOUT = ... +class Request: + """ + Abstract request structure used to represent + a request in a server/client model, this allows + for easy identification and response (callback). + """ + IDENTIFIER = ... + def __init__(self, timeout=..., callback=...) -> None: + ... + + + +class Response: + """ + Top level abstract representation of a response to + be sent based on a previously created request, the + input of this object should be raw data and a relation + between the request and the response is required. + + The association/relation between the response and the + request should be done using the original request + generated identifier. + """ + def __init__(self, data, request=...) -> None: + ... + + def parse(self): # -> None: + ... + + def get_request(self): # -> None: + ... + + def get_id(self): + ... + + + diff --git a/src/typings/netius/base/server.pyi b/src/typings/netius/base/server.pyi new file mode 100644 index 00000000..d49f4d2c --- /dev/null +++ b/src/typings/netius/base/server.pyi @@ -0,0 +1,153 @@ +""" +This type stub file was generated by pyright. +""" + +from .conn import * +from .common import * + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_SIZE_S = ... +BUFFER_SIZE_C = ... +class Server(Base): + def __init__(self, *args, **kwargs) -> None: + ... + + def welcome(self): # -> None: + ... + + def cleanup(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def serve(self, host=..., port=..., type=..., ipv6=..., ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., ssl_host=..., ssl_fingerprint=..., ssl_dump=..., setuid=..., backlog=..., load=..., start=..., env=...): + ... + + def socket_tcp(self, ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=...): # -> SSLSocket | socket: + ... + + def socket_udp(self, family=..., type=...): # -> socket: + ... + + def on_serve(self): # -> None: + ... + + + +class DatagramServer(Server): + def __init__(self, *args, **kwargs) -> None: + ... + + def reads(self, reads, state=...): # -> None: + ... + + def writes(self, writes, state=...): # -> None: + ... + + def errors(self, errors, state=...): # -> None: + ... + + def serve(self, type=..., *args, **kwargs): # -> None: + ... + + def on_read(self, _socket): + ... + + def on_write(self, _socket): # -> None: + ... + + def on_error(self, _socket): # -> None: + ... + + def on_exception(self, exception): # -> None: + ... + + def on_expected(self, exception): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def ensure_write(self): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: + ... + + def remove_write(self): # -> None: + ... + + def enable_read(self): # -> None: + ... + + def disable_read(self): # -> None: + ... + + def send(self, data, address, delay=..., callback=...): # -> None: + ... + + + +class StreamServer(Server): + def reads(self, reads, state=...): # -> None: + ... + + def writes(self, writes, state=...): # -> None: + ... + + def errors(self, errors, state=...): # -> None: + ... + + def serve(self, type=..., *args, **kwargs): # -> None: + ... + + def on_read_s(self, _socket): # -> None: + ... + + def on_write_s(self, _socket): # -> None: + ... + + def on_error_s(self, _socket): # -> None: + ... + + def on_read(self, _socket): + ... + + def on_write(self, _socket): # -> None: + ... + + def on_error(self, _socket): # -> None: + ... + + def on_exception(self, exception, connection): # -> None: + ... + + def on_exception_s(self, exception): # -> None: + ... + + def on_expected(self, exception, connection): # -> None: + ... + + def on_expected_s(self, exception): # -> None: + ... + + def on_upgrade(self, connection): # -> None: + ... + + def on_ssl(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_socket_c(self, socket_c, address): # -> None: + ... + + def on_socket_d(self, socket_c): # -> None: + ... + + + diff --git a/src/typings/netius/base/stream.pyi b/src/typings/netius/base/stream.pyi new file mode 100644 index 00000000..7c4b3d18 --- /dev/null +++ b/src/typings/netius/base/stream.pyi @@ -0,0 +1,54 @@ +""" +This type stub file was generated by pyright. +""" + +from . import observer + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +OPEN = ... +CLOSED = ... +PENDING = ... +class Stream(observer.Observable): + """ + Abstract stream class responsible for the representation of + a "virtual" connection state for situation where multiplexing + of single connection exists (connections within connections) + + Most of the interface for a stream should be "logically" similar + to the one defined by a connection. + + A good example of the stream usage is the HTTP2 protocol where + multiple parallel streams co-exist within a single TCP connection + allowing huge performance improvements. + """ + def __init__(self, owner=...) -> None: + ... + + def reset(self): # -> None: + ... + + def open(self): # -> None: + ... + + def close(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, int]: + ... + + def is_open(self): # -> bool: + ... + + def is_closed(self): # -> bool: + ... + + def is_pending(self): # -> bool: + ... + + + diff --git a/src/typings/netius/base/tls.pyi b/src/typings/netius/base/tls.pyi new file mode 100644 index 00000000..1d598b32 --- /dev/null +++ b/src/typings/netius/base/tls.pyi @@ -0,0 +1,25 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def fingerprint(certificate, hash=...): # -> str: + ... + +def match_fingerprint(certificate, exp_fingerprint, hash=...): # -> None: + ... + +def match_hostname(certificate, hostname): # -> None: + ... + +def dnsname_match(domain, hostname, max_wildcards=...): # -> bool: + ... + +def dump_certificate(certificate, certificate_binary, name=...): # -> None: + ... + diff --git a/src/typings/netius/base/transport.pyi b/src/typings/netius/base/transport.pyi new file mode 100644 index 00000000..8f387755 --- /dev/null +++ b/src/typings/netius/base/transport.pyi @@ -0,0 +1,120 @@ +""" +This type stub file was generated by pyright. +""" + +from . import observer + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Transport(observer.Observable): + """ + Decorator class to be used to add the functionality of a + transport layer using a simplified and standard API. + + Allows adding the functionality to an internal netius + connection (or equivalent) object. + + This approach is heavily influenced by the design of the + asyncio Python infra-structure and should provide a mostly + compatible interface. + """ + def __init__(self, loop, connection, open=...) -> None: + ... + + def open(self): # -> None: + ... + + def close(self): # -> None: + ... + + def abort(self): # -> None: + ... + + def write(self, data): # -> None: + ... + + def sendto(self, data, addr=...): # -> None: + ... + + def get_extra_info(self, name, default=...): # -> None: + ... + + def get_write_buffer_size(self): + ... + + def get_write_buffer_limits(self): # -> tuple[Any, Any]: + ... + + def set_handlers(self): # -> None: + ... + + def set_write_buffer_limits(self, high=..., low=...): # -> None: + """ + Sets the write buffer limits in the underlying connection + object using the provided values. + + If the only one of the values is provided the other one is + going to be calculated using an hardcoded ratio value. + + :type high: int + :param high: The maximum number of bytes that can be set + waiting in the connection internal buffer waiting to be sent + before the connection becomes exhausted (sending blocked). + :type low: int + :param low: The maximum number of bytes waiting in the buffer + before the connection send buffer is unblocked. + """ + ... + + def set_extra_dict(self): # -> None: + ... + + def get_protocol(self): # -> None: + ... + + def set_protocol(self, protocol): # -> None: + ... + + def is_closing(self): # -> bool: + """ + Determines if the current transport/connection is closed + or is in the process of being closed. + + A transport is considered closed in case the underlying + connection object is not set or is closed. + + :rtype: bool + :return: If the current transport is closed or in the process + of being closed, if the connection is not set in the transport + it's also considered to be closing. + """ + ... + + + +class TransportDatagram(Transport): + """ + Abstract class to be used when creating a datagram based + (connectionless) transport. + + This implementation reflects the decisions made for the + netius based transport abstraction, inspired by asyncio. + """ + ... + + +class TransportStream(Transport): + """ + Abstract class to be used when creating a stream based + (connection) transport. + + This implementation reflects the decisions made for the + netius based transport abstraction, inspired by asyncio. + """ + ... + + diff --git a/src/typings/netius/base/util.pyi b/src/typings/netius/base/util.pyi new file mode 100644 index 00000000..4d5d3120 --- /dev/null +++ b/src/typings/netius/base/util.pyi @@ -0,0 +1,51 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +FIRST_CAP_REGEX = ... +ALL_CAP_REGEX = ... +def camel_to_underscore(camel, separator=...): # -> str: + """ + Converts the provided camel cased based value into + a normalized underscore based string. + + This is useful as most of the python string standards + are compliant with the underscore strategy. + + :type camel: String + :param camel: The camel cased string that is going to be + converted into an underscore based string. + :type separator: String + :param separator: The separator token that is going to + be used in the camel to underscore conversion. + :rtype: String + :return: The underscore based string resulting from the + conversion of the provided camel cased one. + """ + ... + +def verify(condition, message=..., exception=...): # -> None: + """ + Ensures that the requested condition returns a valid value + and if that's no the case an exception raised breaking the + current execution logic. + + :type condition: bool + :param condition: The condition to be evaluated and that may + trigger an exception raising. + :type message: String + :param message: The message to be used in the building of the + exception that is going to be raised in case of condition failure. + :type exception: Class + :param exception: The exception class that is going to be used + to build the exception to be raised in case the condition + verification operation fails. + """ + ... + diff --git a/src/typings/netius/clients/__init__.pyi b/src/typings/netius/clients/__init__.pyi new file mode 100644 index 00000000..42a0d6b3 --- /dev/null +++ b/src/typings/netius/clients/__init__.pyi @@ -0,0 +1,21 @@ +""" +This type stub file was generated by pyright. +""" + +from . import apn, dht, dns, http, mjpg, raw, smtp, ssdp, torrent, ws +from .apn import APNClient, APNProtocol +from .dht import DHTClient, DHTRequest, DHTResponse +from .dns import DNSClient, DNSProtocol, DNSRequest, DNSResponse +from .http import HTTPClient, HTTPProtocol +from .mjpg import MJPGClient, MJPGProtocol +from .raw import RawClient, RawProtocol +from .smtp import SMTPClient, SMTPConnection +from .ssdp import SSDPClient, SSDPProtocol +from .torrent import CHOKED, TorrentClient, TorrentConnection, UNCHOKED +from .ws import WSClient, WSProtocol + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/clients/apn.pyi b/src/typings/netius/clients/apn.pyi new file mode 100644 index 00000000..588a4db1 --- /dev/null +++ b/src/typings/netius/clients/apn.pyi @@ -0,0 +1,59 @@ +""" +This type stub file was generated by pyright. +""" + +import netius + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class APNProtocol(netius.StreamProtocol): + """ + Protocol class that defines the interface to operate + an apple push notifications (APN) protocol that is + able to send push notifications to Apple devices. + + Should be compliant with a simple message oriented + interface for easy of usage from developers. + """ + HOST = ... + PORT = ... + SANDBOX_HOST = ... + SANDBOX_PORT = ... + def __init__(self, *args, **kwargs) -> None: + ... + + def connection_made(self, transport): # -> None: + ... + + def send_notification(self, token, message, sound=..., badge=..., close=...): # -> None: + ... + + def set(self, token, message, sound=..., badge=..., sandbox=..., key_file=..., cer_file=..., _close=...): # -> None: + ... + + def notify(self, token, loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | None, Self]: + ... + + + +class APNClient(netius.ClientAgent): + protocol = APNProtocol + @classmethod + def notify_s(cls, token, loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + + +if __name__ == "__main__": + def on_finish(protocol): # -> None: + ... + + token = ... + key_file = ... + cer_file = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/dht.pyi b/src/typings/netius/clients/dht.pyi new file mode 100644 index 00000000..47723cdd --- /dev/null +++ b/src/typings/netius/clients/dht.pyi @@ -0,0 +1,86 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DHTRequest(netius.Request): + def __init__(self, peer_id, host=..., port=..., type=..., callback=..., *args, **kwargs) -> None: + ... + + @classmethod + def contact(cls, host, port): # -> bytes: + ... + + def request(self): # -> bytes: + ... + + def ping(self): # -> dict[str, Any | bytes]: + ... + + def find_node(self): # -> dict[str, Any | bytes]: + ... + + def get_peers(self): # -> dict[str, Any | bytes]: + ... + + def announce_peer(self): # -> dict[str, Any | bytes]: + ... + + + +class DHTResponse(netius.Response): + def __init__(self, data) -> None: + ... + + def parse(self): # -> None: + ... + + def get_id(self): # -> int: + ... + + def get_payload(self): + ... + + def is_error(self): + ... + + def is_response(self): + ... + + + +class DHTClient(netius.DatagramClient): + """ + Implementation of the DHT (Distributed hash table) for the torrent + protocol as the defined in the official specification. + + This implementation is meant to be used in an asynchronous environment + for maximum performance. + + :see: http://www.bittorrent.org/beps/bep_0005.html + """ + def ping(self, host, port, peer_id, *args, **kwargs): # -> None: + ... + + def find_node(self, *args, **kwargs): # -> None: + ... + + def get_peers(self, *args, **kwargs): # -> None: + ... + + def query(self, host=..., port=..., peer_id=..., type=..., callback=..., *args, **kwargs): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def on_data_dht(self, address, response): # -> None: + ... + + + diff --git a/src/typings/netius/clients/dns.pyi b/src/typings/netius/clients/dns.pyi new file mode 100644 index 00000000..a9d1d087 --- /dev/null +++ b/src/typings/netius/clients/dns.pyi @@ -0,0 +1,141 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +DNS_QUERY = ... +DNS_RESPONSE = ... +DNS_SQUERY = ... +DNS_IQUERY = ... +DNS_STATUS = ... +DNS_AA = ... +DNS_TC = ... +DNS_RD = ... +DNS_TYPES = ... +DNS_CLASSES = ... +DNS_TYPES_R = ... +DNS_CLASSES_R = ... +class DNSRequest(netius.Request): + def __init__(self, name, type=..., cls=..., callback=...) -> None: + ... + + def request(self): # -> bytes: + ... + + + +class DNSResponse(netius.Response): + def parse(self): # -> None: + ... + + def get_id(self): # -> Any: + ... + + def parse_qd(self, data, index): # -> tuple[Any, tuple[bytes, str, str]]: + ... + + def parse_an(self, data, index): # -> tuple[Any, tuple[bytes, str, str, Any, Any]]: + ... + + def parse_payload(self, data, index, type_s): # -> Any: + ... + + def parse_a(self, data, index): # -> tuple[Any, str]: + ... + + def parse_aaaa(self, data, index): # -> tuple[Any, LiteralString]: + ... + + def parse_mx(self, data, index): # -> tuple[Any, tuple[Any, bytes]]: + ... + + def parse_cname(self, data, index): # -> tuple[Any, bytes]: + ... + + def parse_ns(self, data, index): # -> None: + ... + + def parse_ar(self, data, index): # -> None: + ... + + def parse_label(self, data, index): # -> tuple[Any, bytes]: + ... + + def parse_pointer(self, data, index): # -> tuple[Any, Any]: + ... + + def parse_ip4(self, data, index): # -> tuple[Any, str]: + ... + + def parse_ip6(self, data, index): # -> tuple[Any, LiteralString]: + ... + + def parse_byte(self, data, index): # -> tuple[Any, Any]: + ... + + def parse_short(self, data, index): # -> tuple[Any, Any]: + ... + + def parse_long(self, data, index): # -> tuple[Any, Any]: + ... + + def parse_long_long(self, data, index): # -> tuple[Any, Any]: + ... + + + +class DNSProtocol(netius.DatagramProtocol): + ns_file_l = ... + @classmethod + def ns_system(cls, type=...): # -> str | None: + ... + + @classmethod + def ns_conf(cls, type=..., force=...): # -> list[Any]: + ... + + @classmethod + def ns_file(cls, type=..., force=...): # -> list[Any] | None: + ... + + @classmethod + def ns_google(cls, type=...): # -> list[str] | list[Any]: + ... + + @classmethod + def ns_cloudfare(cls, type=...): # -> list[str] | list[Any]: + ... + + def query(self, name, type=..., cls=..., ns=..., callback=...): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def on_data_dns(self, address, response): # -> None: + ... + + + +class DNSClient(netius.ClientAgent): + protocol = DNSProtocol + @classmethod + def query_s(cls, name, type=..., cls_=..., ns=..., callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + + +if __name__ == "__main__": + def handler(response): # -> None: + ... + + name = ... + type = ... + ns = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/http.pyi b/src/typings/netius/clients/http.pyi new file mode 100644 index 00000000..7276bc4a --- /dev/null +++ b/src/typings/netius/clients/http.pyi @@ -0,0 +1,286 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +Z_PARTIAL_FLUSH = ... +class HTTPProtocol(netius.StreamProtocol): + """ + Implementation of the HTTP protocol to be used by a client + of the HTTP implementation to send requests and receive + responses. + """ + BASE_HEADERS = ... + def __init__(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., asynchronous=..., timeout=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., *args, **kwargs) -> None: + ... + + @classmethod + def key_g(cls, url): # -> tuple[Any, Any | Literal[443, 80], Any]: + ... + + @classmethod + def decode_gzip(cls, data): # -> bytes: + ... + + @classmethod + def decode_deflate(cls, data): # -> bytes: + ... + + @classmethod + def decode_zlib_file(cls, input, output, buffer_size=..., wbits=...): + ... + + @classmethod + def decode_gzip_file(cls, input, output, buffer_size=..., wbits=...): + ... + + @classmethod + def decode_deflate_file(cls, input, output, buffer_size=..., wbits=...): + ... + + @classmethod + def set_request(cls, parser, buffer, request=...): # -> dict[Any, Any]: + ... + + @classmethod + def set_request_file(cls, parser, input, request=..., output=..., buffer_size=...): # -> dict[Any, Any]: + ... + + @classmethod + def set_error(cls, error, message=..., request=..., force=...): # -> dict[Any, Any] | None: + ... + + def open_c(self, *args, **kwargs): # -> None: + ... + + def close_c(self, *args, **kwargs): # -> None: + ... + + def info_dict(self, full=...): # -> dict[Any, Any]: + ... + + def connection_made(self, transport): # -> None: + ... + + def loop_set(self, loop): # -> None: + ... + + def flush(self, force=..., callback=...): # -> None: + ... + + def send_base(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int | None: + ... + + def send_plain(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int: + ... + + def send_chunked(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int: + ... + + def send_gzip(self, data, stream=..., final=..., delay=..., force=..., callback=..., level=...): # -> int: + ... + + def set(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., asynchronous=..., timeout=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=...): # -> Self: + ... + + def set_all(self): # -> None: + ... + + def set_static(self): # -> None: + ... + + def set_dynamic(self): # -> None: + ... + + def run_request(self): # -> None: + ... + + def send_request(self, callback=...): + ... + + def wrap_request(self, use_file=..., callback=..., on_close=..., on_data=..., on_result=...): # -> tuple[dict[str, None], Callable[..., None], Callable[..., None], Callable[..., None]]: + """ + Wraps the current set of operations for the protocol so that + a request object is going to be created and properly populated + according to the multiple protocol events. + + This method should focus on wrapping the provided callback handlers + with ones that change the request object state. + + :type use_file: bool + :param use_file: If a filesystem based approach should be used + for the storing of the request information. + :type callback: Function + :param callback: Callback function to be called when the message + response has been completely received. + :type on_close: Function + :param on_close: Callback function to be called when the underlying + protocol is closed. + :type on_data: Function + :param on_data: Function to be called whenever some data is received + from the client side, notice that this data may be encoded (eg: gzip). + :type on_result: Function + :param on_result: Callback function to be called on the final result + with the resulting request object. + :rtype: Tuple + :return: The tuple containing both the request dictionary object that + is going to store the information for the request in the current protocol + and the multiple changed callback methods. + """ + ... + + def set_headers(self, headers, normalize=...): # -> None: + ... + + def normalize_headers(self): # -> None: + ... + + def parse(self, data): # -> int | Any: + ... + + def raw_data(self, data): # -> bytes: + """ + Tries to obtain the raw version of the provided data, taking + into account the possible content encoding present for compression + or any other kind of operation. + + :type data: String + :param data: The data to be converted back to its original + raw value (probably through decompression). + :rtype: String + :return: The final raw value for the provided data. + """ + ... + + def is_plain(self): # -> bool: + ... + + def is_chunked(self): # -> bool: + ... + + def is_gzip(self): # -> bool: + ... + + def is_deflate(self): # -> bool: + ... + + def is_compressed(self): # -> bool: + ... + + def is_uncompressed(self): # -> bool: + ... + + def is_flushed(self): # -> bool: + ... + + def is_measurable(self, strict=...): # -> bool: + ... + + def on_data(self, data): # -> None: + ... + + def on_partial(self, data): # -> None: + ... + + def on_headers(self): # -> None: + ... + + def on_chunk(self, range): # -> None: + ... + + + +class HTTPClient(netius.ClientAgent): + """ + Simple test of an HTTP client, supports a series of basic + operations and makes use of the HTTP parser from netius. + + The current implementation supports the auto-release of the + connection once the message has been received, this is optional + and may be disabled with an argument in the constructor. + """ + protocol = HTTPProtocol + def __init__(self, auto_release=..., *args, **kwargs) -> None: + ... + + @classmethod + def get_s(cls, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + @classmethod + def post_s(cls, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + @classmethod + def put_s(cls, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + @classmethod + def delete_s(cls, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + @classmethod + def method_s(cls, method, url, params=..., headers=..., data=..., version=..., safe=..., asynchronous=..., daemon=..., timeout=..., ssl_verify=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., http_client=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + @classmethod + def to_response(cls, map, raise_e=...): # -> HTTPResponse: + """ + Simple utility method that takes the classic dictionary + based request and converts it into a simple HTTP response + object to be used in a more interactive way. + + :type map: Dictionary + :param map: The dictionary backed request object that is + going to be converted into a response. + :type raise_e: bool + :param raise_e: If an exception should be raised in case + there's an error in the HTTP status field. + :rtype: HTTPResponse + :return: The normalized response value. + """ + ... + + def cleanup(self): # -> None: + ... + + def get(self, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + def post(self, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + def put(self, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + def delete(self, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + def method(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., close=..., asynchronous=..., timeout=..., ssl_verify=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: + ... + + + +if __name__ == "__main__": + buffer = ... + def on_headers(protocol, parser): # -> None: + ... + + def on_partial(protocol, parser, data): # -> None: + ... + + def on_message(protocol, parser, message): # -> None: + ... + + def on_finish(protocol): # -> None: + ... + + url = ... + client = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/mjpg.pyi b/src/typings/netius/clients/mjpg.pyi new file mode 100644 index 00000000..006ecea2 --- /dev/null +++ b/src/typings/netius/clients/mjpg.pyi @@ -0,0 +1,49 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class MJPGProtocol(http.HTTPProtocol): + MAGIC_JPEG = ... + EOI_JPEG = ... + def __init__(self, *args, **kwargs) -> None: + ... + + def add_buffer(self, data): # -> None: + ... + + def get_buffer(self, delete=...): # -> bytes: + ... + + def on_partial(self, data): # -> None: + ... + + def on_frame_mjpg(self, data): # -> None: + ... + + + +class MJPGClient(http.HTTPClient): + protocol = MJPGProtocol + + +if __name__ == "__main__": + index = ... + limit = ... + def on_frame(protocol, data): # -> None: + ... + + def on_finish(protocol): # -> None: + ... + + url = ... + client = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/raw.pyi b/src/typings/netius/clients/raw.pyi new file mode 100644 index 00000000..adc82d0d --- /dev/null +++ b/src/typings/netius/clients/raw.pyi @@ -0,0 +1,42 @@ +""" +This type stub file was generated by pyright. +""" + +import netius + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class RawProtocol(netius.StreamProtocol): + def send_basic(self): # -> None: + """ + Sends a basic HTTP 1.0 request, that can be used to + run a simple operation on the raw protocol. + """ + ... + + + +class RawClient(netius.ClientAgent): + protocol = RawProtocol + @classmethod + def run_s(cls, host, port=..., loop=..., *args, **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + + +if __name__ == "__main__": + def on_open(protocol): # -> None: + ... + + def on_data(protocol, data): # -> None: + ... + + def on_finsh(protocol): # -> None: + ... + +else: + __path__ = ... diff --git a/src/typings/netius/clients/smtp.pyi b/src/typings/netius/clients/smtp.pyi new file mode 100644 index 00000000..1beb4d4d --- /dev/null +++ b/src/typings/netius/clients/smtp.pyi @@ -0,0 +1,229 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +HELO_STATE = ... +EHLO_STATE = ... +CAPA_STATE = ... +STLS_STATE = ... +UPGRADE_STATE = ... +AUTH_STATE = ... +USERNAME_STATE = ... +PASSWORD_STATE = ... +FROM_STATE = ... +TO_STATE = ... +DATA_STATE = ... +CONTENTS_STATE = ... +QUIT_STATE = ... +FINAL_STATE = ... +class SMTPConnection(netius.Connection): + AUTH_METHODS = ... + def __init__(self, host=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def build(self): # -> None: + """ + Builds the initial set of states ordered according to + their internal integer definitions, this method provides + a fast and scalable way of parsing data. + """ + ... + + def destroy(self): # -> None: + """ + Destroys the current structure for the stats meaning that + it's restored to the original values, this method should only + be called on situation where no more client usage is required. + """ + ... + + def set_smtp(self, froms, tos, contents, username=..., password=...): # -> None: + ... + + def set_sequence(self, sequence, safe=...): # -> None: + ... + + def set_message_seq(self, ehlo=...): # -> None: + ... + + def set_message_stls_seq(self, ehlo=...): # -> None: + ... + + def set_capabilities(self, capabilities, force=...): # -> None: + ... + + def next_sequence(self): # -> None: + ... + + def parse(self, data): # -> int: + ... + + def send_smtp(self, code, message=..., delay=..., callback=...): # -> int: + ... + + def on_line(self, code, message, is_final=...): # -> None: + ... + + def call(self): # -> None: + ... + + def skip(self): # -> None: + ... + + def helo_t(self): # -> None: + ... + + def ehlo_t(self): # -> None: + ... + + def capa_t(self): # -> None: + ... + + def stls_t(self): # -> None: + ... + + def upgrade_t(self): # -> None: + ... + + def auth_t(self): # -> None: + ... + + def username_t(self): # -> None: + ... + + def password_t(self): # -> None: + ... + + def mail_t(self): # -> None: + ... + + def rcpt_t(self): # -> None: + ... + + def data_t(self): # -> None: + ... + + def contents_t(self): # -> None: + ... + + def quit_t(self): # -> None: + ... + + def close_t(self): # -> None: + ... + + def pass_t(self): # -> None: + ... + + def helo(self, host): # -> None: + ... + + def ehlo(self, host): # -> None: + ... + + def starttls(self): # -> None: + ... + + def auth(self, username, password, method=...): # -> None: + ... + + def auth_plain(self, username, password): # -> None: + ... + + def auth_login(self, username, password): # -> None: + ... + + def login_username(self, username): # -> None: + ... + + def login_password(self, password): # -> None: + ... + + def mail(self, value): # -> None: + ... + + def rcpt(self, value): # -> None: + ... + + def data(self): # -> None: + ... + + def quit(self): # -> None: + ... + + def set_expected(self, expected): # -> None: + ... + + def assert_c(self, code): # -> None: + ... + + def assert_s(self, expected): # -> None: + ... + + def best_auth(self): # -> Literal['plain']: + ... + + + +class SMTPClient(netius.StreamClient): + def __init__(self, host=..., auto_close=..., *args, **kwargs) -> None: + ... + + @classmethod + def message_s(cls, froms, tos, contents, daemon=..., host=..., mark=..., callback=...): # -> None: + ... + + def message(self, froms, tos, contents, host=..., port=..., username=..., password=..., ehlo=..., stls=..., mark=..., ensure_loop=..., callback=...): # -> None: + ... + + def on_connect(self, connection): # -> None: + ... + + def on_upgrade(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> SMTPConnection: + ... + + def mark(self, contents): # -> str: + ... + + def date(self, message): # -> None: + ... + + def user_agent(self, message): # -> None: + ... + + + +if __name__ == "__main__": + sender = ... + receiver = ... + host = ... + port = ... + username = ... + password = ... + stls = ... + mime = ... + contents = ... + client = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/ssdp.pyi b/src/typings/netius/clients/ssdp.pyi new file mode 100644 index 00000000..3fb761bc --- /dev/null +++ b/src/typings/netius/clients/ssdp.pyi @@ -0,0 +1,54 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class SSDPProtocol(netius.DatagramProtocol): + """ + Protocol implementation of the SSDP protocol meant to be + used under the UPnP standard for discovery and control of + internet activated devices. + + Using this implementation it should be possible to discover + and control devices like routes, media centers, etc. + + :see: http://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol + """ + def on_data(self, address, data): # -> None: + ... + + def on_headers_parser(self): # -> None: + ... + + def discover(self, target, *args, **kwargs): # -> None: + ... + + def method(self, method, target, namespace, mx=..., path=..., params=..., headers=..., data=..., host=..., port=..., version=..., callback=...): # -> None: + ... + + + +class SSDPClient(netius.ClientAgent): + protocol = SSDPProtocol + @classmethod + def discover_s(cls, target, *args, **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + @classmethod + def method_s(cls, method, target, namespace, mx=..., path=..., params=..., headers=..., data=..., host=..., port=..., version=..., callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + + +if __name__ == "__main__": + def on_headers(client, parser, headers): # -> None: + ... + + target = ... +else: + __path__ = ... diff --git a/src/typings/netius/clients/torrent.pyi b/src/typings/netius/clients/torrent.pyi new file mode 100644 index 00000000..d17a1a1b --- /dev/null +++ b/src/typings/netius/clients/torrent.pyi @@ -0,0 +1,132 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +HANDSHAKE_STATE = ... +NORMAL_STATE = ... +CHOKED = ... +UNCHOKED = ... +ALIVE_TIMEOUT = ... +SPEED_LIMIT = ... +BLOCK_SIZE = ... +class TorrentConnection(netius.Connection): + def __init__(self, max_requests=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def on_close(self, connection): # -> None: + ... + + def on_handshake(self, protocol, reserved, info_hash, peer_id): # -> None: + ... + + def on_message(self, length, type, data): # -> None: + ... + + def parse(self, data): # -> None: + ... + + def handle(self, type, data): # -> None: + ... + + def bitfield_t(self, data): # -> None: + ... + + def choke_t(self, data): # -> None: + ... + + def unchoke_t(self, data): # -> None: + ... + + def piece_t(self, data): # -> None: + ... + + def port_t(self, data): # -> None: + ... + + def next(self, count=...): # -> None: + ... + + def add_request(self, block): # -> None: + ... + + def remove_request(self, block): # -> None: + ... + + def reset(self): # -> None: + ... + + def release(self): # -> None: + ... + + def handshake(self): # -> None: + ... + + def keep_alive(self): # -> None: + ... + + def choke(self): # -> None: + ... + + def unchoke(self): # -> None: + ... + + def interested(self): # -> None: + ... + + def not_interested(self): # -> None: + ... + + def have(self, index): # -> None: + ... + + def request(self, index, begin=..., length=...): # -> None: + ... + + def is_alive(self, timeout=..., schedule=...): # -> Callable[[], None]: + ... + + + +class TorrentClient(netius.StreamClient): + """ + Implementation of the torrent protocol, able to download + and seed files across a peer to peer mesh network. + + The client provides a series of top level methods that + provide the main interface with the system. + + The current implementation support both a torrent file + (using trackers) strategy and also a DHT (distributed + has table) strategy for completely decentralized usage. + + :see: http://www.bittorrent.org/beps/bep_0003.html + """ + def peer(self, task, host, port, ssl=..., connection=...): + ... + + def on_connect(self, connection): # -> None: + ... + + def on_acquire(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> TorrentConnection: + ... + + + diff --git a/src/typings/netius/clients/ws.pyi b/src/typings/netius/clients/ws.pyi new file mode 100644 index 00000000..ad02b288 --- /dev/null +++ b/src/typings/netius/clients/ws.pyi @@ -0,0 +1,77 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class WSProtocol(netius.StreamProtocol): + """ + Abstract WebSockets protocol to be used for real-time bidirectional + communication on top of the HTTP protocol. + + :see: https://tools.ietf.org/html/rfc6455 + """ + MAGIC_VALUE = ... + def __init__(self, *args, **kwargs) -> None: + ... + + def connection_made(self, transport): # -> None: + ... + + def on_data(self, data): # -> None: + ... + + def on_data_ws(self, data): # -> None: + ... + + def on_handshake(self): # -> None: + ... + + def connect_ws(self, url, callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, Self]: + ... + + def send_ws(self, data, callback=...): # -> int: + ... + + def receive_ws(self, decoded): # -> None: + ... + + def add_buffer(self, data): # -> None: + ... + + def get_buffer(self, delete=...): # -> bytes: + ... + + def do_handshake(self): # -> None: + ... + + def validate_key(self): # -> None: + ... + + + +class WSClient(netius.ClientAgent): + protocol = WSProtocol + @classmethod + def connect_ws_s(cls, url, callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: + ... + + + +if __name__ == "__main__": + def on_handshake(protocol): # -> None: + ... + + def on_message(protocol, data): # -> None: + ... + + def on_close(protocol): # -> None: + ... + + url = ... +else: + __path__ = ... diff --git a/src/typings/netius/common/__init__.pyi b/src/typings/netius/common/__init__.pyi new file mode 100644 index 00000000..fe58737c --- /dev/null +++ b/src/typings/netius/common/__init__.pyi @@ -0,0 +1,34 @@ +""" +This type stub file was generated by pyright. +""" + +from . import asn, calc, dhcp, dkim, ftp, geo, http, http2, mime, parser, pop, rsa, setup, smtp, socks, stream, structures, style, tftp, tls, torrent, util, ws +from .asn import asn1_build, asn1_gen, asn1_length, asn1_parse +from .calc import ceil_integer, egcd, gcd, is_prime, jacobi, jacobi_witness, modinv, prime, random_integer_interval, random_primality, relatively_prime +from .dhcp import ACK_DHCP, AddressPool, BROADCAST_DHCP, DECLINE_DHCP, DISCOVER_DHCP, DNS_DHCP, END_DHCP, IDENTIFIER_DHCP, LEASE_DHCP, NAK_DHCP, NAME_DHCP, OFFER_DHCP, OPTIONS_DHCP, PROXY_DHCP, REBIND_DHCP, RENEWAL_DHCP, REQUESTED_DHCP, REQUEST_DHCP, ROUTER_DHCP, SUBNET_DHCP, TYPES_DHCP, VERBS_DHCP +from .dkim import dkim_body, dkim_fold, dkim_generate, dkim_headers, dkim_sign +from .ftp import FTPParser +from .geo import GeoResolver +from .http import CHUNKED_ENCODING, CODE_STRINGS, DEFLATE_ENCODING, GZIP_ENCODING, HTTPParser, HTTPResponse, HTTP_09, HTTP_10, HTTP_11, PLAIN_ENCODING, REQUEST, RESPONSE, VERSIONS_MAP +from .http2 import CONTINUATION, DATA, GOAWAY, HEADERS, HTTP2Parser, HTTP2Stream, HTTP2_NAMES, HTTP2_PREFACE, HTTP2_SETTINGS, HTTP2_SETTINGS_OPTIMAL, HTTP2_SETTINGS_OPTIMAL_T, HTTP2_SETTINGS_T, HTTP2_TUPLES, HTTP2_WINDOW, PING, PRIORITY, PUSH_PROMISE, RST_STREAM, SETTINGS, WINDOW_UPDATE +from .mime import mime_register, rfc822_join, rfc822_parse +from .parser import Parser +from .pop import POPParser +from .rsa import asn_private_key, asn_public_key, assert_private, open_pem_data, open_pem_key, open_private_key, open_private_key_b64, open_private_key_data, open_public_key, open_public_key_b64, open_public_key_data, pem_limiters, pem_to_der, private_to_public, rsa_bits, rsa_crypt, rsa_crypt_s, rsa_exponents, rsa_primes, rsa_private, rsa_sign, rsa_verify, write_pem_key, write_private_key, write_public_key +from .setup import ensure_ca, ensure_setup +from .smtp import SMTPParser +from .socks import SOCKSParser +from .tls import LetsEncryptDict, TLSContextDict +from .stream import FileStream, FilesStream, Stream +from .structures import PriorityDict, file_iterator +from .style import BASE_STYLE +from .tftp import ACK_TFTP, DATA_TFTP, ERROR_TFTP, RRQ_TFTP, TYPES_TFTP, WRQ_TFTP +from .torrent import TorrentParser, bdecode, bencode, chunk, dechunk, info_hash +from .util import addr_to_ip4, addr_to_ip6, assert_ip4, bytes_to_integer, chunks, cstring, header_down, header_up, host, hostname, in_subnet_ip4, integer_to_bytes, ip4_to_addr, is_ip4, is_ip6, random_integer, size_round_unit, string_to_bits, verify, verify_equal, verify_many, verify_not_equal, verify_type +from .ws import assert_ws, decode_ws, encode_ws + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/common/asn.pyi b/src/typings/netius/common/asn.pyi new file mode 100644 index 00000000..ca9ef7ca --- /dev/null +++ b/src/typings/netius/common/asn.pyi @@ -0,0 +1,66 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +INTEGER = ... +BIT_STRING = ... +OCTET_STRING = ... +NULL = ... +OBJECT_IDENTIFIER = ... +SEQUENCE = ... +ASN1_OBJECT = ... +ASN1_RSA_PUBLIC_KEY = ... +ASN1_RSA_PRIVATE_KEY = ... +RSAID_PKCS1 = ... +HASHID_SHA1 = ... +HASHID_SHA256 = ... +def asn1_parse(template, data): # -> list[Any]: + """ + Parse a data structure according to asn.1 template, + the provided template should respect the predefined + structure. The provided data is going to be validated + against the template format and a exception raised in + case the data is not conformant. + + :type template: List/Tuple + :param template: A list of tuples comprising the asn.1 template. + :type: List + :param data: A list of bytes to parse. + """ + ... + +def asn1_length(length): # -> _bytes | str: + """ + Returns a string representing a field length in asn.1 format. + This value is computed taking into account the multiple byte + representation of very large values. + + :type length: int + :param length:The integer based length value that is going to + be used in the conversion to a string representation. + :rtype: String + :return: The string based representation of the provided length + integer value according to the asn.1 specification. + """ + ... + +def asn1_gen(node): # -> bytes: + ... + +def asn1_build(node): # -> Generator[Any, Any, None]: + """ + Builds an asn.1 data structure based on pairs of (type, data), + this function may be used as a generator of a buffer. + + :type node: Tuple + :param node: The root node of the structure that is going to be + used as reference for the generation of the asn.1 buffer. + """ + ... + diff --git a/src/typings/netius/common/calc.pyi b/src/typings/netius/common/calc.pyi new file mode 100644 index 00000000..5a17cfcd --- /dev/null +++ b/src/typings/netius/common/calc.pyi @@ -0,0 +1,160 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def prime(number_bits): + """ + Generates a prime number with the given number of bits + in length. This is a brute force based generation as a + random number is generated and then tested for primality. + + :type number_bits: int + :param number_bits: The number of bits to be used in + the prime number generation. + :rtype: int + :return: The generated prime number, that should have + been verified for primality. + """ + ... + +def is_prime(number): # -> bool: + ... + +def relatively_prime(first, second): + ... + +def gcd(first, second): + """ + Calculates the greatest common divisor of p value and q value. + This method uses the classic euclidean algorithm. + + :type first: int + :param first: The first number to obtain the greatest + common divisor using the euclidean algorithm. + :type second: int + :param second: The second number to obtain the greatest + common divisor using the euclidean algorithm. + :rtype: int + :return: The greatest common divisor between both values. + :see: http://en.wikipedia.org/wiki/Euclidean_algorithm + """ + ... + +def egcd(first, second): # -> tuple[Any, Literal[1], Literal[0]] | tuple[Any, Any, Any]: + """ + Extended version of the greatest common divisor created + by Euclid. Computes additional coefficients of the + Bézout's identity. + + :type first: int + :param first: The first number to obtain the greatest + common divisor using the euclidean algorithm. + :type second: int + :param second: The second number to obtain the greatest + common divisor using the euclidean algorithm. + :rtype: Tuple + :return: A tuple containing the various coefficients calculated + for this extended approach of the greatest common divisor. + :see: http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm + """ + ... + +def modinv(first, second): + """ + Uses the extended greatest common divisor algorithm to compute + the modulus of an inverted value against another. + + The execution of this method is equivalent to (1 / first mod second) + using mathematical terms. + + :type first: int + :param first: The first value, that is going to be inverted before + the modulus operation is performed. + :type second: int + :param second: The second value that is going to be used as the basis + for the modulus operation. + :rtype: int + :return: The result of the computation of inverted modulus according + to its mathematical definition. + """ + ... + +def random_integer_interval(min_value, max_value): + ... + +def random_primality(number, k): # -> bool: + """ + Uses a probabilistic approach to the testing of primality + of a number. The resulting value has an error probability + of (2 ** -k), so a k value should be chosen taking a low + error as target. + + :type number: int + :param number: The value that is going to be tested for + primality. + :type k: int + :param k: The coefficient that is going to be used in the + test, the higher this value is the small the error is. + :see: http://en.wikipedia.org/wiki/Solovay%E2%80%93Strassen_primality_test + """ + ... + +def jacobi_witness(x, n): # -> bool: + """ + Checks if the given x value is witness to n value + non primality. + This check is made according to euler's theorem. + The provided value x is considered to be a witness + to n in case it is an euler's pseudo-prime with base x + + :type x: int + :param x: The value to be checked for witness. + :type n: int + :param n: The value to be checked for primality. + :rtype: bool + :return: The result of the checking, if it passed + the test or not (is witness or not). + """ + ... + +def jacobi(a, b): # -> int: + """ + Calculates the value of the jacobi symbol, using the + given a and b values. + + The possible return values for jacobi symbols are: + -1, 0 or 1. + + :type a: int + :param a: The a value of the jacobi symbol. + :type b: int + :param b: The b value of the jacobi symbol. + :rtype: int + :return: The calculated jacobi symbol, possible values + are: -1, 0 or 1. + :see: http://en.wikipedia.org/wiki/Jacobi_symbol + """ + ... + +def ceil_integer(value): # -> int: + """ + Retrieves the ceil of a value and then converts it + into a valid integer for integer computation. + The conversion to integer ensures that the ceil + is compatible with certain (integer) operations. + + :type value: int + :param value: The value to apply the ceil and that + will latter be converted into a valid integer. + :rtype: int + :return: The ceil of the given value "casted" as an + integer to be able to be used in integer math. + """ + ... + diff --git a/src/typings/netius/common/dhcp.pyi b/src/typings/netius/common/dhcp.pyi new file mode 100644 index 00000000..8e147f28 --- /dev/null +++ b/src/typings/netius/common/dhcp.pyi @@ -0,0 +1,62 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SUBNET_DHCP = ... +ROUTER_DHCP = ... +DNS_DHCP = ... +NAME_DHCP = ... +BROADCAST_DHCP = ... +REQUESTED_DHCP = ... +LEASE_DHCP = ... +DISCOVER_DHCP = ... +OFFER_DHCP = ... +REQUEST_DHCP = ... +DECLINE_DHCP = ... +ACK_DHCP = ... +NAK_DHCP = ... +IDENTIFIER_DHCP = ... +RENEWAL_DHCP = ... +REBIND_DHCP = ... +PROXY_DHCP = ... +END_DHCP = ... +OPTIONS_DHCP = ... +TYPES_DHCP = ... +VERBS_DHCP = ... +class AddressPool: + def __init__(self, start_addr, end_addr) -> None: + ... + + @classmethod + def get_next(cls, current): # -> str: + ... + + def peek(self): + ... + + def reserve(self, owner=..., lease=...): + ... + + def touch(self, addr, lease=...): # -> None: + ... + + def exists(self, addr): # -> bool: + ... + + def assigned(self, owner): + ... + + def is_valid(self, addr): + ... + + def is_owner(self, owner, addr): # -> Literal[False]: + ... + + + diff --git a/src/typings/netius/common/dkim.pyi b/src/typings/netius/common/dkim.pyi new file mode 100644 index 00000000..f456c1ff --- /dev/null +++ b/src/typings/netius/common/dkim.pyi @@ -0,0 +1,42 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def dkim_sign(message, selector, domain, private_key, identity=..., separator=..., creation=...): + ... + +def dkim_headers(headers): + ... + +def dkim_body(body): # -> bytes: + ... + +def dkim_fold(header, length=...): + """ + Folds a header line into multiple line feed separated lines + at column length defined (defaults to 72). + + This is required so that the header field is defined according + to the dkim rules and the default mime encoding. + + :type header: String + :param header: The string value of the header that is going to + be folded into multiple lines. + :type length: int + :param length: The maximum length of a column until it gets + broken into multiple lines (in case it's possible). + :rtype: String + :return: The folded string value for the header after the correct + processing of the string value. + """ + ... + +def dkim_generate(domain, suffix=..., number_bits=...): # -> dict[str, bytes | str | Any]: + ... + diff --git a/src/typings/netius/common/ftp.pyi b/src/typings/netius/common/ftp.pyi new file mode 100644 index 00000000..e45cc4a2 --- /dev/null +++ b/src/typings/netius/common/ftp.pyi @@ -0,0 +1,34 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SEPARATOR_REGEX = ... +class FTPParser(parser.Parser): + def __init__(self, owner, store=...) -> None: + ... + + def parse(self, data): # -> int: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + + diff --git a/src/typings/netius/common/geo.pyi b/src/typings/netius/common/geo.pyi new file mode 100644 index 00000000..553e9387 --- /dev/null +++ b/src/typings/netius/common/geo.pyi @@ -0,0 +1,26 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class GeoResolver: + DB_NAME = ... + DOWNLOAD_URL = ... + VALID = ... + PREFIXES = ... + _db = ... + @classmethod + def resolve(cls, address, simplified=...): # -> None: + ... + + + +if __name__ == "__main__": + prefix = ... +else: + __path__ = ... diff --git a/src/typings/netius/common/http.pyi b/src/typings/netius/common/http.pyi new file mode 100644 index 00000000..3464fa73 --- /dev/null +++ b/src/typings/netius/common/http.pyi @@ -0,0 +1,210 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +FILE_LIMIT = ... +REQUEST = ... +RESPONSE = ... +LINE_STATE = ... +HEADERS_STATE = ... +MESSAGE_STATE = ... +FINISH_STATE = ... +PLAIN_ENCODING = ... +CHUNKED_ENCODING = ... +GZIP_ENCODING = ... +DEFLATE_ENCODING = ... +HTTP_09 = ... +HTTP_10 = ... +HTTP_11 = ... +VERSIONS_MAP = ... +CODE_STRINGS = ... +HEADER_NAME_REGEX = ... +class HTTPParser(parser.Parser): + """ + Parser object for the HTTP format, should be able to + parse both request and response messages. + + The parser itself should be event driven an callback + functions should be called upon partials information + parsing. But the object itself is not thread safe. + """ + FIELDS = ... + def __init__(self, owner, type=..., store=..., file_limit=...) -> None: + ... + + def build(self): # -> None: + """ + Builds the initial set of states ordered according to + their internal integer definitions, this method provides + a fast and scalable way of parsing data. + """ + ... + + def destroy(self): # -> None: + """ + Destroys the current structure for the parser meaning that + it's restored to the original values, this method should only + be called on situation where no more parser usage is required. + """ + ... + + def reset(self, type=..., store=..., file_limit=...): # -> None: + """ + Initializes the state of the parser setting the values + for the various internal structures to the original value. + After this operation the parser is ready for a new parse. + + :type type: int + :param type: The type of HTTP message that is going to be + parsed using the current parser. + :type store: bool + :param store: If the complete message body should be stored + in memory as the message gets loaded, this option may create + some serious performance issues. + :type file_limit: int + :param file_limit: The maximum content for the payload message + from which a in file buffer will be used instead of the one that + is stored in memory (avoid memory starvation). + """ + ... + + def clear(self, force=...): # -> None: + ... + + def close(self): # -> None: + ... + + def get_path(self, normalize=...): # -> bytes | str: + """ + Retrieves the path associated with the request, this + value should be interpreted from the HTTP status line. + + In case the normalize flag is set a possible absolute + URL value should be normalized into an absolute path. + This may be required under some proxy related scenarios. + + :type normalize: bool + :param normalize: If the normalization process should be + applied for absolute URL scenarios. + :rtype: String + :return: The path associated with the current request. + """ + ... + + def get_query(self): # -> bytes | str: + """ + Retrieves the (GET) query part of the path, this is considered + to be the part of the path after the first question mark. + + This query string may be used to parse any possible (GET) + arguments. + + :rtype: String + :return: The query part of the path, to be used for parsing + of (GET) arguments. + """ + ... + + def get_message(self): # -> bytes | str: + """ + Gathers the complete set of message contents for the current + request/response in parsing. The proper gathering strategy will + depend on the current strategy (eg: in memory vs file strategies). + + The result of this process is cached meaning that further calls + to this method will return the same result. + + This method should be used carefully as it may create some memory + performance issues when retrieving large message values. + + :rtype: String + :return: The message for the current parsing process as a linear + string value that may be used as a simple buffer. + """ + ... + + def get_message_f(self): # -> bytes | str: + ... + + def get_message_b(self, copy=..., size=...): # -> BytesIO | StringIO | _TemporaryFileWrapper[bytes]: + """ + Retrieves a new buffer associated with the currently + loaded message, the first time this method is called a + new in memory object will be created for the storage. + + In case the current parsing operation is using a file like + object for the handling this object it is returned instead. + + The call of this method is only considered to be safe after + the complete message has been received and processed, otherwise + and invalid message file structure may be created. + + Note that the returned object will always be set at the + beginning of the file, so some care should be taken in usage. + + :type copy: bool + :param copy: If a copy of the file object should be returned + or if instead the shallow copy associated with the parser should + be returned instead, this should be used carefully to avoid any + memory leak from file descriptors. + :type size: int + :param size: Size (in bytes) of the buffer to be used in a possible + copy operation between buffers. + :rtype: File + :return: The file like object that may be used to percolate + over the various parts of the current message contents. + """ + ... + + def get_headers(self): # -> dict[Any, Any]: + ... + + def get_encodings(self): # -> list[Any]: + ... + + def parse(self, data): # -> int | Any: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + + +class HTTPResponse: + def __init__(self, data=..., code=..., status=..., headers=...) -> None: + ... + + def read(self): # -> None: + ... + + def readline(self): # -> None: + ... + + def close(self): # -> None: + ... + + def getcode(self): # -> int: + ... + + def info(self): # -> None: + ... + + + diff --git a/src/typings/netius/common/http2.pyi b/src/typings/netius/common/http2.pyi new file mode 100644 index 00000000..3dd7b97f --- /dev/null +++ b/src/typings/netius/common/http2.pyi @@ -0,0 +1,468 @@ +""" +This type stub file was generated by pyright. +""" + +import contextlib +import netius +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +HEADER_SIZE = ... +SETTING_SIZE = ... +DATA = ... +HEADERS = ... +PRIORITY = ... +RST_STREAM = ... +SETTINGS = ... +PUSH_PROMISE = ... +PING = ... +GOAWAY = ... +WINDOW_UPDATE = ... +CONTINUATION = ... +PROTOCOL_ERROR = ... +INTERNAL_ERROR = ... +FLOW_CONTROL_ERROR = ... +SETTINGS_TIMEOUT = ... +STREAM_CLOSED = ... +FRAME_SIZE_ERROR = ... +REFUSED_STREAM = ... +CANCEL = ... +COMPRESSION_ERROR = ... +CONNECT_ERROR = ... +ENHANCE_YOUR_CALM = ... +INADEQUATE_SECURITY = ... +HTTP_1_1_REQUIRED = ... +SETTINGS_HEADER_TABLE_SIZE = ... +SETTINGS_ENABLE_PUSH = ... +SETTINGS_MAX_CONCURRENT_STREAMS = ... +SETTINGS_INITIAL_WINDOW_SIZE = ... +SETTINGS_MAX_FRAME_SIZE = ... +SETTINGS_MAX_HEADER_LIST_SIZE = ... +HTTP_20 = ... +HEADER_STATE = ... +PAYLOAD_STATE = ... +FINISH_STATE = ... +HTTP2_WINDOW = ... +HTTP2_FRAME_SIZE = ... +HTTP2_PREFACE = ... +HTTP2_PSEUDO = ... +HTTP2_TUPLES = ... +HTTP2_NAMES = ... +HTTP2_SETTINGS = ... +HTTP2_SETTINGS_OPTIMAL = ... +HTTP2_SETTINGS_T = ... +HTTP2_SETTINGS_OPTIMAL_T = ... +class HTTP2Parser(parser.Parser): + FIELDS = ... + def __init__(self, owner, store=..., file_limit=...) -> None: + ... + + def build(self): # -> None: + """ + Builds the initial set of states ordered according to + their internal integer definitions, this method provides + a fast and scalable way of parsing data. + """ + ... + + def destroy(self): # -> None: + """ + Destroys the current structure for the parser meaning that + it's restored to the original values, this method should only + be called on situation where no more parser usage is required. + """ + ... + + def info_dict(self): # -> dict[Any, Any]: + ... + + def info_streams(self): # -> list[Any]: + ... + + def reset(self, store=..., file_limit=...): # -> None: + ... + + def clear(self, force=..., save=...): # -> None: + ... + + def close(self): # -> None: + ... + + def parse(self, data): # -> int | Any: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + def get_type_s(self, type): # -> str | None: + """ + Retrieves the string based representation of the frame + type according to the HTTP2 specification. + + :type type: int + :param type: The frame type as an integer that is going + to be converted to the string representation. + :rtype: String + :return: The string based representation of the frame type. + """ + ... + + def assert_header(self): # -> None: + """ + Runs a series of assertion operations related with the + header of the frame, making sure it remains compliant + with the HTTP 2 specification. + """ + ... + + def assert_stream(self, stream): # -> None: + ... + + def assert_data(self, stream, end_stream): # -> None: + ... + + def assert_headers(self, stream, end_stream): # -> None: + ... + + def assert_priority(self, stream, dependency): # -> None: + ... + + def assert_rst_stream(self, stream): # -> None: + ... + + def assert_settings(self, settings, ack, extended=...): # -> None: + ... + + def assert_push_promise(self, promised_stream): + ... + + def assert_ping(self): # -> None: + ... + + def assert_goaway(self): # -> None: + ... + + def assert_window_update(self, stream, increment): # -> None: + ... + + def assert_continuation(self, stream): # -> None: + ... + + @property + def type_s(self): # -> str | None: + ... + + @property + def buffer_size(self): # -> int: + ... + + @property + def buffer_data(self, empty=...): # -> bytes: + ... + + @property + def encoder(self): + ... + + @property + def decoder(self): + ... + + + +class HTTP2Stream(netius.Stream): + """ + Object representing a stream of data interchanged between two + peers under the HTTP 2 protocol. + + A stream may be considered a node in a tree of dependencies, + the children references are stored on the parent node. + + Should be compatible with both the parser and the connection + interfaces and may be used for both types of operations. + + :see: https://tools.ietf.org/html/rfc7540 + """ + def __init__(self, identifier=..., header_b=..., dependency=..., weight=..., exclusive=..., end_headers=..., end_stream=..., end_stream_l=..., store=..., file_limit=..., window=..., frame_size=..., *args, **kwargs) -> None: + ... + + def __getattr__(self, name): # -> Any: + ... + + def reset(self, store=..., file_limit=..., window=..., frame_size=...): # -> None: + ... + + def open(self): # -> None: + ... + + def close(self, flush=..., destroy=..., reset=...): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, int]: + ... + + def available(self): # -> None: + """ + Method called upon the become available event triggered + when a blocked stream becomes "unblocked" again, this is a + level operation that is only called once. + """ + ... + + def unavailable(self): # -> None: + """ + Called whenever an "unblocked" stream becomes "blocked" again + this is called only upon the "edge" (once). After this event + the stream should no longer send frames containing data. + """ + ... + + def set_encoding(self, encoding): # -> None: + ... + + def set_uncompressed(self): # -> None: + ... + + def set_plain(self): # -> None: + ... + + def set_chunked(self): # -> None: + ... + + def set_gzip(self): # -> None: + ... + + def set_deflate(self): # -> None: + ... + + def is_plain(self): # -> bool: + ... + + def is_chunked(self): # -> bool: + ... + + def is_gzip(self): # -> bool: + ... + + def is_deflate(self): # -> bool: + ... + + def is_compressed(self): # -> bool: + ... + + def is_uncompressed(self): # -> bool: + ... + + def is_flushed(self): # -> bool: + ... + + def is_measurable(self, strict=...): # -> bool: + ... + + def is_exhausted(self): # -> bool: + ... + + def is_restored(self): # -> bool: + ... + + def decode_headers(self, force=..., assert_h=...): # -> None: + ... + + def extend_headers(self, fragment): # -> None: + """ + Extends the headers data buffer with the provided + data fragment. This method may be used for adding + headers data coming from a continuation frame. + + :type fragment: String + :param fragment: The data fragment to be used in + the extension of the headers data. + """ + ... + + def extend_data(self, data): # -> None: + """ + Adds a data chunk to the buffer associated with the + stream. Note that the buffer is only populated in case + the store flag is currently set. + + Even if the store flag is not set this method should be + called whenever a new data chunk is received in the stream. + + :type data: String + :param data: The data chunk to be added to the stream's + internal buffers. + """ + ... + + def remote_update(self, increment): # -> None: + """ + Updates the remote window value, the remote windows is + the window that controls the output stream of bytes and + should represent the number of available bytes in the + remote peer that can be immediately processed. + + :type increment: int + :param increment: The increment in bytes to be added to + the current remote window value, this value may be negative. + """ + ... + + def local_update(self, increment): # -> None: + """ + Increments the current local window value with the increment + (in bytes) passed as parameter. + + The local window represents the number of bytes that can be + processed in the current local buffer, effectively representing + the number of bytes that may still be received in the stream. + + In case the window threshold is reached the method triggers + the sending of the window update frame. + + :type increment: int + :param increment: The number of bytes that are going to be + incremented in the local window value. + """ + ... + + def get_path(self, normalize=...): # -> str: + """ + Retrieves the path associated with the request, this + value should be interpreted from the HTTP status line. + + In case the normalize flag is set a possible absolute + URL value should be normalized into an absolute path. + This may be required under some proxy related scenarios. + + :type normalize: bool + :param normalize: If the normalization process should be + applied for absolute URL scenarios. + :rtype: String + :return: The path associated with the current request. + """ + ... + + def get_query(self): # -> str: + """ + Retrieves the (GET) query part of the path, this is considered + to be the part of the path after the first question mark. + + This query string may be used to parse any possible (GET) + arguments. + + :rtype: String + :return: The query part of the path, to be used for parsing + of (GET) arguments. + """ + ... + + def get_message_b(self, copy=..., size=...): # -> _TemporaryFileWrapper[bytes] | BytesIO | StringIO | None: + """ + Retrieves a new buffer associated with the currently + loaded message. + + In case the current parsing operation is using a file like + object for the handling this object it is returned instead. + + The call of this method is only considered to be safe after + the complete message has been received and processed, otherwise + and invalid message file structure may be created. + + Note that the returned object will always be set at the + beginning of the file, so some care should be taken in usage. + + :type copy: bool + :param copy: If a copy of the file object should be returned + or if instead the shallow copy associated with the parser should + be returned instead, this should be used carefully to avoid any + memory leak from file descriptors. + :type size: int + :param size: Size (in bytes) of the buffer to be used in a possible + copy operation between buffers. + :rtype: File + :return: The file like object that may be used to percolate + over the various parts of the current message contents. + """ + ... + + def get_encodings(self): # -> list[Any]: + ... + + def fragment(self, data): # -> Generator[Any, Any, None]: + ... + + def fragmentable(self, data): # -> bool: + ... + + def flush(self, *args, **kwargs): # -> Literal[0]: + ... + + def flush_s(self, *args, **kwargs): # -> Literal[0]: + ... + + def send_response(self, *args, **kwargs): # -> Literal[0]: + ... + + def send_header(self, *args, **kwargs): # -> Literal[0]: + ... + + def send_part(self, *args, **kwargs): # -> Literal[0]: + ... + + def send_reset(self, *args, **kwargs): # -> Literal[0]: + ... + + def assert_headers(self): # -> None: + ... + + def assert_ready(self): # -> None: + ... + + @contextlib.contextmanager + def ctx_request(self, args=..., kwargs=...): # -> Generator[None, Any, None]: + ... + + @property + def parser(self): # -> Self: + ... + + @property + def is_ready(self, calculate=..., assert_r=...): # -> bool: + """ + Determines if the stream is ready, meaning that the complete + set of headers and data have been passed to peer and the request + is ready to be passed to underlying layers for processing. + + :type calculate: bool + :param calculate: If the calculus of the content length should be + taken into consideration meaning that the content/data length should + be ensured to be calculated. + :type assert_r: bool + :param assert_r: If the extra assert (ready) operation should be + performed to ensure that proper data values are defined in the request. + :rtype: bool + :return: The final value on the is ready (for processing). + """ + ... + + @property + def is_headers(self): # -> bool: + ... + + + diff --git a/src/typings/netius/common/mime.pyi b/src/typings/netius/common/mime.pyi new file mode 100644 index 00000000..1eb8bb0f --- /dev/null +++ b/src/typings/netius/common/mime.pyi @@ -0,0 +1,81 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +LINE_REGEX = ... +SPACE_REGEX = ... +HEADER_NAME_REGEX = ... +MIME_TYPES = ... +MIME_REGISTERED = ... +class Headers(list): + """ + Mutable structure that allow the access to header tuples + using both a list style strategy and a dictionary based + strategy, providing easy manipulation of the items. + + The order of insertion is preserved so that it may be + respected if a re-construction of the message is required. + """ + def __getitem__(self, key): + ... + + def __setitem__(self, key, value): # -> None: + ... + + def __delitem__(self, key): # -> None: + ... + + def __contains__(self, item): # -> bool: + ... + + def item(self, key): + ... + + def get(self, key, default=...): # -> None: + ... + + def set(self, key, value, append=...): # -> None: + ... + + def pop(self, key, default=...): # -> None: + ... + + def join(self, separator=...): # -> bytes | str: + ... + + + +def rfc822_parse(message, strip=...): # -> tuple[Headers, bytes]: + """ + Parse a message in rfc822 format. This format is similar to + the mime one with only some small changes. The returning value + for this function a set of dictionary tuples and the body of + the processed message as a standard encoded string. + + :type message: String + :param message: The message in rfc822 format, with both carriage + return and line feed support. + :type strip: bool + :param strip: If the initial white spaces in the first header line + should be removed and the proper abstract structure created with no + extra space values (no strict representation). This should not be + used when the strict representation of the headers is required + (eg: for cryptographic signing purposes). + :rtype: Tuple + :return: Returns a tuple of headers and body where headers is + a list of (name and value) pairs. + """ + ... + +def rfc822_join(headers, body): + ... + +def mime_register(): # -> None: + ... + diff --git a/src/typings/netius/common/parser.pyi b/src/typings/netius/common/parser.pyi new file mode 100644 index 00000000..e717bed1 --- /dev/null +++ b/src/typings/netius/common/parser.pyi @@ -0,0 +1,41 @@ +""" +This type stub file was generated by pyright. +""" + +import netius + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Parser(netius.Observable): + FIELDS = ... + def __init__(self, owner) -> None: + ... + + @classmethod + def mock(cls, owner, state): # -> Self: + ... + + def build(self): # -> None: + ... + + def destroy(self): # -> None: + ... + + def get_state(self): # -> dict[Any, Any]: + ... + + def set_state(self, state): # -> None: + ... + + def info_dict(self): # -> dict[Any, Any]: + ... + + def parse(self, data): # -> None: + ... + + + diff --git a/src/typings/netius/common/pop.pyi b/src/typings/netius/common/pop.pyi new file mode 100644 index 00000000..4d82da9e --- /dev/null +++ b/src/typings/netius/common/pop.pyi @@ -0,0 +1,33 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class POPParser(parser.Parser): + def __init__(self, owner, store=...) -> None: + ... + + def parse(self, data): # -> int: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + + diff --git a/src/typings/netius/common/rsa.pyi b/src/typings/netius/common/rsa.pyi new file mode 100644 index 00000000..0d96a436 --- /dev/null +++ b/src/typings/netius/common/rsa.pyi @@ -0,0 +1,134 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +PRIVATE_TOKEN = ... +PUBLIC_TOKEN = ... +def open_pem_key(path, token=...): # -> bytes: + ... + +def open_pem_data(data, token=...): # -> bytes: + ... + +def write_pem_key(path, data, token=..., width=...): # -> None: + ... + +def open_private_key(path): # -> dict[str, int]: + ... + +def open_private_key_b64(data_b64): # -> dict[str, int]: + ... + +def open_private_key_data(data): # -> dict[str, int]: + ... + +def open_public_key(path): # -> dict[str, int]: + ... + +def open_public_key_b64(data_b64): # -> dict[str, int]: + ... + +def open_public_key_data(data): # -> dict[str, int]: + ... + +def write_private_key(path, private_key): # -> None: + ... + +def write_public_key(path, public_key): # -> None: + ... + +def asn_private_key(private_key): # -> bytes: + ... + +def asn_public_key(public_key): # -> bytes: + ... + +def pem_to_der(in_path, out_path, token=...): # -> None: + ... + +def pem_limiters(token): # -> tuple[Any | _bytes, Any | _bytes]: + ... + +def private_to_public(private_key): # -> dict[str, Any]: + ... + +def assert_private(private_key, number_bits=...): # -> None: + ... + +def rsa_private(number_bits): # -> dict[str, int]: + """ + Generates a new "random" private with the requested number + of bits as the base for exponents and modulus. + + This method is extremely time consuming in terms of processor + and should be used carefully to avoid any problem. + + :type number_bits: int + :param number_bits: The number of bits that are going to be + used for the generation of the private key. + :rtype: Dictionary + :return: The generated private key structure, may then be used + for processing or written to a file. + """ + ... + +def rsa_primes(number_bits): # -> tuple[Any, Any]: + """ + Generates two different prime numbers (p and q values) + and returns them inside a tuple structure. + + The generation is made according to the number of bits + defined and using a trial and error strategy (expensive). + + :type number_bits: int + :param number_bits: The number of bits to be used in + prime generation, this affects security. + :rtype: Tuple + :return: A tuple containing the two different prime + numbers to be returned. + """ + ... + +def rsa_exponents(prime_1, prime_2, number_bits, basic=...): # -> tuple[Any | Literal[65537], Any | Literal[1]]: + """ + Generates both the public and the private exponents for + the RSA cryptography system taking as base the provided + prime numbers and the amount of bits for the values. + + :type prime_1: int + :param prime_1: The first prime number use for RSA. + :type prime_2: int + :param prime_2: The second prime number use for RSA. + :type number_bits: int + :param number_bits: The number of bits that are going to be + used for the generation of the values. + :type basic: bool + :param basic: If the basic approach to the generation of the + public exponent should be taken into account. + :rtype: Tuple + :return: The tuple containing the generated public and + private keys (properly tested). + """ + ... + +def rsa_bits(modulus): # -> int: + ... + +def rsa_sign(message, private_key): # -> LiteralString | bytes: + ... + +def rsa_verify(signature, public_key): # -> LiteralString | bytes: + ... + +def rsa_crypt_s(message, exponent, modulus): # -> LiteralString | bytes: + ... + +def rsa_crypt(number, exponent, modulus): + ... + diff --git a/src/typings/netius/common/setup.pyi b/src/typings/netius/common/setup.pyi new file mode 100644 index 00000000..f3e63a37 --- /dev/null +++ b/src/typings/netius/common/setup.pyi @@ -0,0 +1,21 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +CA_URL = ... +COMMON_PATH = ... +BASE_PATH = ... +EXTRAS_PATH = ... +SSL_CA_PATH = ... +def ensure_setup(): # -> None: + ... + +def ensure_ca(path=...): # -> None: + ... + diff --git a/src/typings/netius/common/smtp.pyi b/src/typings/netius/common/smtp.pyi new file mode 100644 index 00000000..6eb0e37b --- /dev/null +++ b/src/typings/netius/common/smtp.pyi @@ -0,0 +1,34 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SEPARATOR_REGEX = ... +class SMTPParser(parser.Parser): + def __init__(self, owner, store=...) -> None: + ... + + def parse(self, data): # -> int: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + + diff --git a/src/typings/netius/common/socks.pyi b/src/typings/netius/common/socks.pyi new file mode 100644 index 00000000..d5c285c1 --- /dev/null +++ b/src/typings/netius/common/socks.pyi @@ -0,0 +1,75 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +IPV4 = ... +IPV6 = ... +DOMAIN = ... +VERSION_STATE = ... +HEADER_STATE = ... +USER_ID_STATE = ... +DOMAIN_STATE = ... +AUTH_COUNT_STATE = ... +AUTH_METHODS_STATE = ... +HEADER_EXTRA_STATE = ... +SIZE_STATE = ... +ADDRESS_STATE = ... +PORT_STATE = ... +FINISH_STATE = ... +class SOCKSParser(parser.Parser): + def __init__(self, owner) -> None: + ... + + def build(self): # -> None: + """ + Builds the initial set of states ordered according to + their internal integer definitions, this method provides + a fast and scalable way of parsing data. + """ + ... + + def destroy(self): # -> None: + """ + Destroys the current structure for the parser meaning that + it's restored to the original values, this method should only + be called on situation where no more parser usage is required. + """ + ... + + def reset(self): # -> None: + ... + + def clear(self, force=...): # -> None: + ... + + def parse(self, data): # -> int | Any: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + def get_host(self): # -> bytes | str | None: + ... + + def get_address(self): # -> bytes | None: + ... + + + diff --git a/src/typings/netius/common/stream.pyi b/src/typings/netius/common/stream.pyi new file mode 100644 index 00000000..85c55c5d --- /dev/null +++ b/src/typings/netius/common/stream.pyi @@ -0,0 +1,79 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Stream: + def open(self, mode=...): + ... + + def close(self): + ... + + def seek(self, offset): + ... + + def read(self, size): + ... + + def write(self, data): + ... + + def flish(self): + ... + + + +class FileStream(Stream): + def __init__(self, path, size) -> None: + ... + + def open(self, mode=..., allocate=...): # -> None: + ... + + def close(self): # -> None: + ... + + def seek(self, offset): # -> None: + ... + + def read(self, size): # -> Any: + ... + + def write(self, data): # -> None: + ... + + def flush(self): # -> None: + ... + + + +class FilesStream(Stream): + def __init__(self, dir_path, size, files_m) -> None: + ... + + def open(self, mode=..., allocate=...): # -> None: + ... + + def close(self): # -> None: + ... + + def seek(self, offset): # -> None: + ... + + def read(self, size): # -> bytes: + ... + + def write(self, data): # -> None: + ... + + def flush(self): # -> None: + ... + + + diff --git a/src/typings/netius/common/structures.pyi b/src/typings/netius/common/structures.pyi new file mode 100644 index 00000000..e1a3b1e1 --- /dev/null +++ b/src/typings/netius/common/structures.pyi @@ -0,0 +1,37 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class PriorityDict(dict): + def __init__(self, *args, **kwargs) -> None: + ... + + def __setitem__(self, key, val): # -> None: + ... + + def smallest(self): + ... + + def pop_smallest(self): + ... + + def setdefault(self, key, val): + ... + + def update(self, *args, **kwargs): # -> None: + ... + + def sorted_iter(self): # -> Generator[Any, Any, None]: + ... + + + +def file_iterator(file_object, chunk_size=...): # -> Generator[Any, Any, None]: + ... + diff --git a/src/typings/netius/common/style.pyi b/src/typings/netius/common/style.pyi new file mode 100644 index 00000000..3a1327ba --- /dev/null +++ b/src/typings/netius/common/style.pyi @@ -0,0 +1,11 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BASE_STYLE = ... diff --git a/src/typings/netius/common/tftp.pyi b/src/typings/netius/common/tftp.pyi new file mode 100644 index 00000000..a1e1a130 --- /dev/null +++ b/src/typings/netius/common/tftp.pyi @@ -0,0 +1,16 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +RRQ_TFTP = ... +WRQ_TFTP = ... +DATA_TFTP = ... +ACK_TFTP = ... +ERROR_TFTP = ... +TYPES_TFTP = ... diff --git a/src/typings/netius/common/tls.pyi b/src/typings/netius/common/tls.pyi new file mode 100644 index 00000000..a6af10d0 --- /dev/null +++ b/src/typings/netius/common/tls.pyi @@ -0,0 +1,40 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class TLSContextDict(dict): + def __init__(self, owner, domains, *args, **kwargs) -> None: + ... + + def load(self, domains): # -> None: + ... + + def has_definition(self, domain): # -> bool: + ... + + def cer_path(self, domain): + ... + + def key_path(self, domain): + ... + + + +class LetsEncryptDict(TLSContextDict): + def __init__(self, owner, domains, *args, **kwargs) -> None: + ... + + def cer_path(self, domain): # -> str: + ... + + def key_path(self, domain): # -> str: + ... + + + diff --git a/src/typings/netius/common/torrent.pyi b/src/typings/netius/common/torrent.pyi new file mode 100644 index 00000000..afad3cae --- /dev/null +++ b/src/typings/netius/common/torrent.pyi @@ -0,0 +1,67 @@ +""" +This type stub file was generated by pyright. +""" + +from . import parser + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +HANDSHAKE_SIZE = ... +DECIMAL_REGEX = ... +TORRENT_TYPES = ... +def info_hash(root): # -> bytes: + ... + +def bencode(root): # -> bytes: + ... + +def bdecode(data): # -> dict[Any, Any] | list[Any] | int | LiteralString: + ... + +def chunk(item): # -> Generator[Any | _bytes | str, Any, None]: + ... + +def dechunk(chunks): # -> dict[Any, Any] | list[Any] | int | LiteralString: + ... + +class TorrentParser(parser.Parser): + def __init__(self, owner, store=...) -> None: + ... + + def build(self): # -> None: + """ + Builds the initial set of states ordered according to + their internal integer definitions, this method provides + a fast and scalable way of parsing data. + """ + ... + + def destroy(self): # -> None: + """ + Destroys the current structure for the parser meaning that + it's restored to the original values, this method should only + be called on situation where no more parser usage is required. + """ + ... + + def parse(self, data): # -> int | Any: + """ + Parses the provided data chunk, changing the current + state of the parser accordingly and returning the + number of processed bytes from it. + + :type data: String + :param data: The string containing the data to be parsed + in the current parse operation. + :rtype: int + :return: The amount of bytes of the data string that have + been "parsed" in the current parse operation. + """ + ... + + + diff --git a/src/typings/netius/common/util.pyi b/src/typings/netius/common/util.pyi new file mode 100644 index 00000000..44913713 --- /dev/null +++ b/src/typings/netius/common/util.pyi @@ -0,0 +1,181 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SIZE_UNITS_LIST = ... +SIZE_UNITS_LIST_S = ... +SIZE_UNIT_COEFFICIENT = ... +DEFAULT_MINIMUM = ... +DEFAULT_PLACES = ... +_HOST = ... +def cstring(value): + ... + +def chunks(sequence, count): # -> Generator[Any, Any, None]: + ... + +def header_down(name): # -> LiteralString: + ... + +def header_up(name): # -> LiteralString: + ... + +def is_ip4(address): # -> bool: + ... + +def is_ip6(address): # -> bool: + ... + +def assert_ip4(address, allowed, default=...): # -> bool: + ... + +def in_subnet_ip4(address, subnet): # -> Any: + ... + +def addr_to_ip4(number): # -> str: + ... + +def addr_to_ip6(number): # -> LiteralString: + ... + +def ip4_to_addr(value): # -> int: + ... + +def string_to_bits(value): # -> str: + ... + +def integer_to_bytes(number, length=...): # -> LiteralString | bytes: + ... + +def bytes_to_integer(bytes): # -> int: + ... + +def random_integer(number_bits): + """ + Generates a random integer of approximately the + size of the provided number bits bits rounded up + to whole bytes. + + :type number_bits: int + :param number_bits: The number of bits of the generated + random integer, this value will be used as the basis + for the calculus of the required bytes. + :rtype: int + :return: The generated random integer, should be provided + with the requested size. + """ + ... + +def host(default=...): # -> bytes | str: + """ + Retrieves the host for the current machine, + typically this would be the ipv4 address of + the main network interface. + + No result type are guaranteed and a local address + (eg: 127.0.0.1) may be returned instead. + + The returned value is cached to avoid multiple + blocking calls from blocking the processor. + + :type default: String + :param default: The default value that is going to + be returned in case no resolution is possible, take + into account that this result is going to be cached. + :rtype: Strong + :return: The string that contains the host address + as defined by specification for the current machine. + """ + ... + +def hostname(): # -> str: + """ + The name as a simple string o the name of the current + local machine. This value may or may not be a fully + qualified domain name for the machine. + + The result of this function call is unpredictable and + should not be trusted for critical operations. + + :rtype: String + :return: The name as a string of the current local + machine, the definition of this value varies. + """ + ... + +def size_round_unit(size_value, minimum=..., places=..., reduce=..., space=..., justify=..., simplified=..., depth=...): + """ + Rounds the size unit, returning a string representation + of the value with a good rounding precision. + This method should be used to round data sizing units. + + Note that using the places parameter it's possible to control + the number of digits (including decimal places) of the + number that is going to be "generated". + + :type size_value: int/float + :param size_value: The current size value (in bytes). + :type minimum: int + :param minimum: The minimum value to be used. + :type places: int + :param places: The target number of digits to be used for + describing the value to be used for output, this is going + to be used to calculate the proper number of decimal places. + :type reduce: bool + :param reduce: If the final string value should be reduced + meaning that right decimal zeros should be removed as they + represent an extra unused value. + :type space: bool + :param space: If a space character must be used dividing + the value from the unit symbol. + :type justify: bool + :param justify: If the size string value should be (right) + justified important for properly aligned values in a table. + :type simplified: bool + :param simplified: If the simplified version of the units + should be used instead of the longer one. + :type depth: int + :param depth: The current iteration depth value. + :rtype: String + :return: The string representation of the data size + value in a simplified manner (unit). + """ + ... + +def verify(condition, message=..., exception=...): # -> None: + """ + Ensures that the requested condition returns a valid value + and if that's no the case an exception raised breaking the + current execution logic. + + :type condition: bool + :param condition: The condition to be evaluated and that may + trigger an exception raising. + :type message: String + :param message: The message to be used in the building of the + exception that is going to be raised in case of condition failure. + :type exception: Class + :param exception: The exception class that is going to be used + to build the exception to be raised in case the condition + verification operation fails. + """ + ... + +def verify_equal(first, second, message=..., exception=...): # -> None: + ... + +def verify_not_equal(first, second, message=..., exception=...): # -> None: + ... + +def verify_type(value, types, null=..., message=..., exception=..., **kwargs): # -> None: + ... + +def verify_many(sequence, message=..., exception=...): # -> None: + ... + diff --git a/src/typings/netius/common/ws.pyi b/src/typings/netius/common/ws.pyi new file mode 100644 index 00000000..2d07af27 --- /dev/null +++ b/src/typings/netius/common/ws.pyi @@ -0,0 +1,19 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def encode_ws(data, final=..., opcode=..., mask=...): # -> bytes: + ... + +def decode_ws(data): # -> tuple[Any, Literal[b""]] | tuple[bytes, Any]: + ... + +def assert_ws(data_l, size): # -> None: + ... + diff --git a/src/typings/netius/examples/__init__.pyi b/src/typings/netius/examples/__init__.pyi new file mode 100644 index 00000000..38927725 --- /dev/null +++ b/src/typings/netius/examples/__init__.pyi @@ -0,0 +1,13 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http, upnp +from .http import http_callback, http_static +from .upnp import upnp_map + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/examples/http.pyi b/src/typings/netius/examples/http.pyi new file mode 100644 index 00000000..b8eb17e0 --- /dev/null +++ b/src/typings/netius/examples/http.pyi @@ -0,0 +1,16 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def http_static(): # -> None: + ... + +def http_callback(): # -> None: + ... + diff --git a/src/typings/netius/examples/upnp.pyi b/src/typings/netius/examples/upnp.pyi new file mode 100644 index 00000000..c2fb6502 --- /dev/null +++ b/src/typings/netius/examples/upnp.pyi @@ -0,0 +1,22 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def upnp_map(ext_port, int_port, host, protocol=..., description=...): # -> None: + """ + Defines a router port forwarding rule using an UPnP based + request that tries to find the first available router. + + In case there's no available router with UPnP features the + client may become idle, leaking memory. + + :see: http://www.upnp.org/specs/gw/UPnP-gw-WANIPConnection-v1-Service.pdf + """ + ... + diff --git a/src/typings/netius/extra/__init__.pyi b/src/typings/netius/extra/__init__.pyi new file mode 100644 index 00000000..d1fcf287 --- /dev/null +++ b/src/typings/netius/extra/__init__.pyi @@ -0,0 +1,20 @@ +""" +This type stub file was generated by pyright. +""" + +from . import desktop, dhcp_s, file, filea, hello, hello_w, proxy_d, proxy_f, proxy_r, smtp_r +from .desktop import DesktopServer +from .dhcp_s import DHCPServerS +from .file import FileServer +from .filea import FileAsyncServer +from .hello import HelloServer +from .proxy_d import DockerProxyServer +from .proxy_f import ForwardProxyServer +from .proxy_r import ReverseProxyServer +from .smtp_r import RelaySMTPServer + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/extra/desktop.pyi b/src/typings/netius/extra/desktop.pyi new file mode 100644 index 00000000..d72321b7 --- /dev/null +++ b/src/typings/netius/extra/desktop.pyi @@ -0,0 +1,25 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DesktopServer(netius.servers.MJPGServer): + def get_delay(self, connection): # -> Literal[1]: + ... + + def get_image(self, connection): # -> bytes | str | None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/dhcp_s.pyi b/src/typings/netius/extra/dhcp_s.pyi new file mode 100644 index 00000000..c6bdf88c --- /dev/null +++ b/src/typings/netius/extra/dhcp_s.pyi @@ -0,0 +1,34 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DHCPServerS(netius.servers.DHCPServer): + def __init__(self, pool=..., options=..., *args, **kwargs) -> None: + ... + + def get_type(self, request): # -> Literal[9, 12, 13]: + ... + + def get_options(self, request): # -> dict[Any, Any]: + ... + + def get_yiaddr(self, request): + ... + + + +if __name__ == "__main__": + host = ... + pool = ... + options = ... + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/file.pyi b/src/typings/netius/extra/file.pyi new file mode 100644 index 00000000..44a3cb25 --- /dev/null +++ b/src/typings/netius/extra/file.pyi @@ -0,0 +1,63 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_SIZE = ... +FOLDER_SVG = ... +FILE_SVG = ... +EMPTY_GIF = ... +class FileServer(netius.servers.HTTP2Server): + """ + Simple implementation of a file server that is able to list files + for directories taking into account the base path values. + + This is a synchronous implementation meaning that the server loop + will block for the various I/O operations to be performed. + + Current implementation supports byte ranges so that partial retrieval + of a file is possible. + """ + def __init__(self, base_path=..., style_urls=..., index_files=..., path_regex=..., list_dirs=..., list_engine=..., cors=..., cache=..., *args, **kwargs) -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_stream_d(self, stream): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + def on_dir_file(self, connection, parser, path, style=...): # -> None: + ... + + def on_normal_file(self, connection, parser, path): # -> None: + ... + + def on_no_file(self, connection): # -> None: + ... + + def on_exception_file(self, connection, exception): # -> None: + ... + + def on_not_modified(self, connection, path): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/filea.pyi b/src/typings/netius/extra/filea.pyi new file mode 100644 index 00000000..f76faf62 --- /dev/null +++ b/src/typings/netius/extra/filea.pyi @@ -0,0 +1,38 @@ +""" +This type stub file was generated by pyright. +""" + +from . import file as _file + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_SIZE = ... +class FileAsyncServer(_file.FileServer): + """ + Simple implementation of a file server that uses the async + file pool infra-structure. + + This is a test implementation and should never be used for + production work that required mature and stable codebase. + + Using this kind of server (file pool based) is not recommended + for system that don't provide some system of event fd (eg: windows) + as it would provide very slow performance or even stall the + event loop as no notification occurs on events. + """ + def on_connection_d(self, connection): # -> None: + ... + + def on_stream_d(self, stream): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/hello.pyi b/src/typings/netius/extra/hello.pyi new file mode 100644 index 00000000..c6ce3991 --- /dev/null +++ b/src/typings/netius/extra/hello.pyi @@ -0,0 +1,38 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class HelloServer(netius.servers.HTTP2Server): + """ + Simple Hello (World) HTTP server meant to be used for benchmarks + and other operations that require a simple in-memory HTTP server. + + Most of the implementation on the server is done in the upper + layers from which this server class inherits. + + Performance should always be considered critical when changing + or adding new features to this server implementation. + """ + def __init__(self, message=..., *args, **kwargs) -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/hello_w.pyi b/src/typings/netius/extra/hello_w.pyi new file mode 100644 index 00000000..abbef670 --- /dev/null +++ b/src/typings/netius/extra/hello_w.pyi @@ -0,0 +1,17 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def app(environ, start_response): # -> Generator[Literal['Hello World'], Any, None]: + ... + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/proxy_d.pyi b/src/typings/netius/extra/proxy_d.pyi new file mode 100644 index 00000000..34bdb44d --- /dev/null +++ b/src/typings/netius/extra/proxy_d.pyi @@ -0,0 +1,35 @@ +""" +This type stub file was generated by pyright. +""" + +from . import proxy_r + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DockerProxyServer(proxy_r.ReverseProxyServer): + """ + Specialized reverse proxy server that handles many of the + inner details of the reverse proxy server configuration + server using environment variables information, making it + easier for the automatic configuration and association of + servers to the proxy server in a Docker environment. + + Although an optimal usage implies a Docker context the usage + of the Docker proxy servers is not limited to such use cases. + """ + def __init__(self, host_suffixes=..., *args, **kwargs) -> None: + ... + + def on_serve(self): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/proxy_f.pyi b/src/typings/netius/extra/proxy_f.pyi new file mode 100644 index 00000000..2a67e984 --- /dev/null +++ b/src/typings/netius/extra/proxy_f.pyi @@ -0,0 +1,29 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class ForwardProxyServer(netius.servers.ProxyServer): + def __init__(self, config=..., rules=..., *args, **kwargs) -> None: + ... + + def on_headers(self, connection, parser): # -> None: + ... + + def compile(self): # -> None: + ... + + + +if __name__ == "__main__": + rules = ... + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/proxy_r.pyi b/src/typings/netius/extra/proxy_r.pyi new file mode 100644 index 00000000..5c2fcbbc --- /dev/null +++ b/src/typings/netius/extra/proxy_r.pyi @@ -0,0 +1,110 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +DEFAULT_NAME = ... +class ReverseProxyServer(netius.servers.ProxyServer): + """ + Reverse HTTP proxy implementation based on the more generalized + infra-structure of proxy server. + + Supports multiple scheduling strategies, being the "smart" one + the most efficient for most of the possible scenarios. + + Conditional re-usage of connections based on boolean flag is possible, + but care should be taken when using re-usage so that no multiple + rules are applied for the same connection (eg: https://host.com/hive, + https://host.com/colony as different rules), this would pose serious + problems if the back-end servers are different for each rule or if + the way the final back-end URL is created is different for each rule. + """ + def __init__(self, config=..., regex=..., hosts=..., alias=..., auth=..., auth_regex=..., redirect=..., redirect_regex=..., error_urls=..., forward=..., strategy=..., reuse=..., sts=..., resolve=..., resolve_t=..., host_f=..., echo=..., *args, **kwargs) -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def proxy_r_dict(self): # -> dict[str, dict[Any, Any] | None]: + ... + + def on_diag(self): # -> None: + ... + + def on_start(self): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_headers(self, connection, parser): + ... + + def rules(self, url, parser): # -> tuple[None, None] | tuple[Any, Any | None] | tuple[Any, None] | Any: + ... + + def rules_regex(self, url, parser): # -> tuple[None, None] | tuple[Any, Any | None]: + ... + + def rules_host(self, url, parser): # -> tuple[Any, None] | Any: + ... + + def rules_forward(self, url, parser): # -> tuple[Any, None] | Any: + ... + + def balancer(self, values): # -> tuple[Any, None] | Any: + ... + + def balancer_robin(self, values): # -> tuple[Any, None]: + ... + + def balancer_smart(self, values): # -> tuple[Any, tuple[Any, PriorityDict | Any]]: + ... + + def acquirer(self, state): # -> None: + ... + + def acquirer_robin(self, state): # -> None: + ... + + def acquirer_smart(self, state): # -> None: + ... + + def releaser(self, state): # -> None: + ... + + def releaser_robin(self, state): # -> None: + ... + + def releaser_smart(self, state): # -> None: + ... + + def dns_start(self, timeout=...): # -> None: + ... + + def dns_tick(self, timeout=...): # -> None: + ... + + def dns_callback(self, host, hostname, parsed, index=..., resolved=...): # -> Callable[..., None]: + ... + + + +if __name__ == "__main__": + regex = ... + hosts = ... + alias = ... + auth = ... + auth_regex = ... + redirect = ... + error_urls = ... + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/extra/smtp_r.pyi b/src/typings/netius/extra/smtp_r.pyi new file mode 100644 index 00000000..d73446ef --- /dev/null +++ b/src/typings/netius/extra/smtp_r.pyi @@ -0,0 +1,53 @@ +""" +This type stub file was generated by pyright. +""" + +import netius.servers + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class RelaySMTPServer(netius.servers.SMTPServer): + """ + Relay version of the smtp server that relays messages + that are not considered to be local to other servers. + + The servers uses the default smtp client implementation + to relay the messages. + """ + def __init__(self, *args, **kwargs) -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_header_smtp(self, connection, from_l, to_l): # -> None: + ... + + def on_data_smtp(self, connection, data): # -> None: + ... + + def on_message_smtp(self, connection): # -> None: + ... + + def relay(self, connection, froms, tos, contents): # -> None: + ... + + def date(self): # -> str: + ... + + def message_id(self, connection, email=...): # -> str: + ... + + def dkim_contents(self, contents, email=..., creation=...): + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/middleware/__init__.pyi b/src/typings/netius/middleware/__init__.pyi new file mode 100644 index 00000000..bd514f80 --- /dev/null +++ b/src/typings/netius/middleware/__init__.pyi @@ -0,0 +1,17 @@ +""" +This type stub file was generated by pyright. +""" + +from . import annoyer, base, blacklist, dummy, flood, proxy +from .annoyer import AnnoyerMiddleware +from .base import Middleware +from .blacklist import BlacklistMiddleware +from .dummy import DummyMiddleware +from .flood import FloodMiddleware +from .proxy import ProxyMiddleware + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/middleware/annoyer.pyi b/src/typings/netius/middleware/annoyer.pyi new file mode 100644 index 00000000..f49a0a68 --- /dev/null +++ b/src/typings/netius/middleware/annoyer.pyi @@ -0,0 +1,29 @@ +""" +This type stub file was generated by pyright. +""" + +from .base import Middleware + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class AnnoyerMiddleware(Middleware): + """ + Simple middleware that prints an "annoying" status message + to the standard output (stdout) from time to time providing + a simple diagnostics strategy. + """ + def __init__(self, owner, period=...) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + + diff --git a/src/typings/netius/middleware/base.pyi b/src/typings/netius/middleware/base.pyi new file mode 100644 index 00000000..dfa8faf4 --- /dev/null +++ b/src/typings/netius/middleware/base.pyi @@ -0,0 +1,22 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class Middleware: + def __init__(self, owner) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + + diff --git a/src/typings/netius/middleware/blacklist.pyi b/src/typings/netius/middleware/blacklist.pyi new file mode 100644 index 00000000..a2c03461 --- /dev/null +++ b/src/typings/netius/middleware/blacklist.pyi @@ -0,0 +1,31 @@ +""" +This type stub file was generated by pyright. +""" + +from .base import Middleware + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class BlacklistMiddleware(Middleware): + """ + Simple middleware implementation for blacklisting of IP + addresses using a very minimalistic approach. + """ + def __init__(self, owner, blacklist=..., whitelist=...) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def on_connection_c(self, owner, connection): # -> None: + ... + + + diff --git a/src/typings/netius/middleware/dummy.pyi b/src/typings/netius/middleware/dummy.pyi new file mode 100644 index 00000000..ecda694e --- /dev/null +++ b/src/typings/netius/middleware/dummy.pyi @@ -0,0 +1,29 @@ +""" +This type stub file was generated by pyright. +""" + +from .base import Middleware + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DummyMiddleware(Middleware): + """ + Simple middleware implementation for testing/debugging + purposes that may be used as reference for the implementation + of more complex middleware units. + """ + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def on_connection_c(self, owner, connection): # -> None: + ... + + + diff --git a/src/typings/netius/middleware/flood.pyi b/src/typings/netius/middleware/flood.pyi new file mode 100644 index 00000000..bb37a12c --- /dev/null +++ b/src/typings/netius/middleware/flood.pyi @@ -0,0 +1,31 @@ +""" +This type stub file was generated by pyright. +""" + +from .base import Middleware + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class FloodMiddleware(Middleware): + """ + Simple middleware implementation for avoiding flooding + of connection creation from a certain address. + """ + def __init__(self, owner, conns_per_min=..., whitelist=...) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def on_connection_c(self, owner, connection): # -> None: + ... + + + diff --git a/src/typings/netius/middleware/proxy.pyi b/src/typings/netius/middleware/proxy.pyi new file mode 100644 index 00000000..2f86ba06 --- /dev/null +++ b/src/typings/netius/middleware/proxy.pyi @@ -0,0 +1,48 @@ +""" +This type stub file was generated by pyright. +""" + +from .base import Middleware + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class ProxyMiddleware(Middleware): + """ + Middleware that implements the PROXY protocol on creation + of a new connection enabling the passing of information + from the front-end server to a back-end server using a normal + TCP connection. This protocol has been development originally + for the integration of an HAProxy server with back-end servers. + + :see: http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt + """ + MAX_LENGTH = ... + HEADER_LENGTH_V2 = ... + HEADER_MAGIC_V2 = ... + TYPE_LOCAL_V2 = ... + TYPE_PROXY_V2 = ... + AF_UNSPEC_v2 = ... + AF_INET_v2 = ... + AF_INET6_v2 = ... + AF_UNIX_v2 = ... + PROTO_UNSPEC_v2 = ... + PROTO_STREAM_v2 = ... + PROTO_DGRAM_v2 = ... + def __init__(self, owner, version=...) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def on_connection_c(self, owner, connection): # -> None: + ... + + + diff --git a/src/typings/netius/mock/__init__.pyi b/src/typings/netius/mock/__init__.pyi new file mode 100644 index 00000000..a899f29c --- /dev/null +++ b/src/typings/netius/mock/__init__.pyi @@ -0,0 +1,11 @@ +""" +This type stub file was generated by pyright. +""" + +from . import appier + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/mock/appier.pyi b/src/typings/netius/mock/appier.pyi new file mode 100644 index 00000000..1b9aed47 --- /dev/null +++ b/src/typings/netius/mock/appier.pyi @@ -0,0 +1,17 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class APIApp: + ... + + +def route(*args, **kwargs): # -> Callable[..., None]: + ... + diff --git a/src/typings/netius/pool/__init__.pyi b/src/typings/netius/pool/__init__.pyi new file mode 100644 index 00000000..6f0cb159 --- /dev/null +++ b/src/typings/netius/pool/__init__.pyi @@ -0,0 +1,15 @@ +""" +This type stub file was generated by pyright. +""" + +from . import common, file, notify, task +from .common import EventFile, EventPool, SocketEventFile, Thread, ThreadPool, UnixEventFile +from .file import FilePool, FileThread +from .notify import NotifyPool +from .task import TaskPool, TaskThread + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/pool/common.pyi b/src/typings/netius/pool/common.pyi new file mode 100644 index 00000000..9292d446 --- /dev/null +++ b/src/typings/netius/pool/common.pyi @@ -0,0 +1,171 @@ +""" +This type stub file was generated by pyright. +""" + +import threading + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +CALLABLE_WORK = ... +class Thread(threading.Thread): + def __init__(self, identifier, owner=..., *args, **kwargs) -> None: + ... + + @classmethod + def available(self): # -> Literal[True]: + ... + + def stop(self): # -> None: + ... + + def run(self): # -> None: + ... + + def tick(self): # -> None: + ... + + def execute(self, work): # -> None: + ... + + + +class ThreadPool: + def __init__(self, base=..., count=...) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self, join=...): # -> None: + ... + + def build(self): # -> None: + ... + + def peek(self): # -> None: + ... + + def pop(self, lock=...): + ... + + def push(self, work, lock=...): # -> None: + ... + + def push_callable(self, callable): # -> None: + ... + + + +class EventPool(ThreadPool): + def __init__(self, base=..., count=...) -> None: + ... + + def stop(self, join=...): # -> None: + ... + + def push_event(self, event): # -> None: + ... + + def pop_event(self): + ... + + def pop_all(self, denotify=...): # -> list[Any]: + ... + + def notify(self): # -> None: + ... + + def denotify(self): # -> None: + ... + + def eventfd(self): # -> UnixEventFile | PipeEventFile | SocketEventFile: + ... + + + +class EventFile: + def __init__(self, *args, **kwargs) -> None: + ... + + def close(self): # -> None: + ... + + def fileno(self): # -> None: + ... + + def rfileno(self): # -> None: + ... + + def wfileno(self): # -> None: + ... + + def notify(self): + ... + + def denotify(self): + ... + + + +class UnixEventFile(EventFile): + _LIBC = ... + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def available(cls): # -> bool: + ... + + @classmethod + def libc(cls): # -> CDLL | None: + ... + + def close(self): # -> None: + ... + + def notify(self): # -> None: + ... + + def denotify(self): # -> None: + ... + + + +class PipeEventFile(EventFile): + def __init__(self, *args, **kwargs) -> None: + ... + + @classmethod + def available(cls): # -> bool: + ... + + def close(self): # -> None: + ... + + def notify(self): # -> None: + ... + + def denotify(self): # -> None: + ... + + + +class SocketEventFile(EventFile): + def __init__(self, *args, **kwargs) -> None: + ... + + def close(self): # -> None: + ... + + def notify(self): # -> None: + ... + + def denotify(self): # -> None: + ... + + + diff --git a/src/typings/netius/pool/file.pyi b/src/typings/netius/pool/file.pyi new file mode 100644 index 00000000..8d9aa70e --- /dev/null +++ b/src/typings/netius/pool/file.pyi @@ -0,0 +1,54 @@ +""" +This type stub file was generated by pyright. +""" + +from . import common + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +FILE_WORK = ... +ERROR_ACTION = ... +OPEN_ACTION = ... +CLOSE_ACTION = ... +READ_ACTION = ... +WRITE_ACTION = ... +class FileThread(common.Thread): + def execute(self, work): # -> None: + ... + + def open(self, path, mode, data): # -> None: + ... + + def close(self, file, data): # -> None: + ... + + def read(self, file, count, data): # -> None: + ... + + def write(self, file, buffer, data): # -> None: + ... + + + +class FilePool(common.EventPool): + def __init__(self, base=..., count=...) -> None: + ... + + def open(self, path, mode=..., data=...): # -> None: + ... + + def close(self, file, data=...): # -> None: + ... + + def read(self, file, count=..., data=...): # -> None: + ... + + def write(self, file, buffer, data=...): # -> None: + ... + + + diff --git a/src/typings/netius/pool/notify.pyi b/src/typings/netius/pool/notify.pyi new file mode 100644 index 00000000..acb62147 --- /dev/null +++ b/src/typings/netius/pool/notify.pyi @@ -0,0 +1,18 @@ +""" +This type stub file was generated by pyright. +""" + +from . import common + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class NotifyPool(common.EventPool): + def __init__(self) -> None: + ... + + + diff --git a/src/typings/netius/pool/task.pyi b/src/typings/netius/pool/task.pyi new file mode 100644 index 00000000..5b2867fa --- /dev/null +++ b/src/typings/netius/pool/task.pyi @@ -0,0 +1,28 @@ +""" +This type stub file was generated by pyright. +""" + +from . import common + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +TASK_WORK = ... +class TaskThread(common.Thread): + def execute(self, work): # -> None: + ... + + + +class TaskPool(common.EventPool): + def __init__(self, base=..., count=...) -> None: + ... + + def execute(self, callable, args=..., kwargs=..., callback=...): # -> None: + ... + + + diff --git a/src/typings/netius/servers/__init__.pyi b/src/typings/netius/servers/__init__.pyi new file mode 100644 index 00000000..ab861a62 --- /dev/null +++ b/src/typings/netius/servers/__init__.pyi @@ -0,0 +1,26 @@ +""" +This type stub file was generated by pyright. +""" + +from . import dhcp, echo, echo_ws, ftp, http, http2, mjpg, pop, proxy, smtp, socks, tftp, torrent, ws, wsgi +from .dhcp import DHCPRequest, DHCPServer +from .echo_ws import EchoWSServer +from .echo import EchoServer +from .ftp import FTPConnection, FTPServer +from .http import HTTPConnection, HTTPServer +from .http2 import HTTP2Server +from .mjpg import MJPGServer +from .pop import POPConnection, POPServer +from .proxy import ProxyConnection, ProxyServer +from .smtp import SMTPConnection, SMTPServer, TERMINATION_SIZE +from .socks import SOCKSConnection, SOCKSServer +from .tftp import TFTPRequest, TFTPServer +from .torrent import Pieces, TorrentServer, TorrentTask +from .ws import WSConnection, WSServer +from .wsgi import WSGIServer + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/servers/dhcp.pyi b/src/typings/netius/servers/dhcp.pyi new file mode 100644 index 00000000..3fd027bf --- /dev/null +++ b/src/typings/netius/servers/dhcp.pyi @@ -0,0 +1,80 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class DHCPRequest: + options_m = ... + options_l = ... + def __init__(self, data) -> None: + ... + + @classmethod + def generate(cls): # -> None: + ... + + def get_info(self): # -> str: + ... + + def print_info(self): # -> None: + ... + + def parse(self): # -> None: + ... + + def unpack_options(self): # -> None: + ... + + def get_requested(self): # -> str: + ... + + def get_type(self): # -> int: + ... + + def get_type_s(self): # -> str | None: + ... + + def get_mac(self): # -> LiteralString: + ... + + def response(self, yiaddr, options=...): # -> bytes: + ... + + + +class DHCPServer(netius.DatagramServer): + def serve(self, port=..., type=..., *args, **kwargs): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def on_data_dhcp(self, address, request): # -> None: + ... + + def get_verb(self, type_r): # -> str: + ... + + def send_dhcp(self, data, *args, **kwargs): # -> None: + ... + + def get_type(self, request): + ... + + def get_options(self, request): + ... + + def get_yiaddr(self, request): + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/echo.pyi b/src/typings/netius/servers/echo.pyi new file mode 100644 index 00000000..d80e89f8 --- /dev/null +++ b/src/typings/netius/servers/echo.pyi @@ -0,0 +1,24 @@ +""" +This type stub file was generated by pyright. +""" + +import netius + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class EchoProtocol(netius.StreamProtocol): + ... + + +class EchoServer(netius.ServerAgent): + protocol = EchoProtocol + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/echo_ws.pyi b/src/typings/netius/servers/echo_ws.pyi new file mode 100644 index 00000000..fca1044f --- /dev/null +++ b/src/typings/netius/servers/echo_ws.pyi @@ -0,0 +1,22 @@ +""" +This type stub file was generated by pyright. +""" + +from . import ws + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class EchoWSServer(ws.WSServer): + def on_data_ws(self, connection, data): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/ftp.pyi b/src/typings/netius/servers/ftp.pyi new file mode 100644 index 00000000..2cca3ee3 --- /dev/null +++ b/src/typings/netius/servers/ftp.pyi @@ -0,0 +1,201 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_SIZE = ... +CAPABILITIES = ... +PERMISSIONS = ... +TYPES = ... +class FTPConnection(netius.Connection): + def __init__(self, base_path=..., host=..., mode=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def parse(self, data): # -> int: + ... + + def send_ftp(self, code, message=..., lines=..., simple=..., delay=..., callback=...): # -> int: + ... + + def send_ftp_base(self, code, message=..., delay=..., callback=...): # -> int: + ... + + def send_ftp_lines(self, code, message=..., lines=..., simple=..., delay=..., callback=...): # -> int: + ... + + def ready(self): # -> None: + ... + + def ok(self): # -> None: + ... + + def not_ok(self): # -> None: + ... + + def flush_ftp(self): # -> None: + ... + + def data_ftp(self, data): # -> None: + ... + + def closed_ftp(self): # -> None: + ... + + def flush_list(self): # -> None: + ... + + def flush_retr(self): # -> None: + ... + + def flush_stor(self): # -> None: + ... + + def on_flush_list(self, connection): # -> None: + ... + + def on_flush_retr(self, connection): # -> None: + ... + + def on_line(self, code, message, is_final=...): # -> None: + ... + + def on_user(self, message): # -> None: + ... + + def on_syst(self, message): # -> None: + ... + + def on_feat(self, message): # -> None: + ... + + def on_opts(self, message): # -> None: + ... + + def on_pwd(self, message): # -> None: + ... + + def on_type(self, message): # -> None: + ... + + def on_pasv(self, message): # -> None: + ... + + def on_port(self, message): # -> None: + ... + + def on_dele(self, message): # -> None: + ... + + def on_mkd(self, message): # -> None: + ... + + def on_rmd(self, message): # -> None: + ... + + def on_rnfr(self, message): # -> None: + ... + + def on_rnto(self, message): # -> None: + ... + + def on_cdup(self, message): # -> None: + ... + + def on_cwd(self, message): # -> None: + ... + + def on_size(self, message): # -> None: + ... + + def on_mdtm(self, message): # -> None: + ... + + def on_noop(self, message): # -> None: + ... + + def on_quit(self, message): # -> None: + ... + + def on_list(self, message): # -> None: + ... + + def on_retr(self, message): # -> None: + ... + + def on_stor(self, message): # -> None: + ... + + + +class FTPDataServer(netius.StreamServer): + def __init__(self, connection, container, *args, **kwargs) -> None: + ... + + def on_connection_c(self, connection): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def send_ftp(self, data, delay=..., force=..., callback=...): + ... + + def flush_ftp(self): # -> None: + ... + + def close_ftp(self): # -> None: + ... + + + +class FTPServer(netius.ContainerServer): + """ + Abstract ftp server implementation that handles authentication + and file system based file serving. + + Note that the ftp server does not support multiple user handling + and runs only as the user running the current process. + + :see: http://tools.ietf.org/html/rfc959 + """ + def __init__(self, base_path=..., auth_s=..., *args, **kwargs) -> None: + ... + + def serve(self, host=..., port=..., *args, **kwargs): # -> None: + ... + + def on_connection_c(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> FTPConnection: + ... + + def on_line_ftp(self, connection, code, message): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/http.pyi b/src/typings/netius/servers/http.pyi new file mode 100644 index 00000000..0714e55a --- /dev/null +++ b/src/typings/netius/servers/http.pyi @@ -0,0 +1,170 @@ +""" +This type stub file was generated by pyright. +""" + +import contextlib + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +Z_PARTIAL_FLUSH = ... +ENCODING_MAP = ... +class HTTPConnection(netius.Connection): + def __init__(self, encoding=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, Any | None]: + ... + + def flush(self, stream=..., callback=...): # -> None: + ... + + def flush_s(self, stream=..., callback=...): # -> None: + ... + + def send_base(self, data, stream=..., final=..., delay=..., callback=...): # -> int | None: + ... + + def send_plain(self, data, stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_chunked(self, data, stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_gzip(self, data, stream=..., final=..., delay=..., callback=..., level=...): # -> int: + ... + + def send_response(self, data=..., headers=..., version=..., code=..., code_s=..., apply=..., stream=..., final=..., flush=..., delay=..., callback=...): + ... + + def send_header(self, headers=..., version=..., code=..., code_s=..., stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_part(self, data, stream=..., final=..., flush=..., delay=..., callback=...): # -> int | None: + ... + + def parse(self, data): # -> int | Any | None: + ... + + def resolve_encoding(self, parser): # -> None: + ... + + def set_encoding(self, encoding): # -> None: + ... + + def set_uncompressed(self): # -> None: + ... + + def set_plain(self): # -> None: + ... + + def set_chunked(self): # -> None: + ... + + def set_gzip(self): # -> None: + ... + + def set_deflate(self): # -> None: + ... + + def is_plain(self): # -> bool: + ... + + def is_chunked(self): # -> bool: + ... + + def is_gzip(self): # -> bool: + ... + + def is_deflate(self): # -> bool: + ... + + def is_compressed(self): # -> bool: + ... + + def is_uncompressed(self): # -> bool: + ... + + def is_flushed(self): # -> bool: + ... + + def is_measurable(self, strict=...): # -> bool: + ... + + def on_data(self): # -> None: + ... + + @contextlib.contextmanager + def ctx_request(self, args=..., kwargs=...): # -> Generator[None, Any, None]: + ... + + @property + def connection_ctx(self): # -> Self: + ... + + @property + def parser_ctx(self): # -> HTTPParser | None: + ... + + + +class HTTPServer(netius.StreamServer): + """ + Base class for serving of the HTTP protocol, should contain + the basic utilities for handling an HTTP request including + headers and read of data. + """ + BASE_HEADERS = ... + def __init__(self, encoding=..., common_log=..., *args, **kwargs) -> None: + ... + + @classmethod + def build_data(cls, text, url=..., trace=..., style=..., style_urls=..., encode=..., encoding=...): # -> LiteralString | bytes | str: + ... + + @classmethod + def build_text(cls, text, trace=..., style=..., style_urls=..., encode=..., encoding=...): # -> str | bytes: + ... + + @classmethod + def build_iframe(cls, text, url, style=..., style_urls=..., encode=..., encoding=...): # -> LiteralString | bytes: + ... + + def cleanup(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> HTTPConnection: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + def on_send_http(self, connection, parser, headers=..., version=..., code=..., code_s=...): # -> None: + ... + + def on_flush_http(self, connection, parser, encoding=...): # -> None: + ... + + def authorize(self, connection, parser, auth=..., **kwargs): # -> bool: + ... + + + diff --git a/src/typings/netius/servers/http2.pyi b/src/typings/netius/servers/http2.pyi new file mode 100644 index 00000000..abe6572f --- /dev/null +++ b/src/typings/netius/servers/http2.pyi @@ -0,0 +1,323 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class HTTP2Connection(http.HTTPConnection): + def __init__(self, legacy=..., window=..., settings=..., settings_r=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, Any | None]: + ... + + def flush_s(self, stream=..., callback=...): # -> int | None: + ... + + def set_h2(self): # -> None: + ... + + def parse(self, data): # -> int | Any | None: + ... + + def parse_preface(self, data): # -> None: + """ + Tries to run the parsing on the preface part of the + connection establishment using the provided data + note that the data is buffered in case the proper size + has not been reached for proper validation. + + This should be the first step when trying to establish + a proper HTTP 2 connection. + + :type data: String + :param data: The data buffer that is going to be used to + try to parse the connection preface. + :rtype: String + :return: The resulting data after the preface has been + parsed, this should be empty or invalid in case no data + is pending to be parsed. + """ + ... + + def send_plain(self, data, stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_chunked(self, data, stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_fragmented(self, data, stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_response(self, data=..., headers=..., version=..., code=..., code_s=..., apply=..., stream=..., final=..., flush=..., delay=..., callback=...): + ... + + def send_header(self, headers=..., version=..., code=..., code_s=..., stream=..., final=..., delay=..., callback=...): # -> int: + ... + + def send_part(self, data, stream=..., final=..., flush=..., delay=..., callback=...): # -> int | None: + ... + + def send_frame(self, type=..., flags=..., payload=..., stream=..., delay=..., callback=...): # -> int: + ... + + def send_data(self, data=..., end_stream=..., stream=..., delay=..., callback=...): # -> int: + ... + + def send_headers(self, headers=..., end_stream=..., end_headers=..., stream=..., delay=..., callback=...): # -> int: + ... + + def send_rst_stream(self, error_code=..., stream=..., delay=..., callback=...): # -> int: + ... + + def send_settings(self, settings=..., ack=..., delay=..., callback=...): # -> int: + ... + + def send_ping(self, opaque=..., ack=..., delay=..., callback=...): # -> int: + ... + + def send_goaway(self, last_stream=..., error_code=..., message=..., close=..., delay=..., callback=...): # -> int: + ... + + def send_window_update(self, increment=..., stream=..., delay=..., callback=...): # -> int: + ... + + def send_delta(self): # -> None: + ... + + def delay_frame(self, *args, **kwargs): # -> Literal[0]: + ... + + def flush_frames(self, all=...): # -> bool: + """ + Runs the flush operation on the delayed/pending frames, meaning + that the window/availability tests are going to be run, checking + if the various streams and connection are ready for sending the + frames. + + In case the all flag is active the complete set of frames are going + to be tested for sending, this operation implies more resource usage. + + This method should be called after a window update frame is + received so that the pending frames may be sent. + + :type all: bool + :param all: If the complete set of frames should be tested, or + if instead at the first testing fail the control flow should be + returned immediately. + :rtype: bool + :return: If all the pending frames have been successfully flushed. + """ + ... + + def flush_available(self): # -> None: + """ + Runs the (became) available flush operation that tries to determine + all the streams that were under the "blocked" state and became + "unblocked", notifying them about that "edge" operation. + + This operation must be performed after any of the blocking constraints + is changed (eg: connection window, stream window, etc.). + """ + ... + + def set_settings(self, settings): # -> None: + ... + + def close_stream(self, stream, final=..., flush=..., reset=...): # -> None: + ... + + def available_stream(self, stream, length, strict=...): # -> bool: + ... + + def fragment_stream(self, stream, data): + ... + + def fragmentable_stream(self, stream, data): + ... + + def open_stream(self, stream): # -> bool: + ... + + def try_available(self, stream, strict=...): # -> None: + """ + Tries to determine if the stream with the provided identifier + has just became available (unblocked from blocked state), this + happens when the required window value (either connection or + stream is increased properly). + + :type stream: int + :param stream: The identifier of the stream that is going to + be tested from proper connection availability. + :type strict: bool + :param strict: If the strict mode should be used in the availability + testing, this implies extra verifications. + """ + ... + + def try_unavailable(self, stream, strict=...): # -> None: + """ + Runs the unavailability test on the stream with the provided identifier + meaning that a series of validation will be performed to try to determine + if for some reason is not possible to send any more data frames to the + stream until some window changes. A stream that is under the unavailable + state is considered "blocked". + + :type stream: int + :param stream: The identifier of the stream that is going to + be tested from proper connection unavailability. + :type strict: bool + :param strict: If the strict mode should be used in the availability + testing, this implies extra verifications. + """ + ... + + def increment_remote(self, stream, increment, all=...): # -> None: + """ + Increments the size of the remove window associated with + the stream passed by argument by the size defined in the + increment field (in bytes). + + If the stream is not provided or invalid the global window + is updated instead of the stream one. + + :type stream: int + :param stream: The identifier of the stream that is going + to have its window incremented, or invalid if the global + connection window is meant to be updated. + :type increment: int + :param increment: The increment in bytes for the window, + this value may be negative for decrement operations. + :type all: bool + :param all: If all the resources (connection and stream) + should be updated by the increment operation. + """ + ... + + def increment_local(self, stream, increment): # -> None: + ... + + def error_connection(self, last_stream=..., error_code=..., message=..., close=..., callback=...): # -> None: + ... + + def error_stream(self, stream, last_stream=..., error_code=..., message=..., close=..., callback=...): # -> None: + ... + + def on_header(self, header): # -> None: + ... + + def on_payload(self): # -> None: + ... + + def on_frame(self): # -> None: + ... + + def on_data_h2(self, stream, contents): # -> None: + ... + + def on_headers_h2(self, stream): # -> None: + ... + + def on_rst_stream(self, stream, error_code): # -> None: + ... + + def on_settings(self, settings, ack): # -> None: + ... + + def on_ping(self, opaque, ack): # -> None: + ... + + def on_goaway(self, last_stream, error_code, extra): # -> None: + ... + + def on_window_update(self, stream, increment): # -> None: + ... + + def on_continuation(self, stream): # -> None: + ... + + def is_throttleable(self): # -> bool: + ... + + @property + def connection_ctx(self): # -> Self: + ... + + @property + def parser_ctx(self): # -> HTTPParser | HTTP2Parser | None: + ... + + + +class HTTP2Server(http.HTTPServer): + def __init__(self, legacy=..., safe=..., settings=..., *args, **kwargs) -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def get_protocols(self): # -> list[Any]: + ... + + def build_connection(self, socket, address, ssl=...): # -> HTTP2Connection: + ... + + def on_exception(self, exception, connection): # -> None: + ... + + def on_ssl(self, connection): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_preface_http2(self, connection, parser): # -> None: + ... + + def on_header_http2(self, connection, parser, header): # -> None: + ... + + def on_payload_http2(self, connection, parser): # -> None: + ... + + def on_frame_http2(self, connection, parser): # -> None: + ... + + def on_data_http2(self, connection, parser, stream, contents): # -> None: + ... + + def on_headers_http2(self, connection, parser, stream): # -> None: + ... + + def on_rst_stream_http2(self, connection, parser, stream, error_code): # -> None: + ... + + def on_settings_http2(self, connection, parser, settings, ack): # -> None: + ... + + def on_ping_http2(self, connection, parser, opaque, ack): # -> None: + ... + + def on_goaway_http2(self, connection, parser, last_stream, error_code, extra): # -> None: + ... + + def on_window_update_http2(self, connection, parser, stream, increment): # -> None: + ... + + def on_continuation_http2(self, connection, parser, stream): # -> None: + ... + + def on_send_http2(self, connection, parser, type, flags, payload, stream): # -> None: + ... + + + diff --git a/src/typings/netius/servers/mjpg.pyi b/src/typings/netius/servers/mjpg.pyi new file mode 100644 index 00000000..5648ba4a --- /dev/null +++ b/src/typings/netius/servers/mjpg.pyi @@ -0,0 +1,42 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http2 + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BOUNDARY = ... +class MJPGServer(http2.HTTP2Server): + """ + Server class for the creation of an HTTP server for + the providing of a motion JPEG stream (as in spec). + + This class should only be seen as a foundation and + proper implementation should be made from this. + """ + def __init__(self, boundary=..., *args, **kwargs) -> None: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + def on_send_mjpg(self, connection): # -> None: + ... + + def get_delay(self, connection): # -> Literal[1]: + ... + + def get_image(self, connection): # -> bytes: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/pop.pyi b/src/typings/netius/servers/pop.pyi new file mode 100644 index 00000000..cad07bd1 --- /dev/null +++ b/src/typings/netius/servers/pop.pyi @@ -0,0 +1,159 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +INITIAL_STATE = ... +HELO_STATE = ... +AUTH_STATE = ... +SESSION_STATE = ... +CHUNK_SIZE = ... +CAPABILITIES = ... +AUTH_METHODS = ... +class POPConnection(netius.Connection): + def __init__(self, host=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def parse(self, data): # -> int | None: + ... + + def send_pop(self, message=..., lines=..., status=..., delay=..., callback=...): # -> int: + ... + + def ready(self): # -> None: + ... + + def starttls(self): # -> None: + ... + + def capa(self): # -> None: + ... + + def auth(self): # -> None: + ... + + def accept(self): # -> None: + ... + + def stat(self): # -> None: + ... + + def list(self): # -> None: + ... + + def uidl(self): # -> None: + ... + + def retr(self, index): # -> None: + ... + + def dele(self, index): # -> None: + ... + + def bye(self): # -> None: + ... + + def ok(self): # -> None: + ... + + def not_implemented(self): # -> None: + ... + + def on_line(self, code, message): # -> None: + ... + + def on_stls(self, message): # -> None: + ... + + def on_capa(self, message): # -> None: + ... + + def on_auth(self, message): # -> None: + ... + + def on_stat(self, message): # -> None: + ... + + def on_list(self, message): # -> None: + ... + + def on_uidl(self, message): # -> None: + ... + + def on_retr(self, message): # -> None: + ... + + def on_dele(self, message): # -> None: + ... + + def on_quit(self, message): # -> None: + ... + + def on_user(self, token): # -> None: + ... + + def assert_s(self, expected): # -> None: + ... + + + +class POPServer(netius.StreamServer): + def __init__(self, adapter_s=..., auth_s=..., *args, **kwargs) -> None: + ... + + def serve(self, host=..., port=..., *args, **kwargs): # -> None: + ... + + def on_connection_c(self, connection): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> POPConnection: + ... + + def on_line_pop(self, connection, code, message): # -> None: + ... + + def on_auth_pop(self, connection, username, password): # -> None: + ... + + def on_stat_pop(self, connection): # -> None: + ... + + def on_list_pop(self, connection): # -> None: + ... + + def on_uidl_pop(self, connection): # -> None: + ... + + def on_retr_pop(self, connection, index): # -> None: + ... + + def on_dele_pop(self, connection, index): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/proxy.pyi b/src/typings/netius/servers/proxy.pyi new file mode 100644 index 00000000..7074ab10 --- /dev/null +++ b/src/typings/netius/servers/proxy.pyi @@ -0,0 +1,93 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http2 + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +BUFFER_RATIO = ... +MIN_RATIO = ... +MAX_PENDING = ... +class ProxyConnection(http2.HTTP2Connection): + def open(self, *args, **kwargs): # -> None: + ... + + def resolve_encoding(self, parser): # -> None: + ... + + def set_h2(self): # -> None: + ... + + def on_headers(self): # -> None: + ... + + def on_partial(self, data): # -> None: + ... + + def on_available(self): # -> None: + ... + + def on_unavailable(self): # -> None: + ... + + + +class ProxyServer(http2.HTTP2Server): + def __init__(self, dynamic=..., throttle=..., trust_origin=..., max_pending=..., *args, **kwargs) -> None: + ... + + def start(self): # -> None: + ... + + def stop(self): # -> None: + ... + + def cleanup(self): # -> None: + ... + + def info_dict(self, full=...): # -> dict[str, str | Any]: + ... + + def connections_dict(self, full=..., parent=...): # -> list[Any] | dict[Any, Any]: + ... + + def connection_dict(self, id, full=...): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_stream_d(self, stream): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + def on_headers(self, connection, parser): # -> None: + ... + + def on_partial(self, connection, parser, data): # -> None: + ... + + def on_available(self, connection, parser): # -> None: + ... + + def on_unavailable(self, connection, parser): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> ProxyConnection: + ... + + + diff --git a/src/typings/netius/servers/smtp.pyi b/src/typings/netius/servers/smtp.pyi new file mode 100644 index 00000000..dcce0c1e --- /dev/null +++ b/src/typings/netius/servers/smtp.pyi @@ -0,0 +1,163 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +INITIAL_STATE = ... +HELO_STATE = ... +HEADER_STATE = ... +DATA_STATE = ... +USERNAME_STATE = ... +PASSWORD_STATE = ... +TERMINATION_SIZE = ... +CAPABILITIES = ... +class SMTPConnection(netius.Connection): + def __init__(self, host=..., *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def parse(self, data): # -> int | None: + ... + + def send_smtp(self, code, message=..., lines=..., delay=..., callback=...): # -> int: + ... + + def send_smtp_base(self, code, message=..., delay=..., callback=...): # -> int: + ... + + def send_smtp_lines(self, code, message=..., lines=..., delay=..., callback=...): # -> int: + ... + + def ready(self): # -> None: + ... + + def helo(self, host): # -> None: + ... + + def ehlo(self, host): # -> None: + ... + + def starttls(self): # -> None: + ... + + def auth(self, method, data): # -> None: + ... + + def auth_plain(self, data): # -> None: + ... + + def auth_login(self, data): # -> None: + ... + + def data(self): # -> None: + ... + + def queued(self, index=...): # -> None: + ... + + def bye(self): # -> None: + ... + + def ok(self): # -> None: + ... + + def not_implemented(self): # -> None: + ... + + def on_username(self, data): # -> None: + ... + + def on_password(self, data): # -> None: + ... + + def on_raw_data(self, data): # -> None: + ... + + def on_line(self, code, message, is_final=...): # -> None: + ... + + def on_helo(self, message): # -> None: + ... + + def on_ehlo(self, message): # -> None: + ... + + def on_starttls(self, message): # -> None: + ... + + def on_auth(self, message): # -> None: + ... + + def on_mail(self, message): # -> None: + ... + + def on_rcpt(self, message): # -> None: + ... + + def on_data(self, message): # -> None: + ... + + def on_quit(self, message): # -> None: + ... + + def assert_s(self, expected): # -> None: + ... + + def to_s(self): # -> LiteralString: + ... + + def received_s(self, for_s=...): # -> str: + ... + + + +class SMTPServer(netius.StreamServer): + def __init__(self, adapter_s=..., auth_s=..., locals=..., *args, **kwargs) -> None: + ... + + def serve(self, host=..., port=..., *args, **kwargs): # -> None: + ... + + def on_connection_c(self, connection): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> SMTPConnection: + ... + + def on_line_smtp(self, connection, code, message): # -> None: + ... + + def on_auth_smtp(self, connection, username, password): # -> None: + ... + + def on_header_smtp(self, connection, from_l, to_l): # -> None: + ... + + def on_data_smtp(self, connection, data): # -> None: + ... + + def on_message_smtp(self, connection): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/socks.pyi b/src/typings/netius/servers/socks.pyi new file mode 100644 index 00000000..43fc4367 --- /dev/null +++ b/src/typings/netius/servers/socks.pyi @@ -0,0 +1,86 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +GRANTED = ... +REJECTED = ... +FAILED_CLIENT = ... +FAILED_AUTH = ... +GRANTED_EXTRA = ... +BUFFER_RATIO = ... +MIN_RATIO = ... +MAX_PENDING = ... +class SOCKSConnection(netius.Connection): + def __init__(self, *args, **kwargs) -> None: + ... + + def open(self, *args, **kwargs): # -> None: + ... + + def close(self, *args, **kwargs): # -> None: + ... + + def send_response(self, status=...): # -> int: + ... + + def send_response_extra(self, status=...): # -> int: + ... + + def send_auth(self, version=..., method=...): # -> int: + ... + + def get_version(self): # -> Any | None: + ... + + def parse(self, data): # -> int | Any: + ... + + def on_data(self): # -> None: + ... + + def on_auth(self): # -> None: + ... + + + +class SOCKSServer(netius.ServerAgent): + """ + SOCKS base server class to be used as an implementation of the + RFC 1928 or SOCKSv5 and the SOCKSv4 protocols. + + There are some aspects of the implementation that may not be + performant driven for readability purposes. + """ + def __init__(self, rules=..., throttle=..., max_pending=..., *args, **kwargs) -> None: + ... + + def cleanup(self): # -> None: + ... + + def on_data(self, connection, data): # -> None: + ... + + def on_data_socks(self, connection, parser): # -> None: + ... + + def on_auth_socks(self, connection, parser): # -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> SOCKSConnection: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/tftp.pyi b/src/typings/netius/servers/tftp.pyi new file mode 100644 index 00000000..803e10e8 --- /dev/null +++ b/src/typings/netius/servers/tftp.pyi @@ -0,0 +1,99 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class TFTPSession: + def __init__(self, owner, name=..., mode=...) -> None: + ... + + def close(self): # -> None: + ... + + def reset(self): # -> None: + ... + + def next(self, size=..., increment=...): # -> bytes | None: + ... + + def ack(self, size=..., increment=...): # -> bytes | None: + ... + + def increment(self): # -> None: + ... + + def get_info(self): # -> str: + ... + + def print_info(self): # -> None: + ... + + + +class TFTPRequest: + parsers_m = ... + parsers_l = ... + def __init__(self, data, session) -> None: + ... + + @classmethod + def generate(cls): # -> None: + ... + + def get_info(self): # -> str: + ... + + def print_info(self): # -> None: + ... + + def parse(self): # -> None: + ... + + def get_type(self): # -> Any: + ... + + def get_type_s(self): # -> str | None: + ... + + def response(self, options=...): + ... + + + +class TFTPServer(netius.DatagramServer): + """ + Abstract trivial ftp server implementation that handles simple + file system based file serving. + + :see: http://tools.ietf.org/html/rfc1350 + """ + ALLOWED_OPERATIONS = ... + def __init__(self, base_path=..., *args, **kwargs) -> None: + ... + + def serve(self, port=..., *args, **kwargs): # -> None: + ... + + def on_data(self, address, data): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_data_tftp(self, address, request): # -> None: + ... + + def on_error_tftp(self, address, exception): # -> None: + ... + + + +if __name__ == "__main__": + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/torrent.pyi b/src/typings/netius/servers/torrent.pyi new file mode 100644 index 00000000..1effb57d --- /dev/null +++ b/src/typings/netius/servers/torrent.pyi @@ -0,0 +1,316 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +REFRESH_TIME = ... +ID_STRING = ... +BLOCK_SIZE = ... +THRESHOLD_END = ... +MAX_MISSING = ... +PEER_PATHS = ... +class Pieces(netius.Observable): + """ + Class that represents the logical structure of a file that is + divided into pieces and blocks as a hierarchy, this class is + responsible for the management of the data structures of such + data storage model. + + A piece is considered to be the basic unit of a torrent file + and each piece is composed by multiple blocks, note that the + number of blocks is fixed for all the pieces of a file. + """ + def __init__(self, length, number_pieces, number_blocks) -> None: + ... + + def piece(self, index): + ... + + def piece_blocks(self, index): # -> Any | int: + ... + + def piece_size(self, index): + ... + + def block(self, index, begin): + ... + + def block_size(self, index, begin): # -> Literal[16384]: + ... + + def pop_block(self, bitfield, mark=...): # -> tuple[int, int | Any, Any | Literal[16384]] | None: + ... + + def push_block(self, index, begin): # -> None: + ... + + def mark_piece(self, index, value=...): # -> None: + ... + + def mark_block(self, index, begin, value=...): # -> None: + ... + + def update_block(self, index, mark=...): # -> int: + ... + + def update_piece(self, index): # -> None: + ... + + @property + def total_pieces(self): # -> Any: + ... + + @property + def marked_pieces(self): # -> int: + ... + + @property + def missing_pieces(self, max_missing=...): # -> list[Any]: + ... + + @property + def total_blocks(self): + ... + + @property + def marked_blocks(self): # -> int: + ... + + @property + def missing_blocks(self, max_missing=...): # -> list[Any]: + ... + + + +class TorrentTask(netius.Observable): + """ + Describes a task (operation) that is going to be performed + using the peer to peer mesh network of the torrent protocol. + + Each of the download operations should be able to be described + by this task object (for latter reference). + + This should be considered the main interface to interact from + a developer point of view, as such the methods should represent + a proper easily described interface. + """ + def __init__(self, owner, target_path, torrent_path=..., info_hash=...) -> None: + ... + + def load(self): # -> None: + ... + + def unload(self): # -> None: + ... + + def on_close(self, connection): # -> None: + ... + + def ticks(self): # -> None: + ... + + def refresh(self): # -> None: + ... + + def on_choked(self, connection): # -> None: + ... + + def on_unchoked(self, connection): # -> None: + ... + + def on_block(self, pieces, index, begin): # -> None: + ... + + def on_piece(self, pieces, index): # -> None: + ... + + def on_complete(self, pieces): # -> None: + ... + + def on_dht(self, response): # -> None: + ... + + def on_tracker(self, client, parser, result): # -> None: + ... + + def load_info(self, torrent_path): # -> dict[Any, Any] | list[Any] | int | LiteralString: + ... + + def load_file(self): # -> None: + ... + + def load_single(self): # -> None: + ... + + def load_multiple(self): # -> None: + ... + + def unload_file(self): # -> None: + ... + + def load_pieces(self): # -> None: + ... + + def unload_pieces(self): # -> None: + ... + + def pieces_tracker(self): # -> None: + ... + + def set_data(self, data, index, begin): # -> None: + ... + + def write_data(self, data, offset): # -> None: + ... + + def set_dht(self, peer_t, port): # -> None: + ... + + def peers_dht(self): # -> None: + ... + + def peers_tracker(self): # -> None: + """ + Tries to retrieve as much information as possible about the + peers from the currently loaded tracker information. + + It's possible that no tracker information exits for the current + task and for such situations no state change will occur. + """ + ... + + def peers_file(self): # -> None: + ... + + def connect_peers(self): # -> None: + ... + + def disconnect_peers(self): # -> None: + ... + + def connect_peer(self, peer): # -> None: + ... + + def info_string(self): + ... + + def left(self): + ... + + def speed(self): # -> float: + """ + Retrieves a float number representing the global speed + of the task in bytes per second, this value is computed + using the original creation time of the task and so it + may not represent the most accurate speedup. + + :rtype: float + :return: The current speed of download, defined as bytes + per second from the original task creation time. + """ + ... + + def speed_s(self): + ... + + def percent(self): # -> float: + ... + + def pop_block(self, bitfield): # -> tuple[int, int | Any, Any | Literal[16384]] | None: + ... + + def push_block(self, index, begin): # -> None: + ... + + def verify_piece(self, index): # -> None: + ... + + def confirm_piece(self, index): # -> None: + ... + + def refute_piece(self, index): # -> None: + ... + + def extend_peers(self, peers): # -> None: + ... + + def add_peer(self, peer): # -> None: + ... + + def remove_peer(self, peer): # -> None: + ... + + + +class TorrentServer(netius.ContainerServer): + def __init__(self, *args, **kwargs) -> None: + ... + + def cleanup(self): # -> None: + ... + + def ticks(self): # -> None: + ... + + def download(self, target_path, torrent_path=..., info_hash=..., close=...): # -> TorrentTask: + """ + Starts the "downloading" process of a torrent associated file + using the defined peer to peer torrent strategy using either + the provided torrent path as reference or just the info hash + of the file that is going to be downloaded. + + Note that if only the info hash is provided a DHT based strategy + is going to be used to retrieve the peers list. + + The returned value is the task entity representing the newly created + task for the downloading of the requested file, this object may be + used for the operations and listening of events. + + :type target_path: String + :param target_path: The path to the directory that will be used to store + the binary information resulting from the download, this directory may also + be used to store some temporary information on state of download. + :type torrent_path: String + :param torrent_path: The path to the file that contains the torrent + information that is going to be used for file processing. + :type info_hash: String + :param info_hash: The info hash value of the file that is going + to be downloaded, may be used for magnet torrents (DHT). + :type close: bool + :param close: If the server infra-structure should be close (process ends) + at the end of the download, this is not the default behavior (multiple download). + :rtype: TorrentTask + :return: The torrent task object that represents the task that has been + created for downloading of the requested file. + """ + ... + + def add_task(self, task): # -> None: + ... + + def remove_task(self, task): # -> None: + ... + + def cleanup_tasks(self): # -> None: + ... + + + +if __name__ == "__main__": + def on_start(server): # -> None: + ... + + def on_piece(task, index): # -> None: + ... + + def on_complete(task): # -> None: + ... + + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/servers/ws.pyi b/src/typings/netius/servers/ws.pyi new file mode 100644 index 00000000..4590e535 --- /dev/null +++ b/src/typings/netius/servers/ws.pyi @@ -0,0 +1,67 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +class WSConnection(netius.Connection): + """ + Connection based class for the websockets connection, + should be able to implement the required encoding + and decoding techniques in compliance with the websockets + level 13 specification. + + :see: http://tools.ietf.org/html/rfc6455 + """ + def __init__(self, *args, **kwargs) -> None: + ... + + def send_ws(self, data): # -> int: + ... + + def recv_ws(self, size=...): # -> tuple[Any | bytes, Literal[b""]] | tuple[bytes, Any | bytes]: + ... + + def add_buffer(self, data): # -> None: + ... + + def get_buffer(self, delete=...): # -> bytes: + ... + + def do_handshake(self): # -> None: + ... + + def accept_key(self): # -> bytes | str: + ... + + + +class WSServer(netius.StreamServer): + """ + Base class for the creation of websocket server, should + handle both the upgrading/handshaking of the connection + and together with the associated connection class the + encoding and decoding of the frames. + """ + MAGIC_VALUE = ... + def on_data(self, connection, data): # -> None: + ... + + def build_connection(self, socket, address, ssl=...): # -> WSConnection: + ... + + def send_ws(self, connection, data): + ... + + def on_data_ws(self, connection, data): # -> None: + ... + + def on_handshake(self, connection): # -> None: + ... + + + diff --git a/src/typings/netius/servers/wsgi.pyi b/src/typings/netius/servers/wsgi.pyi new file mode 100644 index 00000000..89295353 --- /dev/null +++ b/src/typings/netius/servers/wsgi.pyi @@ -0,0 +1,44 @@ +""" +This type stub file was generated by pyright. +""" + +from . import http2 + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +SERVER_SOFTWARE = ... +COMPRESSED_LIMIT = ... +class WSGIServer(http2.HTTP2Server): + """ + Base class for the creation of a wsgi compliant server + the server should be initialized with the "target" app + object as reference and a mount point. + """ + def __init__(self, app, mount=..., decode=..., compressed_limit=..., *args, **kwargs) -> None: + ... + + def on_connection_d(self, connection): # -> None: + ... + + def on_serve(self): # -> None: + ... + + def on_data_http(self, connection, parser): # -> None: + ... + + def on_environ(self, connection, environ): # -> None: + ... + + + +if __name__ == "__main__": + def app(environ, start_response): # -> Generator[Literal['Hello World'], Any, None]: + ... + + server = ... +else: + __path__ = ... diff --git a/src/typings/netius/sh/__init__.pyi b/src/typings/netius/sh/__init__.pyi new file mode 100644 index 00000000..827d1e1e --- /dev/null +++ b/src/typings/netius/sh/__init__.pyi @@ -0,0 +1,11 @@ +""" +This type stub file was generated by pyright. +""" + +from . import base, dkim, rsa, smtp + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... diff --git a/src/typings/netius/sh/base.pyi b/src/typings/netius/sh/base.pyi new file mode 100644 index 00000000..4b58e911 --- /dev/null +++ b/src/typings/netius/sh/base.pyi @@ -0,0 +1,13 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def sh_call(globals=..., locals=...): # -> None: + ... + diff --git a/src/typings/netius/sh/dkim.pyi b/src/typings/netius/sh/dkim.pyi new file mode 100644 index 00000000..15ba6931 --- /dev/null +++ b/src/typings/netius/sh/dkim.pyi @@ -0,0 +1,20 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def generate(domain, suffix=..., number_bits=...): # -> None: + ... + +def sign(email_path, key_path, selector, domain): # -> None: + ... + +if __name__ == "__main__": + ... +else: + __path__ = ... diff --git a/src/typings/netius/sh/rsa.pyi b/src/typings/netius/sh/rsa.pyi new file mode 100644 index 00000000..7d62e53b --- /dev/null +++ b/src/typings/netius/sh/rsa.pyi @@ -0,0 +1,23 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def read_private(path): # -> None: + ... + +def read_public(path): # -> None: + ... + +def private_to_public(private_path, public_path): # -> None: + ... + +if __name__ == "__main__": + ... +else: + __path__ = ... diff --git a/src/typings/netius/sh/smtp.pyi b/src/typings/netius/sh/smtp.pyi new file mode 100644 index 00000000..95cc9a08 --- /dev/null +++ b/src/typings/netius/sh/smtp.pyi @@ -0,0 +1,17 @@ +""" +This type stub file was generated by pyright. +""" + +__author__ = ... +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... +def send(path, sender, receiver, host=..., port=..., username=..., password=..., stls=...): # -> None: + ... + +if __name__ == "__main__": + ... +else: + __path__ = ... diff --git a/src/typings/netius/test/__init__.pyi b/src/typings/netius/test/__init__.pyi new file mode 100644 index 00000000..be361b31 --- /dev/null +++ b/src/typings/netius/test/__init__.pyi @@ -0,0 +1,9 @@ +""" +This type stub file was generated by pyright. +""" + +__version__ = ... +__revision__ = ... +__date__ = ... +__copyright__ = ... +__license__ = ... From e5ce17dd60c25ad75a09349447911f233208acfd Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 16:09:28 +0000 Subject: [PATCH 02/20] feat: typing using mypy's stubgen --- src/typings/netius/__init__.pyi | 71 +- src/typings/netius/adapters/__init__.pyi | 26 +- src/typings/netius/adapters/base.pyi | 80 +- src/typings/netius/adapters/fs.pyi | 56 +- src/typings/netius/adapters/memory.pyi | 63 +- src/typings/netius/adapters/mongo.pyi | 31 +- src/typings/netius/adapters/null.pyi | 24 +- src/typings/netius/auth/__init__.pyi | 32 +- src/typings/netius/auth/address.pyi | 43 +- src/typings/netius/auth/allow.pyi | 35 +- src/typings/netius/auth/base.pyi | 38 +- src/typings/netius/auth/deny.pyi | 35 +- src/typings/netius/auth/dummy.pyi | 43 +- src/typings/netius/auth/memory.pyi | 56 +- src/typings/netius/auth/passwd.pyi | 44 +- src/typings/netius/auth/simple.pyi | 37 +- src/typings/netius/base/__init__.pyi | 71 +- src/typings/netius/base/agent.pyi | 79 +- src/typings/netius/base/async_neo.pyi | 172 +- src/typings/netius/base/async_old.pyi | 246 +-- src/typings/netius/base/asynchronous.pyi | 24 +- src/typings/netius/base/client.pyi | 322 ++-- src/typings/netius/base/common.pyi | 1589 ++++++----------- src/typings/netius/base/compat.pyi | 226 +-- src/typings/netius/base/config.pyi | 109 +- src/typings/netius/base/conn.pyi | 359 ++-- src/typings/netius/base/container.pyi | 182 +- src/typings/netius/base/diag.pyi | 61 +- src/typings/netius/base/errors.pyi | 168 +- src/typings/netius/base/legacy.pyi | 333 +--- src/typings/netius/base/log.pyi | 29 +- src/typings/netius/base/observer.pyi | 56 +- src/typings/netius/base/poll.pyi | 329 +--- src/typings/netius/base/protocol.pyi | 212 +-- src/typings/netius/base/request.pyi | 68 +- src/typings/netius/base/server.pyi | 278 ++- src/typings/netius/base/stream.pyi | 74 +- src/typings/netius/base/tls.pyi | 37 +- src/typings/netius/base/transport.pyi | 163 +- src/typings/netius/base/util.pyi | 59 +- src/typings/netius/clients/__init__.pyi | 38 +- src/typings/netius/clients/apn.pyi | 93 +- src/typings/netius/clients/dht.pyi | 121 +- src/typings/netius/clients/dns.pyi | 225 +-- src/typings/netius/clients/http.pyi | 450 ++--- src/typings/netius/clients/mjpg.pyi | 76 +- src/typings/netius/clients/raw.pyi | 59 +- src/typings/netius/clients/smtp.pyi | 317 +--- src/typings/netius/clients/ssdp.pyi | 79 +- src/typings/netius/clients/torrent.pyi | 183 +- src/typings/netius/clients/ws.pyi | 123 +- src/typings/netius/common/__init__.pyi | 117 +- src/typings/netius/common/asn.pyi | 88 +- src/typings/netius/common/calc.pyi | 177 +- src/typings/netius/common/dhcp.pyi | 102 +- src/typings/netius/common/dkim.pyi | 57 +- src/typings/netius/common/ftp.pyi | 46 +- src/typings/netius/common/geo.pyi | 53 +- src/typings/netius/common/http.pyi | 269 +-- src/typings/netius/common/http2.pyi | 634 ++----- src/typings/netius/common/mime.pyi | 104 +- src/typings/netius/common/parser.pyi | 60 +- src/typings/netius/common/pop.pyi | 45 +- src/typings/netius/common/rsa.pyi | 170 +- src/typings/netius/common/setup.pyi | 33 +- src/typings/netius/common/smtp.pyi | 46 +- src/typings/netius/common/socks.pyi | 117 +- src/typings/netius/common/stream.pyi | 110 +- src/typings/netius/common/structures.pyi | 51 +- src/typings/netius/common/style.pyi | 15 +- src/typings/netius/common/tftp.pyi | 25 +- src/typings/netius/common/tls.pyi | 57 +- src/typings/netius/common/torrent.pyi | 90 +- src/typings/netius/common/util.pyi | 216 +-- src/typings/netius/common/ws.pyi | 27 +- src/typings/netius/examples/__init__.pyi | 20 +- src/typings/netius/examples/http.pyi | 23 +- src/typings/netius/examples/upnp.pyi | 28 +- src/typings/netius/extra/__init__.pyi | 34 +- src/typings/netius/extra/desktop.pyi | 36 +- src/typings/netius/extra/dhcp_s.pyi | 50 +- src/typings/netius/extra/file.pyi | 106 +- src/typings/netius/extra/filea.pyi | 50 +- src/typings/netius/extra/hello.pyi | 51 +- src/typings/netius/extra/hello_w.pyi | 23 +- src/typings/netius/extra/proxy_d.pyi | 56 +- src/typings/netius/extra/proxy_f.pyi | 40 +- src/typings/netius/extra/proxy_r.pyi | 155 +- src/typings/netius/extra/smtp_r.pyi | 71 +- src/typings/netius/middleware/__init__.pyi | 28 +- src/typings/netius/middleware/annoyer.pyi | 42 +- src/typings/netius/middleware/base.pyi | 30 +- src/typings/netius/middleware/blacklist.pyi | 45 +- src/typings/netius/middleware/dummy.pyi | 40 +- src/typings/netius/middleware/flood.pyi | 46 +- src/typings/netius/middleware/proxy.pyi | 77 +- src/typings/netius/mock/__init__.pyi | 16 +- src/typings/netius/mock/appier.pyi | 23 +- src/typings/netius/pool/__init__.pyi | 24 +- src/typings/netius/pool/common.pyi | 248 +-- src/typings/netius/pool/file.pyi | 83 +- src/typings/netius/pool/notify.pyi | 27 +- src/typings/netius/pool/task.pyi | 44 +- src/typings/netius/servers/__init__.pyi | 47 +- src/typings/netius/servers/dhcp.pyi | 153 +- src/typings/netius/servers/echo.pyi | 36 +- src/typings/netius/servers/echo_ws.pyi | 31 +- src/typings/netius/servers/ftp.pyi | 282 +-- src/typings/netius/servers/http.pyi | 269 +-- src/typings/netius/servers/http2.pyi | 432 ++--- src/typings/netius/servers/mjpg.pyi | 57 +- src/typings/netius/servers/pop.pyi | 222 +-- src/typings/netius/servers/proxy.pyi | 149 +- src/typings/netius/servers/smtp.pyi | 233 +-- src/typings/netius/servers/socks.pyi | 128 +- src/typings/netius/servers/tftp.pyi | 152 +- src/typings/netius/servers/torrent.pyi | 414 +---- src/typings/netius/servers/ws.pyi | 93 +- src/typings/netius/servers/wsgi.pyi | 73 +- src/typings/netius/sh/__init__.pyi | 16 +- src/typings/netius/sh/auth.pyi | 7 + src/typings/netius/sh/base.pyi | 17 +- src/typings/netius/sh/dkim.pyi | 29 +- src/typings/netius/sh/rsa.pyi | 32 +- src/typings/netius/sh/smtp.pyi | 25 +- src/typings/netius/test/__init__.pyi | 12 +- src/typings/netius/test/auth/__init__.pyi | 3 + src/typings/netius/test/auth/allow.pyi | 12 + src/typings/netius/test/auth/deny.pyi | 12 + src/typings/netius/test/auth/simple.pyi | 12 + src/typings/netius/test/base/__init__.pyi | 3 + src/typings/netius/test/base/asynchronous.pyi | 13 + src/typings/netius/test/base/common.pyi | 12 + src/typings/netius/test/base/config.pyi | 13 + src/typings/netius/test/base/tls.pyi | 14 + src/typings/netius/test/base/transport.pyi | 12 + src/typings/netius/test/clients/__init__.pyi | 3 + src/typings/netius/test/clients/http.pyi | 16 + src/typings/netius/test/common/__init__.pyi | 3 + src/typings/netius/test/common/calc.pyi | 12 + src/typings/netius/test/common/dkim.pyi | 17 + src/typings/netius/test/common/http.pyi | 26 + src/typings/netius/test/common/mime.pyi | 12 + src/typings/netius/test/common/rsa.pyi | 12 + src/typings/netius/test/common/setup.pyi | 12 + src/typings/netius/test/common/util.pyi | 25 + src/typings/netius/test/extra/__init__.pyi | 3 + src/typings/netius/test/extra/proxy_r.pyi | 14 + src/typings/netius/test/extra/smtp_r.pyi | 18 + .../netius/test/middleware/__init__.pyi | 3 + src/typings/netius/test/middleware/proxy.pyi | 17 + src/typings/netius/test/pool/__init__.pyi | 3 + src/typings/netius/test/pool/common.pyi | 12 + src/typings/netius/test/servers/__init__.pyi | 3 + src/typings/netius/test/servers/http.pyi | 13 + 155 files changed, 5005 insertions(+), 10183 deletions(-) create mode 100644 src/typings/netius/sh/auth.pyi create mode 100644 src/typings/netius/test/auth/__init__.pyi create mode 100644 src/typings/netius/test/auth/allow.pyi create mode 100644 src/typings/netius/test/auth/deny.pyi create mode 100644 src/typings/netius/test/auth/simple.pyi create mode 100644 src/typings/netius/test/base/__init__.pyi create mode 100644 src/typings/netius/test/base/asynchronous.pyi create mode 100644 src/typings/netius/test/base/common.pyi create mode 100644 src/typings/netius/test/base/config.pyi create mode 100644 src/typings/netius/test/base/tls.pyi create mode 100644 src/typings/netius/test/base/transport.pyi create mode 100644 src/typings/netius/test/clients/__init__.pyi create mode 100644 src/typings/netius/test/clients/http.pyi create mode 100644 src/typings/netius/test/common/__init__.pyi create mode 100644 src/typings/netius/test/common/calc.pyi create mode 100644 src/typings/netius/test/common/dkim.pyi create mode 100644 src/typings/netius/test/common/http.pyi create mode 100644 src/typings/netius/test/common/mime.pyi create mode 100644 src/typings/netius/test/common/rsa.pyi create mode 100644 src/typings/netius/test/common/setup.pyi create mode 100644 src/typings/netius/test/common/util.pyi create mode 100644 src/typings/netius/test/extra/__init__.pyi create mode 100644 src/typings/netius/test/extra/proxy_r.pyi create mode 100644 src/typings/netius/test/extra/smtp_r.pyi create mode 100644 src/typings/netius/test/middleware/__init__.pyi create mode 100644 src/typings/netius/test/middleware/proxy.pyi create mode 100644 src/typings/netius/test/pool/__init__.pyi create mode 100644 src/typings/netius/test/pool/common.pyi create mode 100644 src/typings/netius/test/servers/__init__.pyi create mode 100644 src/typings/netius/test/servers/http.pyi diff --git a/src/typings/netius/__init__.pyi b/src/typings/netius/__init__.pyi index ee6f3bdb..1f0cc827 100644 --- a/src/typings/netius/__init__.pyi +++ b/src/typings/netius/__init__.pyi @@ -1,14 +1,57 @@ -""" -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__ = ... +from . import adapters as adapters, auth as auth, middleware as middleware, pool as pool +from .adapters import fs as fs, mongo as mongo, null as null +from .auth import address as address, allow as allow, base as base, deny as deny, dummy as dummy, memory as memory, passwd as passwd, simple as simple +from .base import agent as agent, async_neo as async_neo, async_old as async_old, asynchronous as asynchronous, client as client, common as common, compat as compat, config as config, conn as conn, container as container, errors as errors, legacy as legacy, log as log, observer as observer, poll as poll, protocol as protocol, request as request, server as server, stream as stream, tls as tls, transport as transport, util as util +from netius.adapters.base import BaseAdapter as BaseAdapter +from netius.adapters.fs import FsAdapter as FsAdapter +from netius.adapters.memory import MemoryAdapter as MemoryAdapter +from netius.adapters.mongo import MongoAdapter as MongoAdapter +from netius.adapters.null import NullAdapter as NullAdapter +from netius.auth.address import AddressAuth as AddressAuth +from netius.auth.allow import AllowAuth as AllowAuth +from netius.auth.base import Auth as Auth +from netius.auth.deny import DenyAuth as DenyAuth +from netius.auth.dummy import DummyAuth as DummyAuth +from netius.auth.memory import MemoryAuth as MemoryAuth +from netius.auth.passwd import PasswdAuth as PasswdAuth +from netius.auth.simple import SimpleAuth as SimpleAuth +from netius.base.agent import Agent as Agent, ClientAgent as ClientAgent, ServerAgent as ServerAgent +from netius.base.async_neo import Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.client import Client as Client, DatagramClient as DatagramClient, StreamClient as StreamClient +from netius.base.common import Base as Base, BaseThread as BaseThread, build_future as build_future, compat_loop as compat_loop, ensure as ensure, ensure_asyncio as ensure_asyncio, ensure_loop as ensure_loop, ensure_main as ensure_main, ensure_pool as ensure_pool, get_event_loop as get_event_loop, get_loop as get_loop, get_main as get_main, get_poll as get_poll, new_loop as new_loop, new_loop_asyncio as new_loop_asyncio, new_loop_main as new_loop_main, stop_loop as stop_loop +from netius.base.compat import CompatLoop as CompatLoop, build_datagram as build_datagram, connect_stream as connect_stream, is_asyncio as is_asyncio, is_compat as is_compat +from netius.base.config import conf as conf, conf_ctx as conf_ctx, conf_d as conf_d, conf_prefix as conf_prefix, conf_r as conf_r, conf_s as conf_s, conf_suffix as conf_suffix +from netius.base.conn import Connection as Connection +from netius.base.container import Container as Container, ContainerServer as ContainerServer +from netius.base.errors import AssertionError as AssertionError, DataError as DataError, GeneratorError as GeneratorError, NetiusError as NetiusError, NotImplemented as NotImplemented, ParserError as ParserError, PauseError as PauseError, RuntimeError as RuntimeError, SecurityError as SecurityError, StopError as StopError, WakeupError as WakeupError +from netius.base.log import rotating_handler as rotating_handler, smtp_handler as smtp_handler +from netius.base.observer import Observable as Observable +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll +from netius.base.protocol import DatagramProtocol as DatagramProtocol, Protocol as Protocol, StreamProtocol as StreamProtocol +from netius.base.request import Request as Request, Response as Response +from netius.base.server import DatagramServer as DatagramServer, Server as Server, StreamServer as StreamServer +from netius.base.stream import Stream as Stream +from netius.base.tls import dnsname_match as dnsname_match, dump_certificate as dump_certificate, fingerprint as fingerprint, match_fingerprint as match_fingerprint, match_hostname as match_hostname +from netius.base.transport import Transport as Transport, TransportDatagram as TransportDatagram, TransportStream as TransportStream +from netius.base.util import camel_to_underscore as camel_to_underscore, verify as verify + +__version__: str +__revision__: str +__date__: str +NAME: str +VERSION: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +TCP_TYPE: int +UDP_TYPE: int +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +SILENT: int diff --git a/src/typings/netius/adapters/__init__.pyi b/src/typings/netius/adapters/__init__.pyi index 91af2c13..2ccebdee 100644 --- a/src/typings/netius/adapters/__init__.pyi +++ b/src/typings/netius/adapters/__init__.pyi @@ -1,16 +1,10 @@ -""" -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__ = ... +from . import base as base, fs as fs, memory as memory, mongo as mongo, null as null +from netius.adapters.base import BaseAdapter as BaseAdapter +from netius.adapters.fs import FsAdapter as FsAdapter +from netius.adapters.memory import MemoryAdapter as MemoryAdapter +from netius.adapters.mongo import MongoAdapter as MongoAdapter +from netius.adapters.null import NullAdapter as NullAdapter + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/adapters/base.pyi b/src/typings/netius/adapters/base.pyi index 26ff92cc..314eb392 100644 --- a/src/typings/netius/adapters/base.pyi +++ b/src/typings/netius/adapters/base.pyi @@ -1,59 +1,21 @@ -""" -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: - ... - - - +import netius as netius +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class BaseAdapter: + def set(self, value, owner: str = ...): ... + def get(self, key): ... + def get_file(self, key, mode: str = ...): ... + def delete(self, key, owner: str = ...): ... + def append(self, key, value): ... + def truncate(self, key, count): ... + def size(self, key): ... + def sizes(self, owner: Incomplete | None = ...): ... + def total(self, owner: Incomplete | None = ...): ... + def reserve(self, owner: str = ...): ... + def count(self, owner: Incomplete | None = ...): ... + def list(self, owner: Incomplete | None = ...): ... + def generate(self): ... diff --git a/src/typings/netius/adapters/fs.pyi b/src/typings/netius/adapters/fs.pyi index 09f12125..b3d62e5a 100644 --- a/src/typings/netius/adapters/fs.pyi +++ b/src/typings/netius/adapters/fs.pyi @@ -1,36 +1,20 @@ -""" -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]: - ... - - - +import netius as netius +import netius.adapters.base +import netius.adapters.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class FsAdapter(netius.adapters.base.BaseAdapter): + def __init__(self, base_path: Incomplete | None = ...) -> None: ... + def set(self, value, owner: str = ...): ... + def get_file(self, key, mode: str = ...): ... + def delete(self, key, owner: str = ...): ... + def size(self, key): ... + def count(self, owner: Incomplete | None = ...): ... + def list(self, owner: Incomplete | None = ...): ... + def _path(self, owner: Incomplete | None = ...): ... + def _ensure(self, owner): ... + def _symlink(self, source, target): ... diff --git a/src/typings/netius/adapters/memory.pyi b/src/typings/netius/adapters/memory.pyi index 1016feee..6beded63 100644 --- a/src/typings/netius/adapters/memory.pyi +++ b/src/typings/netius/adapters/memory.pyi @@ -1,42 +1,21 @@ -""" -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]: - ... - - - +import netius as netius +import netius.adapters.base +import netius.adapters.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class MemoryAdapter(netius.adapters.base.BaseAdapter): + def __init__(self) -> None: ... + def set(self, value, owner: str = ...): ... + def get_file(self, key, mode: str = ...): ... + def delete(self, key, owner: str = ...): ... + def append(self, key, value): ... + def truncate(self, key, count): ... + def size(self, key): ... + def count(self, owner: Incomplete | None = ...): ... + def list(self, owner: Incomplete | None = ...): ... + def _ensure(self, owner): ... + def _build_close(self, file, key): ... diff --git a/src/typings/netius/adapters/mongo.pyi b/src/typings/netius/adapters/mongo.pyi index d8b5e2a5..e4971ed8 100644 --- a/src/typings/netius/adapters/mongo.pyi +++ b/src/typings/netius/adapters/mongo.pyi @@ -1,21 +1,10 @@ -""" -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: - ... - - - +import netius.adapters.base +import netius.adapters.base as base + +__version__: str +__revision__: str +__date__: str + +class MongoAdapter(netius.adapters.base.BaseAdapter): + def set(self, value, owner: str = ...): ... + def get(self, key): ... diff --git a/src/typings/netius/adapters/null.pyi b/src/typings/netius/adapters/null.pyi index 5de62e41..d699c1a3 100644 --- a/src/typings/netius/adapters/null.pyi +++ b/src/typings/netius/adapters/null.pyi @@ -1,16 +1,8 @@ -""" -This type stub file was generated by pyright. -""" - -from . import base - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class NullAdapter(base.BaseAdapter): - ... - - +import netius.adapters.base +import netius.adapters.base as base + +__version__: str +__revision__: str +__date__: str + +class NullAdapter(netius.adapters.base.BaseAdapter): ... diff --git a/src/typings/netius/auth/__init__.pyi b/src/typings/netius/auth/__init__.pyi index bf8e7198..5b644853 100644 --- a/src/typings/netius/auth/__init__.pyi +++ b/src/typings/netius/auth/__init__.pyi @@ -1,19 +1,13 @@ -""" -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__ = ... +from . import address as address, allow as allow, base as base, deny as deny, dummy as dummy, memory as memory, passwd as passwd, simple as simple +from netius.auth.address import AddressAuth as AddressAuth +from netius.auth.allow import AllowAuth as AllowAuth +from netius.auth.base import Auth as Auth +from netius.auth.deny import DenyAuth as DenyAuth +from netius.auth.dummy import DummyAuth as DummyAuth +from netius.auth.memory import MemoryAuth as MemoryAuth +from netius.auth.passwd import PasswdAuth as PasswdAuth +from netius.auth.simple import SimpleAuth as SimpleAuth + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/auth/address.pyi b/src/typings/netius/auth/address.pyi index 2358742f..20b5682b 100644 --- a/src/typings/netius/auth/address.pyi +++ b/src/typings/netius/auth/address.pyi @@ -1,29 +1,14 @@ -""" -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: - ... - - - +import netius.auth.base +import netius.auth.base as base + +__version__: str +__revision__: str +__date__: str + +class AddressAuth(netius.auth.base.Auth): + def __init__(self, allowed: list = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, allowed: list = ..., *args, **kwargs): ... + @classmethod + def is_simple(cls): ... + def auth_i(self, *args, **kwargs): ... diff --git a/src/typings/netius/auth/allow.pyi b/src/typings/netius/auth/allow.pyi index 3ddc63de..4ce75a16 100644 --- a/src/typings/netius/auth/allow.pyi +++ b/src/typings/netius/auth/allow.pyi @@ -1,23 +1,12 @@ -""" -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]: - ... - - - +import netius.auth.base +import netius.auth.base as base + +__version__: str +__revision__: str +__date__: str + +class AllowAuth(netius.auth.base.Auth): + @classmethod + def auth(cls, *args, **kwargs): ... + @classmethod + def is_simple(cls): ... diff --git a/src/typings/netius/auth/base.pyi b/src/typings/netius/auth/base.pyi index b1e490a8..a609d35f 100644 --- a/src/typings/netius/auth/base.pyi +++ b/src/typings/netius/auth/base.pyi @@ -1,22 +1,28 @@ -""" -This type stub file was generated by pyright. -""" +import netius as netius +from _typeshed import Incomplete -from typing import Literal +__version__: str +__revision__: str +__date__: str -HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"] class Auth: + def __init__(self, *args, **kwargs) -> None: ... @classmethod - def verify(cls, encoded: str, decoded: str) -> bool: - ... - + def auth(cls, *args, **kwargs): ... @classmethod - def generate(cls, password: str, type: HashType = ..., salt: str = ...) -> str: - ... - + def meta(cls, *args, **kwargs): ... @classmethod - def unpack(cls, password: str) -> tuple[HashType, str, str, str]: - ... - - - + def auth_assert(cls, *args, **kwargs): ... + @classmethod + def verify(cls, encoded, decoded): ... + @classmethod + def generate(cls, password, type: str = ..., salt: str = ...): ... + @classmethod + def unpack(cls, password): ... + @classmethod + def get_file(cls, path, cache: bool = ..., encoding: Incomplete | None = ...): ... + @classmethod + def is_simple(cls): ... + def auth_i(self, *args, **kwargs): ... + def auth_assert_i(self, *args, **kwargs): ... + def is_simple_i(self): ... diff --git a/src/typings/netius/auth/deny.pyi b/src/typings/netius/auth/deny.pyi index 1a976c25..bc0bb1d9 100644 --- a/src/typings/netius/auth/deny.pyi +++ b/src/typings/netius/auth/deny.pyi @@ -1,23 +1,12 @@ -""" -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]: - ... - - - +import netius.auth.base +import netius.auth.base as base + +__version__: str +__revision__: str +__date__: str + +class DenyAuth(netius.auth.base.Auth): + @classmethod + def auth(cls, *args, **kwargs): ... + @classmethod + def is_simple(cls): ... diff --git a/src/typings/netius/auth/dummy.pyi b/src/typings/netius/auth/dummy.pyi index 8e9f3cb8..f0a43e1d 100644 --- a/src/typings/netius/auth/dummy.pyi +++ b/src/typings/netius/auth/dummy.pyi @@ -1,29 +1,14 @@ -""" -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: - ... - - - +import netius.auth.base +import netius.auth.base as base + +__version__: str +__revision__: str +__date__: str + +class DummyAuth(netius.auth.base.Auth): + def __init__(self, value: bool = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, value: bool = ..., *args, **kwargs): ... + @classmethod + def is_simple(cls): ... + def auth_i(self, *args, **kwargs): ... diff --git a/src/typings/netius/auth/memory.pyi b/src/typings/netius/auth/memory.pyi index c94fc855..5f93ba66 100644 --- a/src/typings/netius/auth/memory.pyi +++ b/src/typings/netius/auth/memory.pyi @@ -1,36 +1,20 @@ -""" -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: - ... - - - +import netius as netius +import netius.auth.base +import netius.auth.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class MemoryAuth(netius.auth.base.Auth): + def __init__(self, registry: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, username, password, registry: Incomplete | None = ..., *args, **kwargs): ... + @classmethod + def meta(cls, username, registry: Incomplete | None = ..., *args, **kwargs): ... + @classmethod + def get_registry(cls): ... + @classmethod + def load_registry(cls): ... + def auth_i(self, username, password, *args, **kwargs): ... diff --git a/src/typings/netius/auth/passwd.pyi b/src/typings/netius/auth/passwd.pyi index 83680704..5ac7bf12 100644 --- a/src/typings/netius/auth/passwd.pyi +++ b/src/typings/netius/auth/passwd.pyi @@ -1,29 +1,15 @@ -""" -This type stub file was generated by pyright. -""" - -from . import base - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class PasswdAuth(base.Auth): - def __init__(self, path=..., *args, **kwargs) -> None: - ... - - @classmethod - def auth(cls, username, password, path=..., *args, **kwargs): # -> bool: - ... - - @classmethod - def get_passwd(cls, path, cache=...): # -> dict[Any, Any]: - ... - - def auth_i(self, username, password, *args, **kwargs): # -> bool: - ... - - - +import netius.auth.base +import netius.auth.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class PasswdAuth(netius.auth.base.Auth): + def __init__(self, path: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, username, password, path: str = ..., *args, **kwargs): ... + @classmethod + def get_passwd(cls, path, cache: bool = ...): ... + def auth_i(self, username, password, *args, **kwargs): ... diff --git a/src/typings/netius/auth/simple.pyi b/src/typings/netius/auth/simple.pyi index 60b450ff..747d719c 100644 --- a/src/typings/netius/auth/simple.pyi +++ b/src/typings/netius/auth/simple.pyi @@ -1,24 +1,13 @@ -""" -This type stub file was generated by pyright. -""" - -from . import base - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class SimpleAuth(base.Auth): - def __init__(self, username=..., password=..., *args, **kwargs) -> None: - ... - - @classmethod - def auth(cls, username, password, target=..., *args, **kwargs): # -> bool: - ... - - def auth_i(self, username, password, *args, **kwargs): # -> bool: - ... - - - +import netius.auth.base +import netius.auth.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class SimpleAuth(netius.auth.base.Auth): + def __init__(self, username: Incomplete | None = ..., password: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def auth(cls, username, password, target: Incomplete | None = ..., *args, **kwargs): ... + def auth_i(self, username, password, *args, **kwargs): ... diff --git a/src/typings/netius/base/__init__.pyi b/src/typings/netius/base/__init__.pyi index 9636e772..b2dfc947 100644 --- a/src/typings/netius/base/__init__.pyi +++ b/src/typings/netius/base/__init__.pyi @@ -1,30 +1,41 @@ -""" -This type stub file was generated by pyright. -""" - -from . import agent, asynchronous, client, common, compat, config, conn, container, errors, legacy, log, observer, poll, protocol, request, server, stream, tls, transport, util -from .agent import Agent, ClientAgent, ServerAgent -from .asynchronous import Executor, Future, Handle, Task, ThreadPoolExecutor, async_test, async_test_all, coroutine, coroutine_return, ensure_generator, get_asyncio, is_asynclib, is_await, is_coroutine, is_coroutine_native, is_coroutine_object, is_future, is_neo, notify, sleep, wait, wakeup -from .client import Client, DatagramClient, StreamClient -from .common import Base, BaseThread, IDENTIFIER, IDENTIFIER_LONG, IDENTIFIER_SHORT, NAME, SSL_CA_PATH, SSL_CER_PATH, SSL_DH_PATH, SSL_KEY_PATH, TCP_TYPE, UDP_TYPE, VERSION, build_future, compat_loop, ensure, ensure_asyncio, ensure_loop, ensure_main, ensure_pool, get_event_loop, get_loop, get_main, get_poll, new_loop, new_loop_asyncio, new_loop_main, stop_loop -from .compat import BaseLoop, CompatLoop, build_datagram, connect_stream, is_asyncio, is_compat -from .config import conf, conf_ctx, conf_d, conf_prefix, conf_r, conf_s, conf_suffix -from .conn import CHUNK_SIZE, CLOSED, Connection, OPEN, PENDING -from .container import Container, ContainerServer -from .errors import AssertionError, DataError, GeneratorError, NetiusError, NotImplemented, ParserError, PauseError, RuntimeError, SecurityError, StopError, WakeupError -from .log import SILENT, rotating_handler, smtp_handler -from .observer import Observable -from .poll import EpollPoll, KqueuePoll, Poll, PollPoll, SelectPoll -from .protocol import DatagramProtocol, Protocol, StreamProtocol -from .request import Request, Response -from .server import DatagramServer, Server, StreamServer -from .stream import Stream -from .tls import dnsname_match, dump_certificate, fingerprint, match_fingerprint, match_hostname -from .transport import Transport, TransportDatagram, TransportStream -from .util import camel_to_underscore, verify - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import agent as agent, async_neo as async_neo, async_old as async_old, asynchronous as asynchronous, client as client, common as common, compat as compat, config as config, conn as conn, container as container, errors as errors, legacy as legacy, log as log, observer as observer, poll as poll, protocol as protocol, request as request, server as server, stream as stream, tls as tls, transport as transport, util as util +from netius.base.agent import Agent as Agent, ClientAgent as ClientAgent, ServerAgent as ServerAgent +from netius.base.async_neo import Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.client import Client as Client, DatagramClient as DatagramClient, StreamClient as StreamClient +from netius.base.common import Base as Base, BaseThread as BaseThread, build_future as build_future, compat_loop as compat_loop, ensure as ensure, ensure_asyncio as ensure_asyncio, ensure_loop as ensure_loop, ensure_main as ensure_main, ensure_pool as ensure_pool, get_event_loop as get_event_loop, get_loop as get_loop, get_main as get_main, get_poll as get_poll, new_loop as new_loop, new_loop_asyncio as new_loop_asyncio, new_loop_main as new_loop_main, stop_loop as stop_loop +from netius.base.compat import CompatLoop as CompatLoop, build_datagram as build_datagram, connect_stream as connect_stream, is_asyncio as is_asyncio, is_compat as is_compat +from netius.base.config import conf as conf, conf_ctx as conf_ctx, conf_d as conf_d, conf_prefix as conf_prefix, conf_r as conf_r, conf_s as conf_s, conf_suffix as conf_suffix +from netius.base.conn import Connection as Connection +from netius.base.container import Container as Container, ContainerServer as ContainerServer +from netius.base.errors import AssertionError as AssertionError, DataError as DataError, GeneratorError as GeneratorError, NetiusError as NetiusError, NotImplemented as NotImplemented, ParserError as ParserError, PauseError as PauseError, RuntimeError as RuntimeError, SecurityError as SecurityError, StopError as StopError, WakeupError as WakeupError +from netius.base.log import rotating_handler as rotating_handler, smtp_handler as smtp_handler +from netius.base.observer import Observable as Observable +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll +from netius.base.protocol import DatagramProtocol as DatagramProtocol, Protocol as Protocol, StreamProtocol as StreamProtocol +from netius.base.request import Request as Request, Response as Response +from netius.base.server import DatagramServer as DatagramServer, Server as Server, StreamServer as StreamServer +from netius.base.stream import Stream as Stream +from netius.base.tls import dnsname_match as dnsname_match, dump_certificate as dump_certificate, fingerprint as fingerprint, match_fingerprint as match_fingerprint, match_hostname as match_hostname +from netius.base.transport import Transport as Transport, TransportDatagram as TransportDatagram, TransportStream as TransportStream +from netius.base.util import camel_to_underscore as camel_to_underscore, verify as verify + +__version__: str +__revision__: str +__date__: str +NAME: str +VERSION: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +TCP_TYPE: int +UDP_TYPE: int +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +SILENT: int diff --git a/src/typings/netius/base/agent.pyi b/src/typings/netius/base/agent.pyi index 0e891ed0..d4814c28 100644 --- a/src/typings/netius/base/agent.pyi +++ b/src/typings/netius/base/agent.pyi @@ -1,56 +1,23 @@ -""" -This type stub file was generated by pyright. -""" - -from . import observer - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Agent(observer.Observable): - """ - Top level class for the entry point classes of the multiple - client and server protocol implementations. - - These classes should contain a series of utilities that facilitate - the interaction with the Protocol, Event Loop and Transport - objects (with the end developer in mind). - - Most of the interaction for a simple protocol should be implemented - using static or class methods, avoiding internal object state and - instantiation of the concrete Agent class. - - For complex protocols instantiation may be useful to provided extra - flexibility and context for abstract operations. - """ - @classmethod - def cleanup_s(cls): # -> None: - ... - - def cleanup(self, destroy=...): # -> None: - ... - - def destroy(self): # -> None: - ... - - - -class ClientAgent(Agent): - _clients = ... - @classmethod - def cleanup_s(cls): # -> None: - ... - - @classmethod - def get_client_s(cls, *args, **kwargs): # -> Self: - ... - - - -class ServerAgent(Agent): - ... - - +import netius.base.legacy as legacy +import netius.base.observer +import netius.base.observer as observer +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class Agent(netius.base.observer.Observable): + @classmethod + def cleanup_s(cls): ... + def cleanup(self, destroy: bool = ...): ... + def destroy(self): ... + +class ClientAgent(Agent): + _clients: ClassVar[dict] = ... + @classmethod + def cleanup_s(cls): ... + @classmethod + def get_client_s(cls, *args, **kwargs): ... + +class ServerAgent(Agent): ... diff --git a/src/typings/netius/base/async_neo.pyi b/src/typings/netius/base/async_neo.pyi index 677ebfc1..0ab9b3e4 100644 --- a/src/typings/netius/base/async_neo.pyi +++ b/src/typings/netius/base/async_neo.pyi @@ -1,127 +1,45 @@ -""" -This type stub file was generated by pyright. -""" - -from . import async_old - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Future(async_old.Future): - """ - Specialized Future class that supports the async/await - syntax to be used in a future, so that it becomes compliant - with the basic Python asyncio strategy for futures. - - Using this future it should be possible to ``await Future()` - for a simpler usage. - """ - def __iter__(self): # -> Generator[Self, Any, Any | None]: - ... - - def __await__(self): # -> Generator[Self, Any, Any | None]: - ... - - - -class AwaitWrapper: - """ - Wrapper class meant to be used to encapsulate "old" - generator based objects as async generator objects that - are eligible to be used with the async/await syntax. - - It's also possible to pass simple values instead of - generator functions and still use the wrapper. - """ - _is_generator = ... - def __init__(self, generator, generate=...) -> None: - ... - - def __await__(self): # -> Generator[Any, Any, Any | None] | Generator[None, Any, Generator[Any, Any, None] | Any]: - ... - - def __iter__(self): # -> Self: - ... - - def __next__(self): - ... - - def next(self): - ... - - def generate(self, value): # -> Generator[Any, Any, None]: - ... - - - -class CoroutineWrapper: - """ - Wrapper class meant to encapsulate a coroutine object - as a standard iterator sequence to be used in chain/iterator - like execution environment. - - This is only required for the native coroutine objects - so that they can comply with the required netius interface. - """ - def __init__(self, coroutine) -> None: - ... - - def __iter__(self): # -> Self: - ... - - def __next__(self): - ... - - def next(self): - ... - - def restore(self, value): # -> None: - ... - - - -def coroutine(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], AwaitWrapper]: - ... - -def ensure_generator(value): # -> tuple[Literal[True], Any] | tuple[Literal[True], CoroutineWrapper] | tuple[Literal[False], Any]: - ... - -def get_asyncio(): # -> Any | None: - ... - -def is_coroutine(callable): # -> bool: - ... - -def is_coroutine_object(generator): # -> bool: - ... - -def is_coroutine_native(generator): # -> bool: - ... - -def is_future(future): # -> bool: - ... - -def sleep(*args, **kwargs): # -> AwaitWrapper: - ... - -def wait(*args, **kwargs): # -> AwaitWrapper: - ... - -def coroutine_return(coroutine): # -> AwaitWrapper: - """ - Allows for the abstraction of the return value of a coroutine - object to be the result of the future yield as the first element - of the generator. - - This allows the possibility to provide compatibility with the legacy - not return allowed generators. - - :type coroutine: CoroutineObject - :param coroutine: The coroutine object that is going to be yield back - and have its last future result returned from the generator. - """ - ... - +import netius.base.async_old +import netius.base.async_old as async_old +import netius.base.errors as errors +import netius.base.legacy as legacy +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class Future(netius.base.async_old.Future): + def __iter__(self): ... + def __await__(self): ... + +class AwaitWrapper: + _is_generator: ClassVar[bool] = ... + def __init__(self, generator, generate: bool = ...) -> None: ... + def __await__(self): ... + def __iter__(self): ... + def __next__(self): ... + def next(self): ... + def generate(self, value): ... + def _await_generator(self): ... + def _await_basic(self): ... + +class CoroutineWrapper: + def __init__(self, coroutine) -> None: ... + def __iter__(self): ... + def __next__(self): ... + def next(self): ... + def restore(self, value): ... +def coroutine(function): ... +def ensure_generator(value): ... +def get_asyncio(): ... +def is_coroutine(callable): ... +def is_coroutine_object(generator): ... +def is_coroutine_native(generator): ... +def is_future(future): ... +def _sleep(timeout, compat: bool = ...): ... +def _wait(event, timeout: Incomplete | None = ..., future: Incomplete | None = ...): ... +def sleep(*args, **kwargs): ... +def wait(*args, **kwargs): ... +def coroutine_return(coroutine): ... +def _coroutine_return(coroutine): ... diff --git a/src/typings/netius/base/async_old.pyi b/src/typings/netius/base/async_old.pyi index 2f8242fd..30e9dbce 100644 --- a/src/typings/netius/base/async_old.pyi +++ b/src/typings/netius/base/async_old.pyi @@ -1,180 +1,66 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Future: - """ - Base future object that represents a promise that a certain - operation is going to be accomplished. - - Should be used as a placeholder for the callbacks for error - and success and the for the final result of the execution. - - Most of the implementation takes inspiration on the reference - Python implementation on futures. - - :see: https://en.wikipedia.org/wiki/Futures_and_promises - """ - def __init__(self, loop=...) -> None: - ... - - def __iter__(self): # -> Generator[Self, Any, None]: - ... - - def cleanup(self): # -> None: - ... - - def running(self): # -> bool: - ... - - def done(self): # -> bool: - ... - - def cancelled(self): # -> bool: - ... - - def finished(self): # -> bool: - ... - - def result(self): # -> None: - ... - - def exception(self, timeout=...): # -> None: - ... - - def partial(self, value): # -> None: - ... - - def add_done_callback(self, function): # -> None: - ... - - def add_partial_callback(self, function): # -> None: - ... - - def add_ready_callback(self, function): # -> None: - ... - - def add_closed_callback(self, function): # -> None: - ... - - def approve(self, cleanup=...): # -> None: - ... - - def cancel(self, cleanup=..., force=...): # -> bool: - ... - - def set_result(self, result, cleanup=..., force=...): # -> None: - ... - - def set_exception(self, exception, cleanup=..., force=...): # -> None: - ... - - @property - def ready(self): # -> Literal[True]: - ... - - @property - def closed(self): # -> Literal[False]: - ... - - - -class Task(Future): - def __init__(self, future=...) -> None: - ... - - - -class Handle: - def __init__(self, callable_t=...) -> None: - ... - - def cancel(self): # -> None: - ... - - - -class Executor: - def submit(self, callable, *args, **kwargs): - ... - - - -class ThreadPoolExecutor(Executor): - def __init__(self, owner) -> None: - ... - - def submit(self, callable, *args, **kwargs): - ... - - - -def coroutine(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], Generator[Any, Any, None]]: - ... - -def async_test_all(factory=..., close=...): # -> Callable[..., _Wrapped[Callable[..., Any], Any, Callable[..., Any], Any]]: - ... - -def async_test(function): # -> _Wrapped[Callable[..., Any], Any, Callable[..., Any], Any]: - ... - -def ensure_generator(value): # -> tuple[Literal[True], Any] | tuple[Literal[False], Any]: - ... - -def get_asyncio(): # -> None: - ... - -def is_coroutine(callable): # -> bool: - ... - -def is_coroutine_object(generator): # -> bool: - ... - -def is_coroutine_native(generator): # -> Literal[False]: - ... - -def is_future(future): # -> bool: - ... - -def is_neo(): # -> bool: - ... - -def is_asynclib(): # -> bool: - ... - -def is_await(): # -> bool: - ... - -def wakeup(force=...): - ... - -def sleep(timeout, compat=..., future=...): # -> Generator[Any, Any, None]: - ... - -def wait(event, timeout=..., future=...): # -> Generator[Any, Any, None]: - ... - -def notify(event, data=...): - ... - -def coroutine_return(coroutine): # -> Generator[Any, Any, None]: - """ - Allows for the abstraction of the return value of a coroutine - object to be the result of the future yield as the first element - of the generator. - - This allows the possibility to provide compatibility with the legacy - not return allowed generators. - - :type coroutine: CoroutineObject - :param coroutine: The coroutine object that is going to be yield back - and have its last future result returned from the generator. - """ - ... - +import netius.base.errors as errors +import netius.base.legacy as legacy +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class Future: + def __init__(self, loop: Incomplete | None = ...) -> None: ... + def __iter__(self): ... + def cleanup(self): ... + def running(self): ... + def done(self): ... + def cancelled(self): ... + def finished(self): ... + def result(self): ... + def exception(self, timeout: Incomplete | None = ...): ... + def partial(self, value): ... + def add_done_callback(self, function): ... + def add_partial_callback(self, function): ... + def add_ready_callback(self, function): ... + def add_closed_callback(self, function): ... + def approve(self, cleanup: bool = ...): ... + def cancel(self, cleanup: bool = ..., force: bool = ...): ... + def set_result(self, result, cleanup: bool = ..., force: bool = ...): ... + def set_exception(self, exception, cleanup: bool = ..., force: bool = ...): ... + def _done_callbacks(self, cleanup: bool = ..., delayed: bool = ...): ... + def _partial_callbacks(self, value, delayed: bool = ...): ... + def _wrap(self, future): ... + def _delay(self, callable): ... + @property + def ready(self): ... + @property + def closed(self): ... + +class Task(Future): + def __init__(self, future: Incomplete | None = ...) -> None: ... + +class Handle: + def __init__(self, callable_t: Incomplete | None = ...) -> None: ... + def cancel(self): ... + +class Executor: + def submit(self, callable, *args, **kwargs): ... + +class ThreadPoolExecutor(Executor): + def __init__(self, owner) -> None: ... + def submit(self, callable, *args, **kwargs): ... +def coroutine(function): ... +def async_test_all(factory: Incomplete | None = ..., close: bool = ...): ... +def async_test(function): ... +def ensure_generator(value): ... +def get_asyncio(): ... +def is_coroutine(callable): ... +def is_coroutine_object(generator): ... +def is_coroutine_native(generator): ... +def is_future(future): ... +def is_neo(): ... +def is_asynclib(): ... +def is_await(): ... +def wakeup(force: bool = ...): ... +def sleep(timeout, compat: bool = ..., future: Incomplete | None = ...): ... +def wait(event, timeout: Incomplete | None = ..., future: Incomplete | None = ...): ... +def notify(event, data: Incomplete | None = ...): ... +def coroutine_return(coroutine): ... diff --git a/src/typings/netius/base/asynchronous.pyi b/src/typings/netius/base/asynchronous.pyi index 37db4196..78ebec66 100644 --- a/src/typings/netius/base/asynchronous.pyi +++ b/src/typings/netius/base/asynchronous.pyi @@ -1,15 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -from .async_old import * -from .async_neo import * - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -if is_neo(): - ... +import netius.base.async_old as async_old +import netius.base.errors as errors +import netius.base.legacy as legacy +from netius.base.async_neo import AwaitWrapper as AwaitWrapper, CoroutineWrapper as CoroutineWrapper, Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/base/client.pyi b/src/typings/netius/base/client.pyi index ad5fa124..09a81b47 100644 --- a/src/typings/netius/base/client.pyi +++ b/src/typings/netius/base/client.pyi @@ -1,186 +1,136 @@ -""" -This type stub file was generated by pyright. -""" - -from .conn import * -from .common import * - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_SIZE = ... -GC_TIMEOUT = ... -class Client(Base): - """ - Abstract client implementation, should provide the required - mechanisms for basic socket client handling and thread starting - and managing techniques. Proper and concrete implementation for - the various socket types should inherit from this class. - """ - _client = ... - def __init__(self, thread=..., daemon=..., *args, **kwargs) -> None: - ... - - @classmethod - def get_client_s(cls, *args, **kwargs): # -> Self: - ... - - @classmethod - def cleanup_s(cls): # -> None: - ... - - def ensure_loop(self, env=...): # -> None: - """ - Ensures that the proper main loop thread requested in the building - of the entity is started if that was requested. - - This mechanism is required because the thread construction and - starting should be deferred until an operation in the connection - is requested (lazy thread construction). - - The call to this method should be properly inserted on the code so - that it is only called when a main (polling) loop is required. - - :type env: bool - :param env: If the environment variables should be used for the - setting of some of the parameters of the new client/poll to be used. - """ - ... - - def join(self, timeout=...): # -> None: - ... - - - -class DatagramClient(Client): - def __init__(self, *args, **kwargs) -> None: - ... - - def boot(self): # -> None: - ... - - def cleanup(self): # -> None: - ... - - def on_read(self, _socket): # -> None: - ... - - def on_write(self, _socket): # -> None: - ... - - def on_error(self, _socket): # -> None: - ... - - def on_exception(self, exception): # -> None: - ... - - def on_expected(self, exception): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def keep_gc(self, timeout=..., run=...): # -> None: - ... - - def gc(self, callbacks=...): # -> None: - ... - - def add_request(self, request): # -> None: - ... - - def remove_request(self, request): # -> None: - ... - - def get_request(self, id): - ... - - def ensure_socket(self): # -> None: - ... - - def ensure_write(self): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: - ... - - def remove_write(self): # -> None: - ... - - def enable_read(self): # -> None: - ... - - def disable_read(self): # -> None: - ... - - def send(self, data, address, delay=..., ensure_loop=..., callback=...): # -> None: - ... - - - -class StreamClient(Client): - def __init__(self, *args, **kwargs) -> None: - ... - - def cleanup(self): # -> None: - ... - - def ticks(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def acquire_c(self, host, port, ssl=..., key_file=..., cer_file=..., validate=..., callback=...): - ... - - def release_c(self, connection): # -> None: - ... - - def remove_c(self, connection): # -> None: - ... - - def validate_c(self, connection, close=...): - ... - - def connect(self, host, port, ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=..., ensure_loop=..., env=...): - ... - - def acquire(self, connection): # -> None: - ... - - def on_read(self, _socket): - ... - - def on_write(self, _socket): # -> None: - ... - - def on_error(self, _socket): # -> None: - ... - - def on_exception(self, exception, connection): # -> None: - ... - - def on_expected(self, exception, connection): # -> None: - ... - - def on_connect(self, connection): # -> None: - ... - - def on_upgrade(self, connection): # -> None: - ... - - def on_ssl(self, connection): # -> None: - ... - - def on_acquire(self, connection): # -> None: - ... - - def on_release(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - - +import netius as netius +import netius.base.async_old as async_old +import netius.base.asynchronous as asynchronous +import netius.base.common +import netius.base.compat as compat +import netius.base.config as config +import netius.base.errors as errors +import netius.base.legacy as legacy +import netius.base.log as log +import netius.base.observer as observer +import netius.base.request as request +import netius.base.tls as tls +import netius.base.util as util +import netius.middleware as middleware +import socket +from _typeshed import Incomplete +from netius.base.async_neo import AwaitWrapper as AwaitWrapper, CoroutineWrapper as CoroutineWrapper, Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.common import AbstractBase as AbstractBase, Base as Base, BaseThread as BaseThread, DiagBase as DiagBase, build_future as build_future, compat_loop as compat_loop, ensure as ensure, ensure_asyncio as ensure_asyncio, ensure_loop as ensure_loop, ensure_main as ensure_main, ensure_pool as ensure_pool, get_event_loop as get_event_loop, get_loop as get_loop, get_main as get_main, get_poll as get_poll, new_loop as new_loop, new_loop_asyncio as new_loop_asyncio, new_loop_main as new_loop_main, stop_loop as stop_loop +from netius.base.conn import BaseConnection as BaseConnection, Connection as Connection, DiagConnection as DiagConnection +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +is_diag: bool +POLL_TIMEOUT: float +NAME: str +VERSION: str +PLATFORM: str +IDENTIFIER_TINY: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +WSAEWOULDBLOCK: int +WSAECONNABORTED: int +WSAECONNRESET: int +SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE: int +POLL_ORDER: tuple +SILENT_ERRORS: tuple +VALID_ERRORS: tuple +SSL_SILENT_ERRORS: tuple +SSL_VALID_ERRORS: tuple +SSL_ERROR_NAMES: dict +SSL_VALID_REASONS: tuple +TCP_TYPE: int +UDP_TYPE: int +STATE_STOP: int +STATE_START: int +STATE_PAUSE: int +STATE_CONFIG: int +STATE_POLL: int +STATE_TICK: int +STATE_READ: int +STATE_WRITE: int +STATE_ERRROR: int +STATE_STRINGS: tuple +KEEPALIVE_TIMEOUT: int +KEEPALIVE_INTERVAL: int +KEEPALIVE_COUNT: int +ALLOW_BLOCK: bool +LOG_FORMAT: str +BASE_PATH: str +EXTRAS_PATH: str +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str +BUFFER_SIZE: None +GC_TIMEOUT: float + +class Client(netius.base.common.AbstractBase): + _client: ClassVar[None] = ... + def __init__(self, thread: bool = ..., daemon: bool = ..., *args, **kwargs) -> None: ... + @classmethod + def get_client_s(cls, *args, **kwargs): ... + @classmethod + def cleanup_s(cls): ... + def ensure_loop(self, env: bool = ...): ... + def join(self, timeout: Incomplete | None = ...): ... + +class DatagramClient(Client): + def __init__(self, *args, **kwargs) -> None: ... + def boot(self): ... + def cleanup(self): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception): ... + def on_expected(self, exception): ... + def on_data(self, connection, data): ... + def keep_gc(self, timeout: float = ..., run: bool = ...): ... + def gc(self, callbacks: bool = ...): ... + def add_request(self, request): ... + def remove_request(self, request): ... + def get_request(self, id): ... + def ensure_socket(self): ... + def ensure_write(self): ... + def remove_write(self): ... + def enable_read(self): ... + def disable_read(self): ... + def send(self, data, address, delay: bool = ..., ensure_loop: bool = ..., callback: Incomplete | None = ...): ... + def _send(self, _socket): ... + def _flush_write(self): ... + +class StreamClient(Client): + def __init__(self, *args, **kwargs) -> None: ... + def cleanup(self): ... + def ticks(self): ... + def info_dict(self, full: bool = ...): ... + def acquire_c(self, host, port, ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., validate: bool = ..., callback: Incomplete | None = ...): ... + def release_c(self, connection): ... + def remove_c(self, connection): ... + def validate_c(self, connection, close: bool = ...): ... + def connect(self, host, port, ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ..., ensure_loop: bool = ..., env: bool = ...): ... + def acquire(self, connection): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception, connection): ... + def on_expected(self, exception, connection): ... + def on_connect(self, connection): ... + def on_upgrade(self, connection): ... + def on_ssl(self, connection): ... + def on_acquire(self, connection): ... + def on_release(self, connection): ... + def on_data(self, connection, data): ... + def _connectf(self, connection): ... + def _connects(self): ... + def _connect(self, connection): ... + def _ssl_handshake(self, connection): ... diff --git a/src/typings/netius/base/common.pyi b/src/typings/netius/base/common.pyi index 772cba5e..bf04dd59 100644 --- a/src/typings/netius/base/common.pyi +++ b/src/typings/netius/base/common.pyi @@ -1,1074 +1,515 @@ -""" -This type stub file was generated by pyright. -""" - -import os -from .conn import * -from .poll import * -from .asynchronous import * - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -NAME = ... -VERSION = ... -PLATFORM = ... -IDENTIFIER_TINY = ... -IDENTIFIER_SHORT = ... -IDENTIFIER_LONG = ... -IDENTIFIER = ... -WSAEWOULDBLOCK = ... -WSAECONNABORTED = ... -WSAECONNRESET = ... -SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE = ... -POLL_ORDER = ... -SILENT_ERRORS = ... -VALID_ERRORS = ... -SSL_SILENT_ERRORS = ... -SSL_VALID_ERRORS = ... -SSL_ERROR_NAMES = ... -SSL_VALID_REASONS = ... -TCP_TYPE = ... -UDP_TYPE = ... -STATE_STOP = ... -STATE_START = ... -STATE_PAUSE = ... -STATE_CONFIG = ... -STATE_POLL = ... -STATE_TICK = ... -STATE_READ = ... -STATE_WRITE = ... -STATE_ERRROR = ... -STATE_STRINGS = ... -KEEPALIVE_TIMEOUT = ... -KEEPALIVE_INTERVAL = ... -KEEPALIVE_COUNT = ... -ALLOW_BLOCK = ... -LOG_FORMAT = ... -BASE_PATH = ... -EXTRAS_PATH = ... -SSL_KEY_PATH = ... -SSL_CER_PATH = ... -SSL_CA_PATH = ... -SSL_DH_PATH = ... -if not os.path.exists(SSL_CA_PATH): - SSL_CA_PATH = ... -if not os.path.exists(SSL_DH_PATH): - SSL_DH_PATH = ... -class AbstractBase(observer.Observable): - """ - Base network structure to be used by all the network - capable infra-structures (eg: servers and clients). - - Should handle all the non blocking event loop stuff, - so that the read and write operations are easy to handle. - - This is considered to be the main event loop code. - """ - _MAIN = ... - _MAIN_C = ... - def __init__(self, name=..., handlers=..., *args, **kwargs) -> None: - ... - - @classmethod - def test_poll(cls, preferred=...): # -> type[EpollPoll] | type[KqueuePoll] | type[PollPoll] | type[SelectPoll]: - ... - - @classmethod - def get_loop(cls, compat=..., asyncio=...): # -> AbstractEventLoop | None: - ... - - @classmethod - def get_main(cls, compat=...): # -> None: - ... - - @classmethod - def get_asyncio(cls): # -> AbstractEventLoop | None: - ... - - @classmethod - def set_main(cls, instance, set_compat=...): # -> None: - ... - - @classmethod - def unset_main(cls, set_compat=...): # -> None: - ... - - @classmethod - def patch_asyncio(cls): # -> None: - ... - - @classmethod - def waitpid(cls, pid): # -> None: - ... - - def destroy(self): # -> None: - ... - - def call_safe(self, callable, args=..., kwargs=...): # -> None: - """ - Calls the provided callable object using a safe strategy - meaning that in case there's an exception raised in the - middle of the callable execution it is going to be caught - and the details of it logged. - - :type callable: Function - :param callable: The callable function that is going to - be called using the safe approach. - :type args: List - :param args: The normal (non keyword) arguments to be sent - to the callable. - :type kwargs: Dictionary - :param kwargs: The set of keyword arguments that are going - to be sent to the callable. - :rtype: Object - :return: The result of the calling of the callable. - """ - ... - - def wait_event(self, callable, name=...): # -> None: - ... - - def unwait_event(self, callable, name=...): # -> None: - ... - - def delay(self, callable, timeout=..., immediately=..., verify=..., safe=...): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: - ... - - def delay_s(self, callable, timeout=..., immediately=..., verify=..., wakeup=...): # -> None: - """ - Safe version of the delay operation to be used to insert a callable - from a different thread (implies lock mechanisms). - - This method should only be used from different threads as there's - a huge performance impact created from using this method instead of - the local event loop one (delay()). - - :type callable: Function - :param callable: The callable that should be called on the next tick - according to the event loop rules. - :type timeout: int - :param timeout: The timeout for the callable to be called, this value - may not reflect an accurate value and depends greatly on the minimum - resolution value of the polling mechanism. - :type immediately: bool - :param immediately: If the callable should be called as soon as possible, - this is equivalent to setting timeout to -1. - :type verify: bool - :param verify: If the delayed sequences should be verified for possible - duplicated, avoiding possible issues. - :type wakeup: bool - :param wakeup: If the main event loop should be awaken so that the - callable is processed as soon as possible. - """ - ... - - def delay_m(self): # -> None: - """ - Runs the merge operation so that the delay next list (used by the delay - safe operation) is merged with the delayed and the delayed ordered - structures, making the events (effectively) ready to be executed by delays. - """ - ... - - def ensure(self, coroutine, args=..., kwargs=..., thread=..., future=..., immediately=...): # -> Future: - """ - Main method for the queuing/startup of an asynchronous coroutine - of async method, this should be called at the most higher level - of the execution of a chained coroutine sequence. - - It should ensure that the provided callable is wrapped into a - coroutine if that's the case, so that chained calling is not - violated by a non compliant element. - - The method should create a proper sequence/pipelined handling of - the various chained coroutine calls so that they are called one - after the other using futures for such handling. The final "simple" - abstraction should expose one "parent" future object as the interface. - - Multiple calls to this method should generate different async - contexts (with different parent future instances). - - :type coroutine: Coroutine/CoroutineObject/Callable - :param coroutine: The callable or coroutine that is going to be - "inserted" for an asynchronous execution, if a callable is provided - a coroutine is created wrapping the execution of such callable. - :type args: List - :param args: The list of "normal" arguments to be sent to the - coroutine as parts of its signature. - :type kwargs: Dictionary - :param kwargs: The keyword arguments to be sent to the coroutine. - :type thread: bool - :param thread: If the execution of the coroutine should be done - using a different thread (via thread pool), this may be interesting - if the coroutine includes blocking i/o calls. - :type future: Future - :param future: If provided ensures that non new future object is going - to be created for this async context to be created. - :type immediately: bool - :param immediately: If the callback should be scheduler in the event - pool to be executed immediately (as soon as possible). - :rtype: Future - :return: The future that has been created for this new async context - or the provided one if one was provided (this is considered to be the - parent future of the complete coroutine chain). - """ - ... - - def resolve_hostname(self, hostname, type=...): # -> Future: - """ - Resolve the provided hostname according to the provided type - resolution. The resolution process itself is asynchronous and - implementation independent, returning a future for the control - of the execution. - - :type hostname: String - :param hostname: The name of the host to be resolved. - :type type: String - :param type: The type of resolutions to be used (eg: a, aaaa, mx, etc.) - :rtype: Future - :return: The future to be used in the operation execution. - """ - ... - - def run_forever(self): # -> None: - ... - - def run_coroutine(self, coroutine, args=..., kwargs=..., thread=..., close=...): # -> None: - ... - - def wakeup(self, force=...): # -> None: - ... - - def sleep(self, timeout, future=...): # -> Future: - ... - - def wait(self, event, timeout=..., future=...): # -> Future: - ... - - def notify(self, event, data=...): # -> None: - ... - - def load(self, full=...): # -> None: - """ - Starts the loading process for the current engine, this should be - a singleton (run once) operation to be executed once per instance. - - Some of the responsibilities of the loading process should include: - logging loading, system signal binding and welcome message printing. - - The method should be protected against double execution issues, meaning - that should be safely called at any stage of the life cycle. - - :type full: bool - :param full: If the loading process should be performed completely, - meaning that even the long tasks should be executed. - """ - ... - - def unload(self, full=...): # -> None: - """ - Unloads the structures associated with the current engine, so that - the state of the current engine is reversed to the original one. - - Note that this is not related in any way with the event loop and only - static structures are affected. - - After a call to this method, the load method may be called again. - - :type full: bool - :param full: If the complete set of structure unloading operations - should be performed, this is related with the full flag of load. - """ - ... - - def boot(self): # -> None: - ... - - def welcome(self): # -> None: - ... - - def load_logging(self, level=..., format=..., unique=...): # -> None: - ... - - def unload_logging(self, safe=...): # -> None: - ... - - def extra_logging(self, level, formatter): # -> None: - """ - Loads the complete set of logging handlers defined in the - current logging value, should be a map of definitions. - - This handlers will latter be used for piping the various - logging messages to certain output channels. - - The creation of the handler is done using a special keyword - arguments strategy so that python and configuration files - are properly set as compatible. - - :type level: String/int - :param level: The base severity level for which the new handler - will be configured in case no extra level definition is set. - :type formatter: Formatter - :param formatter: The logging formatter instance to be set in - the handler for formatting messages to the output. - """ - ... - - def level_logging(self, level): # -> None: - """ - Changes the verbosity level of the current logging infra-structure - into the provided level of verbosity. - - The provided value may be an integer (internal value) or a string - representation of the requested verbosity level. - - :type level: int/String - :param level: The (logging) for which the logging infra-structure - must be changed, either an integer or string value. - """ - ... - - def load_diag(self, env=...): # -> None: - ... - - def load_middleware(self, suffix=...): # -> None: - ... - - def unload_middleware(self): # -> None: - ... - - def register_middleware(self, middleware_c, *args, **kwargs): - ... - - def call_middleware(self, name, *args, **kwargs): # -> None: - ... - - def bind_signals(self, signals=..., handler=...): # -> None: - ... - - def unbind_signals(self, signals=...): # -> None: - ... - - def bind_env(self): # -> None: - """ - Binds the current environment values to the current instance. - This method has a global behaviour on the current event loop. - """ - ... - - def forever(self, env=...): # -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def pause(self): # -> None: - ... - - def resume(self): # -> None: - ... - - def close(self): # -> None: - ... - - def finish(self): # -> None: - ... - - def main(self): # -> None: - ... - - def is_main(self): # -> bool: - ... - - def is_running(self): # -> bool: - ... - - def is_started(self): - ... - - def is_stopped(self): - ... - - def is_paused(self): - ... - - def is_edge(self): # -> bool: - ... - - def is_empty(self): # -> bool: - ... - - def is_sub_read(self, socket): # -> bool: - ... - - def is_sub_write(self, socket): # -> bool: - ... - - def is_sub_error(self, socket): # -> bool: - ... - - def sub_all(self, socket): # -> None: - ... - - def unsub_all(self, socket): # -> None: - ... - - def sub_read(self, socket): # -> None: - ... - - def sub_write(self, socket): # -> None: - ... - - def sub_error(self, socket): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - def cleanup(self, destroy=...): # -> None: - ... - - def loop(self): # -> None: - ... - - def block(self): # -> None: - """ - Runs the sub-blocking operation, by "forking" the current loop - execution into an inner one for a new context. - - The execution of this method is not recommended and should be - used with extreme care to avoid unwanted behaviour. - """ - ... - - def fork(self, timeout=...): # -> bool: - ... - - def finalize(self): # -> None: - ... - - def ticks(self): # -> None: - ... - - def reads(self, reads, state=...): # -> None: - ... - - def writes(self, writes, state=...): # -> None: - ... - - def errors(self, errors, state=...): # -> None: - ... - - def datagram(self, family=..., type=..., local_host=..., local_port=..., remote_host=..., remote_port=..., callback=...): # -> BaseConnection: - """ - Builds a datagram based connection for the provided family and - type of socket, receiving an optional callback parameter to - be called once the "connection" object is ready to be used. - - :type family: int - :param family: The kind of socket family that is going to be - used in the creation of the datagram "connection". - :type type: int - :param type: Socket type (datagram, stream, etc.) to be used - for the creation of the datagram connection, in principle should - not be changed from the default value. - :type local_host: String - :param local_host: The locale host to be used in a possible bind - operation in the datagram so that the the socket listens to new - incoming datagrams on that host. - :type local_port: String - :param local_host: The local port to be used in a possible bind - operation in the datagram so that the the socket listens to new - incoming datagrams on that port. - :type remote_host: String - :param remote_host: The remote host to be used in a possible connect - (bind) operation in the datagram so that the default send operation - does not require explicit host setting. - :type remote_port: String - :param remote_port: The remote port to be used in a possible connect - (bind) operation in the datagram so that the default send operation - does not require explicit port setting. - :type callback: Function - :param callback: Callback function to be called once the datagram - connection is considered to be ready. - :rtype: Connection - :return: The datagram based connection that encapsulates the datagram - based connection logic. - """ - ... - - def connect(self, host, port, receive_buffer=..., send_buffer=..., ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=..., callback=..., env=...): - ... - - def acquire(self, connection): # -> None: - ... - - def pregister(self, pool): # -> None: - ... - - def punregister(self, pool): # -> None: - ... - - def pcallback(self, event, socket, pool): # -> None: - ... - - def nensure(self): # -> None: - ... - - def nstart(self): # -> None: - ... - - def nstop(self): # -> None: - ... - - def tensure(self): # -> None: - ... - - def tstart(self): # -> None: - ... - - def tstop(self): # -> None: - ... - - def texecute(self, callable, args=..., kwargs=..., callback=...): # -> None: - ... - - def files(self): # -> None: - ... - - def fopen(self, *args, **kwargs): # -> None: - ... - - def fclose(self, *args, **kwargs): # -> None: - ... - - def fread(self, *args, **kwargs): # -> None: - ... - - def fwrite(self, *args, **kwargs): # -> None: - ... - - def fensure(self): # -> None: - ... - - def fstart(self): # -> None: - ... - - def fstop(self): # -> None: - ... - - def on_connection_c(self, connection): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_stream_c(self, stream): # -> None: - ... - - def on_stream_d(self, stream): # -> None: - ... - - def on_fork(self): # -> None: - ... - - def on_join(self): # -> None: - ... - - def on_child(self, pipe=...): # -> None: - ... - - def on_command(self, command): # -> None: - ... - - def on_diag(self): # -> None: - ... - - def on_start(self): # -> None: - ... - - def on_stop(self): # -> None: - ... - - def on_pause(self): # -> None: - ... - - def on_resume(self): # -> None: - ... - - def on_read(self, _socket): - ... - - def on_write(self, _socket): # -> None: - ... - - def on_error(self, _socket): # -> None: - ... - - def on_exception(self, exception, connection): # -> None: - ... - - def on_expected(self, exception, connection): # -> None: - ... - - def on_connect(self, connection): # -> None: - ... - - def on_upgrade(self, connection): # -> None: - ... - - def on_client_ssl(self, connection): # -> None: - ... - - def on_acquire(self, connection): # -> None: - ... - - def on_acquire_base(self, connection): # -> None: - ... - - def on_release(self, connection): # -> None: - ... - - def on_release_base(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_data_base(self, connection, data): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def info_string(self, full=..., safe=...): # -> str: - ... - - def connections_dict(self, full=...): # -> list[Any]: - ... - - def connection_dict(self, id, full=...): # -> None: - ... - - def build_connection(self, socket, address=..., datagram=..., ssl=...): # -> BaseConnection: - """ - Creates a new connection for the provided socket - object and string based address, the returned - value should be a workable object. - - :type socket: Socket - :param socket: The socket object to be encapsulated - by the object to be created (connection). - :type address: String - :param address: The address as a string to be used to - describe the connection object to be created. - :type datagram: bool - :param datagram: If the connection to be created should - be datagram based or not. - :type ssl: bool - :param ssl: If the connection to be created is meant to - be secured using the SSL framework for encryption. - :rtype: Connection - :return: The connection object that encapsulates the - provided socket and address values. - """ - ... - - def base_connection(self, *args, **kwargs): # -> BaseConnection: - ... - - def new_connection(self, connection): # -> None: - ... - - def del_connection(self, connection): # -> None: - ... - - def add_callback(self, socket, callback): # -> None: - ... - - def remove_callback(self, socket, callback): # -> None: - ... - - def load_config(self, path=..., **kwargs): # -> None: - ... - - def apply_config(self, path, kwargs): - ... - - def exec_safe(self, connection, callable, *args, **kwargs): # -> Literal[False]: - ... - - def is_devel(self): # -> bool: - """ - Verifies if the current running environment is meant to be used - for development purposes as opposed to a production environment. - - The method should always be used in situations where some critical - and internal information is meant to be displayed in a development - environment but hidden in a production one. - - This method should be used at runtime as opposed to the private - configuration based one. - - :rtype: bool - :return: If the current environment is development oriented or - if it's considered to be a production one (invalid result). - """ - ... - - def is_debug(self): # -> bool: - ... - - def is_info(self): # -> bool: - ... - - def is_warning(self): # -> bool: - ... - - def is_error(self): # -> bool: - ... - - def is_critical(self): # -> bool: - ... - - def debug(self, object): # -> None: - ... - - def info(self, object): # -> None: - ... - - def warning(self, object): # -> None: - ... - - def error(self, object): # -> None: - ... - - def critical(self, object): # -> None: - ... - - def log_stack(self, method=..., info=...): # -> None: - ... - - def log_info(self, method=...): # -> None: - ... - - def log(self, *args, **kwargs): # -> None: - ... - - def log_python_3(self, object, level=...): # -> None: - ... - - def log_python_2(self, object, level=...): # -> None: - ... - - def build_poll(self): # -> EpollPoll | KqueuePoll | PollPoll | SelectPoll: - ... - - def build_future(self, compat=..., asyncio=...): # -> Future: - """ - Creates a future object that is bound to the current event - loop context, this allows for latter access to the owning loop. - - :type compat: bool - :param compat: If the compatibility mode retrieval should be used - meaning that a compatible loop instance is retrieved instead. - :type asyncio: bool - :param asyncio: If the asyncio loop retrieval strategy should be - used or if instead the netius native one should be used. - :rtype: Future - :return: The generated future that should be bound to the - current context. - """ - ... - - def get_id(self, unique=...): # -> str: - ... - - def get_poll(self): # -> EpollPoll | KqueuePoll | PollPoll | SelectPoll: - ... - - def get_poll_name(self): # -> str: - ... - - def get_state(self): - ... - - def set_state(self, state): # -> None: - ... - - def get_state_s(self, lower=...): - """ - Retrieves a string describing the current state - of the system, this string should be as descriptive - as possible. - - An optional parameter controls if the string should - be lower cased or not. - - :type lower: bool - :param lower: If the returned string should be converted - into a lower cased version. - :rtype: String - :return: A string describing the current sate of the loop - system, should be as descriptive as possible. - """ - ... - - def get_env(self, name, default=..., cast=..., expand=...): # -> str | None: - """ - Retrieves the value of the environment variable with the - requested name, defaulting to the provided value in case - it's not possible to find such variable. - - An optional cast type may be provided in order to cast the - value of the environment variable in to the target type. - - An optional expand flag may be set so that the variable gets - expanded as a file system file, for this the newline values - should be escaped as explicit '\n' string sequences (two chars). - - Current implementation forwards the request to the current - configuration registry so that other data providers may - also be used in search for configuration. - - :type name: String - :param name: The name of the environment variable that is - meant to be retrieved from the current environment - :type default: Object - :param default: The default value to be returned in case - no value is found for the provided name. - :type cast: Type - :param cast: The cast type to be used to cast the value - of the requested environment variable. - :type expand: bool - :param expand: If the variable should be expanded as a file - object and stored in a temporary storage, for this situation - the resulting object should be a string with the file path. - :rtype: Object - :return: The value of the requested environment variable - properly casted into the target value. - """ - ... - - def expand(self, value, encoding=..., force=...): # -> str: - """ - Expands the provided string/bytes value into a file in the - current file system so that it may be correctly used by interfaces - that require certain values to be file system based. - - The generated file is going to be removed on the cleanup operation - so that no temporary file leaking occurs (garbage collection). - - In case the force value is provided the the file is created even - for situations where the provided value is invalid/unset. - - :type value: String - :param value: The string/bytes based value that is going to be - expanded into a proper file system based (temporary) file. - :type encoding: String - :param encoding: The encoding that is going to be used to convert - the value into a bytes based one in case the provided value is not - bytes compliant (and must be converted). - :type force: bool - :param force: If the expansion operation should be performed even - for situations where the value is considered invalid/unset. - :rtype: String - :return: The path to the temporary file that has just been generated - for the expansion of the provided value. - """ - ... - - def get_protocols(self): # -> None: - """ - Retrieves the complete set of protocols (as ALPN strings) that are - going to be handled by the current protocol infra-structure. - - :rtype: List - :return: The list containing the complete set of protocols handled - by the current infra-structure. - :see: https://tools.ietf.org/html/rfc7301 - """ - ... - - def get_adapter(self, name=..., *args, **kwargs): # -> Any: - """ - Retrieves an instance of a storage adapter described - by the provided name, note that the dynamic (extra) - arguments are going to be used in the construction of - the adapter instance. - - :type name: String - :param name: The name of the adapter to be retrieved - this should be equivalent to the adapter class name. - :rtype: Adapter - :return: An instance (properly configured) of the - requested adapter (defined by the name argument). - """ - ... - - def get_auth(self, name=..., *args, **kwargs): # -> Any: - """ - Gathers the proper authentication handler that is being - requested with the provided name. The retrieved auth - is a static class that should be used from its interface - based on class based methods. - - The state of theses authentication (handlers) is based - on the "global" state of the environment (no instances). - - :type name: String - :param name: The name of the authentication (handler) - class that should be retrieved. - :rtype: Auth - :return: An authentication based class that may be used - for the interaction of authentication methods. - """ - ... - - def get_connection(self, socket): - """ - "Resolves" the connection associated with the provided socket - returning the structured connection object for it. - - In case no connection exists the method raises an exception - invalidating the current logic stack. - - :type socket: Socket - :param socket: The socket for which the connection is going to - be returned. - :rtype: Connection - :return: The connection object associated with the provided - socket reference. - """ - ... - - @property - def is_parent(self): # -> bool: - ... - - @property - def is_child(self): # -> bool: - ... - - @property - def is_forked(self): # -> bool: - ... - - - -class DiagBase(AbstractBase): - def __init__(self, *args, **kwargs) -> None: - ... - - def reads(self, *args, **kwargs): # -> None: - ... - - def writes(self, *args, **kwargs): # -> None: - ... - - def errors(self, *args, **kwargs): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - - -class BaseThread(threading.Thread): - """ - The top level thread class that is meant to encapsulate - a running base object and run it in a new context. - - This base thread may be used to run a network loop allowing - a main thread to continue with execution logic. - """ - def __init__(self, owner=..., daemon=..., *args, **kwargs) -> None: - ... - - def run(self): # -> None: - ... - - - -def new_loop_main(factory=..., _compat=..., **kwargs): # -> CompatLoop | AbstractBase | DiagBase: - ... - -def new_loop_asyncio(**kwargs): # -> AbstractEventLoop | None: - ... - -def new_loop(factory=..., _compat=..., asyncio=..., **kwargs): # -> AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None: - ... - -def ensure_main(factory=..., **kwargs): # -> None: - ... - -def ensure_asyncio(**kwargs): # -> AbstractEventLoop | None: - ... - -def ensure_loop(factory=..., asyncio=..., **kwargs): # -> None: - ... - -def get_main(factory=..., ensure=..., **kwargs): # -> None: - ... - -def get_loop(factory=..., ensure=..., _compat=..., asyncio=..., **kwargs): # -> AbstractEventLoop | None: - ... - -def get_event_loop(*args, **kwargs): # -> AbstractEventLoop | None: - """ - Compatibility alias function with the ``get_loop()`` function - to ensure proper compatibility with asyncio. - - :rtype: EventLoop - :return: The event loop for the current context of execution - (if any) otherwise None (invalid). - """ - ... - -def stop_loop(compat=..., asyncio=...): # -> None: - ... - -def compat_loop(loop): - """ - Retrieves the asyncio API compatible version of the provided - loop in case such version exists in the current object, otherwise - returns the proper object (assumed to be asyncio API compatible). - - :type loop: EventLoop - :param loop: The base event loop object from which an asyncio - API compatible object is meant to be retrieved. - :rtype: EventLoop - :return: The asyncio API compatible event loop object. - """ - ... - -def get_poll(): # -> None: - ... - -def build_future(compat=..., asyncio=...): # -> None: - ... - -def ensure(coroutine, args=..., kwargs=..., thread=...): - ... - -def ensure_pool(coroutine, args=..., kwargs=...): - ... - -is_diag = ... -if is_diag: - Base = ... -else: - Base = ... +import netius as netius +import netius.base.async_old as async_old +import netius.base.asynchronous as asynchronous +import netius.base.compat as compat +import netius.base.config as config +import netius.base.errors as errors +import netius.base.legacy as legacy +import netius.base.log as log +import netius.base.observer +import netius.base.observer as observer +import netius.base.tls as tls +import netius.base.util as util +import netius.middleware as middleware +import socket +import ssl +import threading +from _typeshed import Incomplete +from netius.base.async_neo import AwaitWrapper as AwaitWrapper, CoroutineWrapper as CoroutineWrapper, Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.conn import BaseConnection as BaseConnection, Connection as Connection, DiagConnection as DiagConnection +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +is_diag: bool +POLL_TIMEOUT: float +NAME: str +VERSION: str +PLATFORM: str +IDENTIFIER_TINY: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +WSAEWOULDBLOCK: int +WSAECONNABORTED: int +WSAECONNRESET: int +SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE: int +POLL_ORDER: tuple +SILENT_ERRORS: tuple +VALID_ERRORS: tuple +SSL_SILENT_ERRORS: tuple +SSL_VALID_ERRORS: tuple +SSL_ERROR_NAMES: dict +SSL_VALID_REASONS: tuple +TCP_TYPE: int +UDP_TYPE: int +STATE_STOP: int +STATE_START: int +STATE_PAUSE: int +STATE_CONFIG: int +STATE_POLL: int +STATE_TICK: int +STATE_READ: int +STATE_WRITE: int +STATE_ERRROR: int +STATE_STRINGS: tuple +KEEPALIVE_TIMEOUT: int +KEEPALIVE_INTERVAL: int +KEEPALIVE_COUNT: int +ALLOW_BLOCK: bool +LOG_FORMAT: str +BASE_PATH: str +EXTRAS_PATH: str +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str + +class AbstractBase(netius.base.observer.Observable): + _MAIN: ClassVar[None] = ... + _MAIN_C: ClassVar[None] = ... + def __init__(self, name: Incomplete | None = ..., handlers: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def test_poll(cls, preferred: Incomplete | None = ...): ... + @classmethod + def get_loop(cls, compat: bool = ..., asyncio: bool = ...): ... + @classmethod + def get_main(cls, compat: bool = ...): ... + @classmethod + def get_asyncio(cls): ... + @classmethod + def set_main(cls, instance, set_compat: bool = ...): ... + @classmethod + def unset_main(cls, set_compat: bool = ...): ... + @classmethod + def patch_asyncio(cls): ... + @classmethod + def waitpid(cls, pid): ... + def destroy(self): ... + def call_safe(self, callable, args: list = ..., kwargs: dict = ...): ... + def wait_event(self, callable, name: Incomplete | None = ...): ... + def unwait_event(self, callable, name: Incomplete | None = ...): ... + def delay(self, callable, timeout: Incomplete | None = ..., immediately: bool = ..., verify: bool = ..., safe: bool = ...): ... + def delay_s(self, callable, timeout: Incomplete | None = ..., immediately: bool = ..., verify: bool = ..., wakeup: bool = ...): ... + def delay_m(self): ... + def ensure(self, coroutine, args: list = ..., kwargs: dict = ..., thread: Incomplete | None = ..., future: Incomplete | None = ..., immediately: bool = ...): ... + def resolve_hostname(self, hostname, type: str = ...): ... + def run_forever(self): ... + def run_coroutine(self, coroutine, args: list = ..., kwargs: dict = ..., thread: Incomplete | None = ..., close: Incomplete | None = ...): ... + def wakeup(self, force: bool = ...): ... + def sleep(self, timeout, future: Incomplete | None = ...): ... + def wait(self, event, timeout: Incomplete | None = ..., future: Incomplete | None = ...): ... + def notify(self, event, data: Incomplete | None = ...): ... + def load(self, full: bool = ...): ... + def unload(self, full: bool = ...): ... + def boot(self): ... + def welcome(self): ... + def load_logging(self, level: int = ..., format: str = ..., unique: bool = ...): ... + def unload_logging(self, safe: bool = ...): ... + def extra_logging(self, level, formatter): ... + def level_logging(self, level): ... + def load_diag(self, env: bool = ...): ... + def load_middleware(self, suffix: str = ...): ... + def unload_middleware(self): ... + def register_middleware(self, middleware_c, *args, **kwargs): ... + def call_middleware(self, name, *args, **kwargs): ... + def bind_signals(self, signals: tuple = ..., handler: Incomplete | None = ...): ... + def unbind_signals(self, signals: tuple = ...): ... + def bind_env(self): ... + def forever(self, env: bool = ...): ... + def start(self): ... + def stop(self): ... + def pause(self): ... + def resume(self): ... + def close(self): ... + def finish(self): ... + def main(self): ... + def is_main(self): ... + def is_running(self): ... + def is_started(self): ... + def is_stopped(self): ... + def is_paused(self): ... + def is_edge(self): ... + def is_empty(self): ... + def is_sub_read(self, socket): ... + def is_sub_write(self, socket): ... + def is_sub_error(self, socket): ... + def sub_all(self, socket): ... + def unsub_all(self, socket): ... + def sub_read(self, socket): ... + def sub_write(self, socket): ... + def sub_error(self, socket): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + def cleanup(self, destroy: bool = ...): ... + def loop(self): ... + def block(self): ... + def fork(self, timeout: int = ...): ... + def finalize(self): ... + def ticks(self): ... + def reads(self, reads, state: bool = ...): ... + def writes(self, writes, state: bool = ...): ... + def errors(self, errors, state: bool = ...): ... + def datagram(self, family: socket.AddressFamily = ..., type: socket.SocketKind = ..., local_host: Incomplete | None = ..., local_port: Incomplete | None = ..., remote_host: Incomplete | None = ..., remote_port: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def connect(self, host, port, receive_buffer: Incomplete | None = ..., send_buffer: Incomplete | None = ..., ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ..., callback: Incomplete | None = ..., env: bool = ...): ... + def acquire(self, connection): ... + def pregister(self, pool): ... + def punregister(self, pool): ... + def pcallback(self, event, socket, pool): ... + def nensure(self): ... + def nstart(self): ... + def nstop(self): ... + def tensure(self): ... + def tstart(self): ... + def tstop(self): ... + def texecute(self, callable, args: list = ..., kwargs: dict = ..., callback: Incomplete | None = ...): ... + def files(self): ... + def fopen(self, *args, **kwargs): ... + def fclose(self, *args, **kwargs): ... + def fread(self, *args, **kwargs): ... + def fwrite(self, *args, **kwargs): ... + def fensure(self): ... + def fstart(self): ... + def fstop(self): ... + def on_connection_c(self, connection): ... + def on_connection_d(self, connection): ... + def on_stream_c(self, stream): ... + def on_stream_d(self, stream): ... + def on_fork(self): ... + def on_join(self): ... + def on_child(self, pipe: Incomplete | None = ...): ... + def on_command(self, command): ... + def on_diag(self): ... + def on_start(self): ... + def on_stop(self): ... + def on_pause(self): ... + def on_resume(self): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception, connection): ... + def on_expected(self, exception, connection): ... + def on_connect(self, connection): ... + def on_upgrade(self, connection): ... + def on_client_ssl(self, connection): ... + def on_acquire(self, connection): ... + def on_acquire_base(self, connection): ... + def on_release(self, connection): ... + def on_release_base(self, connection): ... + def on_data(self, connection, data): ... + def on_data_base(self, connection, data): ... + def info_dict(self, full: bool = ...): ... + def info_string(self, full: bool = ..., safe: bool = ...): ... + def connections_dict(self, full: bool = ...): ... + def connection_dict(self, id, full: bool = ...): ... + def build_connection(self, socket, address: Incomplete | None = ..., datagram: bool = ..., ssl: bool = ...): ... + def base_connection(self, *args, **kwargs): ... + def new_connection(self, connection): ... + def del_connection(self, connection): ... + def add_callback(self, socket, callback): ... + def remove_callback(self, socket, callback): ... + def load_config(self, path: str = ..., **kwargs): ... + def apply_config(self, path, kwargs): ... + def exec_safe(self, connection, callable, *args, **kwargs): ... + def is_devel(self): ... + def is_debug(self): ... + def is_info(self): ... + def is_warning(self): ... + def is_error(self): ... + def is_critical(self): ... + def debug(self, object): ... + def info(self, object): ... + def warning(self, object): ... + def error(self, object): ... + def critical(self, object): ... + def log_stack(self, method: Incomplete | None = ..., info: bool = ...): ... + def log_info(self, method: Incomplete | None = ...): ... + def log(self, *args, **kwargs): ... + def log_python_3(self, object, level: int = ...): ... + def log_python_2(self, object, level: int = ...): ... + def build_poll(self): ... + def build_future(self, compat: bool = ..., asyncio: bool = ...): ... + def get_id(self, unique: bool = ...): ... + def get_poll(self): ... + def get_poll_name(self): ... + def get_state(self): ... + def set_state(self, state): ... + def get_state_s(self, lower: bool = ...): ... + def get_env(self, name, default: Incomplete | None = ..., cast: Incomplete | None = ..., expand: bool = ...): ... + def expand(self, value, encoding: str = ..., force: bool = ...): ... + def get_protocols(self): ... + def get_adapter(self, name: str = ..., *args, **kwargs): ... + def get_auth(self, name: str = ..., *args, **kwargs): ... + def get_connection(self, socket): ... + def _pending(self, connection): ... + def _notifies(self): ... + def _delays(self): ... + def _generate(self, hashed: bool = ...): ... + def _connect(self, connection): ... + def _connectf(self, connection): ... + def _socket_keepalive(self, _socket, timeout: Incomplete | None = ..., interval: Incomplete | None = ..., count: Incomplete | None = ...): ... + def _ssl_init(self, strict: bool = ..., env: bool = ...): ... + def _ssl_destroy(self): ... + def _ssl_callback(self, socket, hostname, context): ... + def _ssl_ctx(self, values, context: Incomplete | None = ..., secure: int = ..., context_options: list = ...): ... + def _ssl_ctx_base(self, context, secure: int = ..., context_options: list = ...): ... + def _ssl_ctx_protocols(self, context): ... + def _ssl_ctx_alpn(self, context): ... + def _ssl_ctx_npn(self, context): ... + def _ssl_certs(self, context, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., verify_mode: ssl.VerifyMode = ..., check_hostname: bool = ...): ... + def _ssl_upgrade(self, _socket, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., server: bool = ..., ssl_verify: bool = ..., server_hostname: Incomplete | None = ...): ... + def _ssl_wrap(self, _socket, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., server: bool = ..., ssl_verify: bool = ..., server_hostname: Incomplete | None = ...): ... + def _ssl_handshake(self, connection): ... + def _ssl_client_handshake(self, connection): ... + def _expand_destroy(self): ... + def _level(self, level): ... + def _format_delta(self, time_delta, count: int = ...): ... + def _wait_forever(self, sleep: int = ...): ... + @property + def is_parent(self): ... + @property + def is_child(self): ... + @property + def is_forked(self): ... + +class DiagBase(AbstractBase): + def __init__(self, *args, **kwargs) -> None: ... + def reads(self, *args, **kwargs): ... + def writes(self, *args, **kwargs): ... + def errors(self, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + +class BaseThread(threading.Thread): + def __init__(self, owner: Incomplete | None = ..., daemon: bool = ..., *args, **kwargs) -> None: ... + def run(self): ... +def new_loop_main(factory: Incomplete | None = ..., _compat: Incomplete | None = ..., **kwargs): ... +def new_loop_asyncio(**kwargs): ... +def new_loop(factory: Incomplete | None = ..., _compat: Incomplete | None = ..., asyncio: Incomplete | None = ..., **kwargs): ... +def ensure_main(factory: Incomplete | None = ..., **kwargs): ... +def ensure_asyncio(**kwargs): ... +def ensure_loop(factory: Incomplete | None = ..., asyncio: Incomplete | None = ..., **kwargs): ... +def get_main(factory: Incomplete | None = ..., ensure: bool = ..., **kwargs): ... +def get_loop(factory: Incomplete | None = ..., ensure: bool = ..., _compat: Incomplete | None = ..., asyncio: Incomplete | None = ..., **kwargs): ... +def get_event_loop(*args, **kwargs): ... +def stop_loop(compat: bool = ..., asyncio: bool = ...): ... +def compat_loop(loop): ... +def get_poll(): ... +def build_future(compat: bool = ..., asyncio: bool = ...): ... +def ensure(coroutine, args: list = ..., kwargs: dict = ..., thread: Incomplete | None = ...): ... +def ensure_pool(coroutine, args: list = ..., kwargs: dict = ...): ... + +class Base(netius.base.observer.Observable): + _MAIN: ClassVar[None] = ... + _MAIN_C: ClassVar[None] = ... + def __init__(self, name: Incomplete | None = ..., handlers: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def test_poll(cls, preferred: Incomplete | None = ...): ... + @classmethod + def get_loop(cls, compat: bool = ..., asyncio: bool = ...): ... + @classmethod + def get_main(cls, compat: bool = ...): ... + @classmethod + def get_asyncio(cls): ... + @classmethod + def set_main(cls, instance, set_compat: bool = ...): ... + @classmethod + def unset_main(cls, set_compat: bool = ...): ... + @classmethod + def patch_asyncio(cls): ... + @classmethod + def waitpid(cls, pid): ... + def destroy(self): ... + def call_safe(self, callable, args: list = ..., kwargs: dict = ...): ... + def wait_event(self, callable, name: Incomplete | None = ...): ... + def unwait_event(self, callable, name: Incomplete | None = ...): ... + def delay(self, callable, timeout: Incomplete | None = ..., immediately: bool = ..., verify: bool = ..., safe: bool = ...): ... + def delay_s(self, callable, timeout: Incomplete | None = ..., immediately: bool = ..., verify: bool = ..., wakeup: bool = ...): ... + def delay_m(self): ... + def ensure(self, coroutine, args: list = ..., kwargs: dict = ..., thread: Incomplete | None = ..., future: Incomplete | None = ..., immediately: bool = ...): ... + def resolve_hostname(self, hostname, type: str = ...): ... + def run_forever(self): ... + def run_coroutine(self, coroutine, args: list = ..., kwargs: dict = ..., thread: Incomplete | None = ..., close: Incomplete | None = ...): ... + def wakeup(self, force: bool = ...): ... + def sleep(self, timeout, future: Incomplete | None = ...): ... + def wait(self, event, timeout: Incomplete | None = ..., future: Incomplete | None = ...): ... + def notify(self, event, data: Incomplete | None = ...): ... + def load(self, full: bool = ...): ... + def unload(self, full: bool = ...): ... + def boot(self): ... + def welcome(self): ... + def load_logging(self, level: int = ..., format: str = ..., unique: bool = ...): ... + def unload_logging(self, safe: bool = ...): ... + def extra_logging(self, level, formatter): ... + def level_logging(self, level): ... + def load_diag(self, env: bool = ...): ... + def load_middleware(self, suffix: str = ...): ... + def unload_middleware(self): ... + def register_middleware(self, middleware_c, *args, **kwargs): ... + def call_middleware(self, name, *args, **kwargs): ... + def bind_signals(self, signals: tuple = ..., handler: Incomplete | None = ...): ... + def unbind_signals(self, signals: tuple = ...): ... + def bind_env(self): ... + def forever(self, env: bool = ...): ... + def start(self): ... + def stop(self): ... + def pause(self): ... + def resume(self): ... + def close(self): ... + def finish(self): ... + def main(self): ... + def is_main(self): ... + def is_running(self): ... + def is_started(self): ... + def is_stopped(self): ... + def is_paused(self): ... + def is_edge(self): ... + def is_empty(self): ... + def is_sub_read(self, socket): ... + def is_sub_write(self, socket): ... + def is_sub_error(self, socket): ... + def sub_all(self, socket): ... + def unsub_all(self, socket): ... + def sub_read(self, socket): ... + def sub_write(self, socket): ... + def sub_error(self, socket): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + def cleanup(self, destroy: bool = ...): ... + def loop(self): ... + def block(self): ... + def fork(self, timeout: int = ...): ... + def finalize(self): ... + def ticks(self): ... + def reads(self, reads, state: bool = ...): ... + def writes(self, writes, state: bool = ...): ... + def errors(self, errors, state: bool = ...): ... + def datagram(self, family: socket.AddressFamily = ..., type: socket.SocketKind = ..., local_host: Incomplete | None = ..., local_port: Incomplete | None = ..., remote_host: Incomplete | None = ..., remote_port: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def connect(self, host, port, receive_buffer: Incomplete | None = ..., send_buffer: Incomplete | None = ..., ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ..., callback: Incomplete | None = ..., env: bool = ...): ... + def acquire(self, connection): ... + def pregister(self, pool): ... + def punregister(self, pool): ... + def pcallback(self, event, socket, pool): ... + def nensure(self): ... + def nstart(self): ... + def nstop(self): ... + def tensure(self): ... + def tstart(self): ... + def tstop(self): ... + def texecute(self, callable, args: list = ..., kwargs: dict = ..., callback: Incomplete | None = ...): ... + def files(self): ... + def fopen(self, *args, **kwargs): ... + def fclose(self, *args, **kwargs): ... + def fread(self, *args, **kwargs): ... + def fwrite(self, *args, **kwargs): ... + def fensure(self): ... + def fstart(self): ... + def fstop(self): ... + def on_connection_c(self, connection): ... + def on_connection_d(self, connection): ... + def on_stream_c(self, stream): ... + def on_stream_d(self, stream): ... + def on_fork(self): ... + def on_join(self): ... + def on_child(self, pipe: Incomplete | None = ...): ... + def on_command(self, command): ... + def on_diag(self): ... + def on_start(self): ... + def on_stop(self): ... + def on_pause(self): ... + def on_resume(self): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception, connection): ... + def on_expected(self, exception, connection): ... + def on_connect(self, connection): ... + def on_upgrade(self, connection): ... + def on_client_ssl(self, connection): ... + def on_acquire(self, connection): ... + def on_acquire_base(self, connection): ... + def on_release(self, connection): ... + def on_release_base(self, connection): ... + def on_data(self, connection, data): ... + def on_data_base(self, connection, data): ... + def info_dict(self, full: bool = ...): ... + def info_string(self, full: bool = ..., safe: bool = ...): ... + def connections_dict(self, full: bool = ...): ... + def connection_dict(self, id, full: bool = ...): ... + def build_connection(self, socket, address: Incomplete | None = ..., datagram: bool = ..., ssl: bool = ...): ... + def base_connection(self, *args, **kwargs): ... + def new_connection(self, connection): ... + def del_connection(self, connection): ... + def add_callback(self, socket, callback): ... + def remove_callback(self, socket, callback): ... + def load_config(self, path: str = ..., **kwargs): ... + def apply_config(self, path, kwargs): ... + def exec_safe(self, connection, callable, *args, **kwargs): ... + def is_devel(self): ... + def is_debug(self): ... + def is_info(self): ... + def is_warning(self): ... + def is_error(self): ... + def is_critical(self): ... + def debug(self, object): ... + def info(self, object): ... + def warning(self, object): ... + def error(self, object): ... + def critical(self, object): ... + def log_stack(self, method: Incomplete | None = ..., info: bool = ...): ... + def log_info(self, method: Incomplete | None = ...): ... + def log(self, *args, **kwargs): ... + def log_python_3(self, object, level: int = ...): ... + def log_python_2(self, object, level: int = ...): ... + def build_poll(self): ... + def build_future(self, compat: bool = ..., asyncio: bool = ...): ... + def get_id(self, unique: bool = ...): ... + def get_poll(self): ... + def get_poll_name(self): ... + def get_state(self): ... + def set_state(self, state): ... + def get_state_s(self, lower: bool = ...): ... + def get_env(self, name, default: Incomplete | None = ..., cast: Incomplete | None = ..., expand: bool = ...): ... + def expand(self, value, encoding: str = ..., force: bool = ...): ... + def get_protocols(self): ... + def get_adapter(self, name: str = ..., *args, **kwargs): ... + def get_auth(self, name: str = ..., *args, **kwargs): ... + def get_connection(self, socket): ... + def _pending(self, connection): ... + def _notifies(self): ... + def _delays(self): ... + def _generate(self, hashed: bool = ...): ... + def _connect(self, connection): ... + def _connectf(self, connection): ... + def _socket_keepalive(self, _socket, timeout: Incomplete | None = ..., interval: Incomplete | None = ..., count: Incomplete | None = ...): ... + def _ssl_init(self, strict: bool = ..., env: bool = ...): ... + def _ssl_destroy(self): ... + def _ssl_callback(self, socket, hostname, context): ... + def _ssl_ctx(self, values, context: Incomplete | None = ..., secure: int = ..., context_options: list = ...): ... + def _ssl_ctx_base(self, context, secure: int = ..., context_options: list = ...): ... + def _ssl_ctx_protocols(self, context): ... + def _ssl_ctx_alpn(self, context): ... + def _ssl_ctx_npn(self, context): ... + def _ssl_certs(self, context, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., verify_mode: ssl.VerifyMode = ..., check_hostname: bool = ...): ... + def _ssl_upgrade(self, _socket, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., server: bool = ..., ssl_verify: bool = ..., server_hostname: Incomplete | None = ...): ... + def _ssl_wrap(self, _socket, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., server: bool = ..., ssl_verify: bool = ..., server_hostname: Incomplete | None = ...): ... + def _ssl_handshake(self, connection): ... + def _ssl_client_handshake(self, connection): ... + def _expand_destroy(self): ... + def _level(self, level): ... + def _format_delta(self, time_delta, count: int = ...): ... + def _wait_forever(self, sleep: int = ...): ... + @property + def is_parent(self): ... + @property + def is_child(self): ... + @property + def is_forked(self): ... diff --git a/src/typings/netius/base/compat.pyi b/src/typings/netius/base/compat.pyi index d56c48a6..9e91c905 100644 --- a/src/typings/netius/base/compat.pyi +++ b/src/typings/netius/base/compat.pyi @@ -1,162 +1,64 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -asyncio = ... -BaseLoop = ... -class CompatLoop(BaseLoop): - """ - Top level compatibility class that adds compatibility support - for the asyncio event loop strategy. - - This is required to be able to access netius event loop on a - asyncio like manner. - - :see: https://docs.python.org/3/library/asyncio-eventloop.html - """ - def __init__(self, loop) -> None: - ... - - def __getattr__(self, name): # -> Any: - ... - - def time(self): # -> float: - ... - - def call_soon(self, callback, *args): # -> Handle: - ... - - def call_soon_threadsafe(self, callback, *args): # -> Handle: - ... - - def call_at(self, when, callback, *args): # -> Handle: - ... - - def call_later(self, delay, callback, *args): # -> Handle: - """ - Calls the provided callback with the provided parameters after - the defined delay (in seconds), should ensure proper sleep operation. - - :type delay: float - :param delay: The delay in seconds after which the callback is going - to be called with the provided arguments. - :type callback: Function - :param callback: The function to be called after the provided delay. - :rtype: Handle - :return: The handle object to the operation, that may be used to cancel it. - """ - ... - - def create_future(self): # -> Any: - ... - - def create_task(self, coroutine): # -> Task: - ... - - def create_server(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def create_connection(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def create_datagram_endpoint(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def getaddrinfo(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def getnameinfo(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def run_until_complete(self, future): # -> Any: - ... - - def run_forever(self): # -> Any: - ... - - def run_in_executor(self, *args, **kwargs): # -> AwaitWrapper: - ... - - def stop(self): # -> None: - ... - - def close(self): # -> None: - ... - - def get_exception_handler(self): # -> Callable[..., None]: - ... - - def set_exception_handler(self, handler): # -> None: - ... - - def default_exception_handler(self, context): # -> None: - ... - - def call_exception_handler(self, context): # -> None: - ... - - def get_debug(self): # -> Any: - ... - - def set_debug(self, enabled): # -> None: - ... - - def set_default_executor(self, executor): # -> None: - ... - - def get_task_factory(self): # -> type[Task]: - ... - - def set_task_factory(self, factory): # -> None: - ... - - def is_running(self): # -> Any: - ... - - def is_closed(self): # -> Any: - ... - - - -def is_compat(): # -> bool: - """ - Determines if the compatibility mode for the netius - event loop is required. - - Under this mode the event loop for netius tries to emulate - the behaviour of the asyncio event loop so that it may - be used with 3rd party protocol classes (not compliant - with the netius protocol). - - :rtype: bool - :return: If the netius infra-structure should run under - the compatibility mode. - """ - ... - -def is_asyncio(): # -> bool: - """ - Checks if the asyncio mode of execution (external event - loop) is the required approach under the current runtime. - - If that's the case the netius event loop is not going to - be used and the asyncio one is going to be used instead. - - :rtype: bool - :return: If the asyncio event loop model is enabled and - proper library support available. - """ - ... - -def build_datagram(*args, **kwargs): # -> AbstractEventLoop | None: - ... - -def connect_stream(*args, **kwargs): # -> AbstractEventLoop | None: - ... - +import asyncio.events +import netius.base.asynchronous as asynchronous +import netius.base.config as config +import netius.base.errors as errors +import netius.base.legacy as legacy +import netius.base.transport as transport +import socket +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class CompatLoop(asyncio.events.AbstractEventLoop): + def __init__(self, loop) -> None: ... + def __getattr__(self, name): ... + def time(self): ... + def call_soon(self, callback, *args): ... + def call_soon_threadsafe(self, callback, *args): ... + def call_at(self, when, callback, *args): ... + def call_later(self, delay, callback, *args): ... + def create_future(self): ... + def create_task(self, coroutine): ... + def create_server(self, *args, **kwargs): ... + def create_connection(self, *args, **kwargs): ... + def create_datagram_endpoint(self, *args, **kwargs): ... + def getaddrinfo(self, *args, **kwargs): ... + def getnameinfo(self, *args, **kwargs): ... + def run_until_complete(self, future): ... + def run_forever(self): ... + def run_in_executor(self, *args, **kwargs): ... + def stop(self): ... + def close(self): ... + def get_exception_handler(self): ... + def set_exception_handler(self, handler): ... + def default_exception_handler(self, context): ... + def call_exception_handler(self, context): ... + def get_debug(self): ... + def set_debug(self, enabled): ... + def set_default_executor(self, executor): ... + def get_task_factory(self): ... + def set_task_factory(self, factory): ... + def is_running(self): ... + def is_closed(self): ... + def _getaddrinfo(self, host, port, family: int = ..., type: int = ..., proto: int = ..., flags: int = ...): ... + def _getnameinfo(self, sockaddr, flags: int = ...): ... + def _run_in_executor(self, executor, func, *args): ... + def _create_connection(self, protocol_factory, host: Incomplete | None = ..., port: Incomplete | None = ..., ssl: Incomplete | None = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: Incomplete | None = ..., local_addr: Incomplete | None = ..., server_hostname: Incomplete | None = ..., *args, **kwargs): ... + def _create_datagram_endpoint(self, protocol_factory, local_addr: Incomplete | None = ..., remote_addr: Incomplete | None = ..., family: int = ..., proto: int = ..., flags: int = ..., reuse_address: Incomplete | None = ..., reuse_port: Incomplete | None = ..., allow_broadcast: Incomplete | None = ..., sock: Incomplete | None = ..., *args, **kwargs): ... + def _set_current_task(self, task): ... + def _unset_current_task(self): ... + def _call_delay(self, callback, args, timeout: Incomplete | None = ..., immediately: bool = ..., verify: bool = ..., safe: bool = ...): ... + def _sleep(self, timeout, future: Incomplete | None = ...): ... + def _default_handler(self, context): ... + @property + def _thread_id(self): ... +def is_compat(): ... +def is_asyncio(): ... +def build_datagram(*args, **kwargs): ... +def connect_stream(*args, **kwargs): ... +def _build_datagram_native(protocol_factory, family: socket.AddressFamily = ..., type: socket.SocketKind = ..., remote_host: Incomplete | None = ..., remote_port: Incomplete | None = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ..., *args, **kwargs): ... +def _build_datagram_compat(protocol_factory, family: socket.AddressFamily = ..., type: socket.SocketKind = ..., remote_host: Incomplete | None = ..., remote_port: Incomplete | None = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ..., *args, **kwargs): ... +def _connect_stream_native(protocol_factory, host, port, ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ..., *args, **kwargs): ... +def _connect_stream_compat(protocol_factory, host, port, ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ..., *args, **kwargs): ... diff --git a/src/typings/netius/base/config.pyi b/src/typings/netius/base/config.pyi index 897336f3..6b42f643 100644 --- a/src/typings/netius/base/config.pyi +++ b/src/typings/netius/base/config.pyi @@ -1,78 +1,31 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -FILE_NAME = ... -FILE_TEMPLATE = ... -HOME_FILE = ... -IMPORT_NAMES = ... -CASTS = ... -ENV_ENCODINGS = ... -CONFIGS = ... -CONFIG_F = ... -HOMES = ... -__builtins__ = ... -def conf(name, default=..., cast=..., ctx=...): - """ - Retrieves the configuration value for the provided value - defaulting to the provided default value in case no value - is found for the provided name. - - An optional cast operation may be performed on the value - in case it's requested. - - :type name: String - :param name: The name of the configuration value to be - retrieved. - :type default: Object - :param default: The default value to be retrieved in case - no value was found for the provided name. - :type cast: Type/String - :param cast: The cast operation to be performed in the - resolved value (optional). - :type ctx: Dictionary - :param ctx: The context dictionary to be used for situations - where a more contextual configuration is meant to be used instead - of the process wide global configuration. - :rtype: Object - :return: The value for the configuration with the requested - name or the default value if no value was found. - """ - ... - -def conf_prefix(prefix, ctx=...): # -> dict[Any, Any]: - ... - -def conf_suffix(suffix, ctx=...): # -> dict[Any, Any]: - ... - -def conf_s(name, value, ctx=...): # -> None: - ... - -def conf_r(name, ctx=...): # -> None: - ... - -def conf_d(ctx=...): # -> dict[Any, Any]: - ... - -def conf_ctx(): # -> dict[str, dict[Any, Any]]: - ... - -def load(names=..., path=..., encoding=..., ctx=...): # -> None: - ... - -def load_file(name=..., path=..., encoding=..., ctx=...): # -> None: - ... - -def load_env(ctx=...): # -> None: - ... - -def get_homes(file_path=..., default=..., encoding=..., force_default=...): # -> list[Any] | list[str] | Literal['']: - ... - +import netius.base.legacy as legacy +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +FILE_NAME: str +FILE_TEMPLATE: str +HOME_FILE: str +IMPORT_NAMES: tuple +CASTS: dict +ENV_ENCODINGS: tuple +CONFIGS: dict +CONFIG_F: list +HOMES: list +def conf(name, default: Incomplete | None = ..., cast: Incomplete | None = ..., ctx: Incomplete | None = ...): ... +def conf_prefix(prefix, ctx: Incomplete | None = ...): ... +def conf_suffix(suffix, ctx: Incomplete | None = ...): ... +def conf_s(name, value, ctx: Incomplete | None = ...): ... +def conf_r(name, ctx: Incomplete | None = ...): ... +def conf_d(ctx: Incomplete | None = ...): ... +def conf_ctx(): ... +def load(names: tuple = ..., path: Incomplete | None = ..., encoding: str = ..., ctx: Incomplete | None = ...): ... +def load_file(name: str = ..., path: Incomplete | None = ..., encoding: str = ..., ctx: Incomplete | None = ...): ... +def load_env(ctx: Incomplete | None = ...): ... +def get_homes(file_path: str = ..., default: str = ..., encoding: str = ..., force_default: bool = ...): ... +def _cast_r(cast): ... +def _load_includes(base_path, config, encoding: str = ...): ... +def _is_valid(key): ... +def _is_devel(): ... +def _is_secure(): ... diff --git a/src/typings/netius/base/conn.pyi b/src/typings/netius/base/conn.pyi index d4c5da72..d814bcaf 100644 --- a/src/typings/netius/base/conn.pyi +++ b/src/typings/netius/base/conn.pyi @@ -1,238 +1,121 @@ -""" -This type stub file was generated by pyright. -""" - -from . import observer - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -OPEN = ... -CLOSED = ... -PENDING = ... -CHUNK_SIZE = ... -class BaseConnection(observer.Observable): - """ - Abstract connection object that should encapsulate - a socket object enabling it to be accessed in much - more "protected" way avoiding possible sync problems. - - It should also abstract the developer from all the - select associated complexities adding and removing the - underlying socket from the selecting mechanism for the - appropriate operations. - """ - def __init__(self, owner=..., socket=..., address=..., datagram=..., ssl=..., max_pending=..., min_pending=...) -> None: - ... - - def destroy(self): # -> None: - ... - - def open(self, connect=...): # -> None: - ... - - def close(self, flush=..., destroy=...): # -> None: - ... - - def close_flush(self): # -> None: - ... - - def upgrade(self, key_file=..., cer_file=..., ca_file=..., server=...): # -> None: - ... - - def set_connecting(self): # -> None: - ... - - def set_connected(self): # -> None: - ... - - def set_upgraded(self): # -> None: - ... - - def set_data(self, data, address=...): # -> None: - ... - - def ensure_write(self, flush=...): # -> None: - ... - - def remove_write(self): # -> None: - ... - - def enable_read(self): # -> None: - """ - Enables read operations for the current connection - this will set the read enable flag and then subscribe - to the read operations in case the underlying poll - method is not of type edge (level based). - - This is a dangerous operation as it may cause the system - to stall if misused. - """ - ... - - def disable_read(self): # -> None: - """ - Disables any read operation on the current socket, does that - by disabling the current read enable and then unsubscribing - the current connection from the read operation. - - This is an extremely dangerous operation and the correct knowledge - of the event poll is required to avoid stalling. - """ - ... - - def send(self, data, address=..., delay=..., force=..., callback=...): # -> int: - """ - The main send call to be used by a proxy connection and - from different threads. - - This method is the equivalent on a socket basis to both the - send and the send to method, meaning that datagram send operations - are also allowed by using the address parameter. - - In case the sending should be forced as delayed (next tick) - the delay flag should be set and the sending will be delayed. - This is especially useful to avoid a stack overflow situation - because of extended callback calling, for example while sending - very large chunks of information (eg: multi megabyte files). - - An optional callback attribute may be sent, so that when the - send is complete it's called with a reference to the data object. - - Calling this method should be done with care as this can - create dead lock or socket corruption situations, extreme - knowledge of the internals of the system is required. - - :type data: String - :param data: The buffer containing the data to be sent - through this connection to the other endpoint. - :type address: Tuple - :param address: The target address for the send operation, - this is relevant only for datagram based connections. - :type delay: bool - :param delay: If the send operation should be delayed until - the next tick operation or if it should be performed as - soon as possible (as defined in specification). - :type force: bool - :param force: If the sending of the data should be "forced", - meaning that even if the connection is not open the data - is added to the current pending queue. Useful for client - connections wanting to write ahead. - :type callback: Function - :param callback: Function to be called when the data set - to be send is completely sent to the socket. - """ - ... - - def recv(self, size=..., force=...): # -> Literal[b""]: - ... - - def pend(self, data, back=...): # -> None: - ... - - def restore(self, data, back=...): # -> None: - """ - Restore data to the pending (to receive) so that they are - going to be "received" in the next receive operation. - - :type data: String - :param data: The buffer of data that is going to be restored - to the internal receive buffers. - :type back: bool - :param back: If the data should be restore to the "back" of - the internal buffers, or if instead it should be added to the - front (next to be received) part of the buffer. - """ - ... - - def run_starter(self): # -> bool: - ... - - def end_starter(self): # -> None: - ... - - def add_starter(self, starter, back=...): # -> None: - ... - - def remove_starter(self, starter): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, Any | None]: - ... - - def ssl_certificate(self, binary=...): # -> None: - ... - - def ssl_verify_host(self, host=...): # -> None: - ... - - def ssl_verify_fingerprint(self, fingerprint=...): # -> None: - ... - - def ssl_dump_certificate(self, dump=...): # -> None: - ... - - def ssl_protocol(self): # -> None: - ... - - def ssl_alpn_protocol(self): # -> None: - ... - - def ssl_npn_protocol(self): # -> None: - ... - - def is_open(self): # -> bool: - ... - - def is_closed(self): # -> bool: - ... - - def is_pending(self): # -> bool: - ... - - def is_connected(self): # -> bool: - ... - - def is_connecting(self): # -> bool: - ... - - def is_upgrading(self): # -> bool: - ... - - def is_throttleable(self): # -> Literal[True]: - ... - - def is_exhausted(self): # -> bool: - ... - - def is_restored(self): # -> bool: - ... - - def is_pending_data(self): # -> bool: - ... - - - -class DiagConnection(BaseConnection): - def __init__(self, *args, **kwargs) -> None: - ... - - def recv(self, *args, **kwargs): # -> Literal[b""]: - ... - - def send(self, data, *args, **kwargs): # -> int: - ... - - def info_dict(self, full=...): # -> dict[str, Any | None]: - ... - - - -is_diag = ... -if is_diag: - Connection = ... -else: - Connection = ... +import netius.base.config as config +import netius.base.legacy as legacy +import netius.base.observer +import netius.base.observer as observer +import netius.base.tls as tls +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int + +class BaseConnection(netius.base.observer.Observable): + def __init__(self, owner: Incomplete | None = ..., socket: Incomplete | None = ..., address: Incomplete | None = ..., datagram: bool = ..., ssl: bool = ..., max_pending: int = ..., min_pending: int = ...) -> None: ... + def destroy(self): ... + def open(self, connect: bool = ...): ... + def close(self, flush: bool = ..., destroy: bool = ...): ... + def close_flush(self): ... + def upgrade(self, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., server: bool = ...): ... + def set_connecting(self): ... + def set_connected(self): ... + def set_upgraded(self): ... + def set_data(self, data, address: Incomplete | None = ...): ... + def ensure_write(self, flush: bool = ...): ... + def remove_write(self): ... + def enable_read(self): ... + def disable_read(self): ... + def send(self, data, address: Incomplete | None = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def recv(self, size: int = ..., force: bool = ...): ... + def pend(self, data, back: bool = ...): ... + def restore(self, data, back: bool = ...): ... + def run_starter(self): ... + def end_starter(self): ... + def add_starter(self, starter, back: bool = ...): ... + def remove_starter(self, starter): ... + def info_dict(self, full: bool = ...): ... + def ssl_certificate(self, binary: bool = ...): ... + def ssl_verify_host(self, host: Incomplete | None = ...): ... + def ssl_verify_fingerprint(self, fingerprint: Incomplete | None = ...): ... + def ssl_dump_certificate(self, dump: bool = ...): ... + def ssl_protocol(self): ... + def ssl_alpn_protocol(self): ... + def ssl_npn_protocol(self): ... + def is_open(self): ... + def is_closed(self): ... + def is_pending(self): ... + def is_connected(self): ... + def is_connecting(self): ... + def is_upgrading(self): ... + def is_throttleable(self): ... + def is_exhausted(self): ... + def is_restored(self): ... + def is_pending_data(self): ... + def _send(self): ... + def _recv(self, size): ... + def _recv_ssl(self, size): ... + def _recv_restored(self, size): ... + def _shutdown(self, close: bool = ..., force: bool = ..., ignore: bool = ...): ... + def _close_callback(self, connection): ... + def _flush_write(self): ... + +class DiagConnection(BaseConnection): + def __init__(self, *args, **kwargs) -> None: ... + def recv(self, *args, **kwargs): ... + def send(self, data, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + def _uptime(self): ... + def _resolve(self, address): ... +is_diag: bool + +class Connection(netius.base.observer.Observable): + def __init__(self, owner: Incomplete | None = ..., socket: Incomplete | None = ..., address: Incomplete | None = ..., datagram: bool = ..., ssl: bool = ..., max_pending: int = ..., min_pending: int = ...) -> None: ... + def destroy(self): ... + def open(self, connect: bool = ...): ... + def close(self, flush: bool = ..., destroy: bool = ...): ... + def close_flush(self): ... + def upgrade(self, key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., server: bool = ...): ... + def set_connecting(self): ... + def set_connected(self): ... + def set_upgraded(self): ... + def set_data(self, data, address: Incomplete | None = ...): ... + def ensure_write(self, flush: bool = ...): ... + def remove_write(self): ... + def enable_read(self): ... + def disable_read(self): ... + def send(self, data, address: Incomplete | None = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def recv(self, size: int = ..., force: bool = ...): ... + def pend(self, data, back: bool = ...): ... + def restore(self, data, back: bool = ...): ... + def run_starter(self): ... + def end_starter(self): ... + def add_starter(self, starter, back: bool = ...): ... + def remove_starter(self, starter): ... + def info_dict(self, full: bool = ...): ... + def ssl_certificate(self, binary: bool = ...): ... + def ssl_verify_host(self, host: Incomplete | None = ...): ... + def ssl_verify_fingerprint(self, fingerprint: Incomplete | None = ...): ... + def ssl_dump_certificate(self, dump: bool = ...): ... + def ssl_protocol(self): ... + def ssl_alpn_protocol(self): ... + def ssl_npn_protocol(self): ... + def is_open(self): ... + def is_closed(self): ... + def is_pending(self): ... + def is_connected(self): ... + def is_connecting(self): ... + def is_upgrading(self): ... + def is_throttleable(self): ... + def is_exhausted(self): ... + def is_restored(self): ... + def is_pending_data(self): ... + def _send(self): ... + def _recv(self, size): ... + def _recv_ssl(self, size): ... + def _recv_restored(self, size): ... + def _shutdown(self, close: bool = ..., force: bool = ..., ignore: bool = ...): ... + def _close_callback(self, connection): ... + def _flush_write(self): ... diff --git a/src/typings/netius/base/container.pyi b/src/typings/netius/base/container.pyi index 3ab69c84..914b3306 100644 --- a/src/typings/netius/base/container.pyi +++ b/src/typings/netius/base/container.pyi @@ -1,85 +1,97 @@ -""" -This type stub file was generated by pyright. -""" - -from . import server -from .common import * - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Container(Base): - def __init__(self, *args, **kwargs) -> None: - ... - - def start(self, owner): # -> None: - ... - - def cleanup(self): # -> None: - ... - - def loop(self): # -> None: - ... - - def ticks(self): # -> None: - ... - - def connections_dict(self, full=...): # -> dict[Any, Any]: - ... - - def connection_dict(self, id, full=...): # -> None: - ... - - def on_start(self): # -> None: - ... - - def on_stop(self): # -> None: - ... - - def add_base(self, base): # -> None: - ... - - def remove_base(self, base): # -> None: - ... - - def start_base(self, base): # -> None: - ... - - def start_all(self): # -> None: - ... - - def apply_all(self): # -> None: - ... - - def apply_base(self, base): # -> None: - ... - - def call_all(self, name, *args, **kwargs): # -> None: - ... - - def trigger_all(self, name, *args, **kwargs): # -> None: - ... - - - -class ContainerServer(server.StreamServer): - def __init__(self, *args, **kwargs) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def cleanup(self): # -> None: - ... - - def add_base(self, base): # -> None: - ... - - - +import netius as netius +import netius.base.async_old as async_old +import netius.base.asynchronous as asynchronous +import netius.base.common +import netius.base.compat as compat +import netius.base.config as config +import netius.base.errors as errors +import netius.base.legacy as legacy +import netius.base.log as log +import netius.base.observer as observer +import netius.base.server +import netius.base.server as server +import netius.base.tls as tls +import netius.base.util as util +import netius.middleware as middleware +from netius.base.async_neo import AwaitWrapper as AwaitWrapper, CoroutineWrapper as CoroutineWrapper, Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.common import AbstractBase as AbstractBase, Base as Base, BaseThread as BaseThread, DiagBase as DiagBase, build_future as build_future, compat_loop as compat_loop, ensure as ensure, ensure_asyncio as ensure_asyncio, ensure_loop as ensure_loop, ensure_main as ensure_main, ensure_pool as ensure_pool, get_event_loop as get_event_loop, get_loop as get_loop, get_main as get_main, get_poll as get_poll, new_loop as new_loop, new_loop_asyncio as new_loop_asyncio, new_loop_main as new_loop_main, stop_loop as stop_loop +from netius.base.conn import BaseConnection as BaseConnection, Connection as Connection, DiagConnection as DiagConnection +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +is_diag: bool +POLL_TIMEOUT: float +NAME: str +VERSION: str +PLATFORM: str +IDENTIFIER_TINY: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +WSAEWOULDBLOCK: int +WSAECONNABORTED: int +WSAECONNRESET: int +SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE: int +POLL_ORDER: tuple +SILENT_ERRORS: tuple +VALID_ERRORS: tuple +SSL_SILENT_ERRORS: tuple +SSL_VALID_ERRORS: tuple +SSL_ERROR_NAMES: dict +SSL_VALID_REASONS: tuple +TCP_TYPE: int +UDP_TYPE: int +STATE_STOP: int +STATE_START: int +STATE_PAUSE: int +STATE_CONFIG: int +STATE_POLL: int +STATE_TICK: int +STATE_READ: int +STATE_WRITE: int +STATE_ERRROR: int +STATE_STRINGS: tuple +KEEPALIVE_TIMEOUT: int +KEEPALIVE_INTERVAL: int +KEEPALIVE_COUNT: int +ALLOW_BLOCK: bool +LOG_FORMAT: str +BASE_PATH: str +EXTRAS_PATH: str +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str + +class Container(netius.base.common.AbstractBase): + def __init__(self, *args, **kwargs) -> None: ... + def start(self, owner): ... + def cleanup(self): ... + def loop(self): ... + def ticks(self): ... + def connections_dict(self, full: bool = ...): ... + def connection_dict(self, id, full: bool = ...): ... + def on_start(self): ... + def on_stop(self): ... + def add_base(self, base): ... + def remove_base(self, base): ... + def start_base(self, base): ... + def start_all(self): ... + def apply_all(self): ... + def apply_base(self, base): ... + def call_all(self, name, *args, **kwargs): ... + def trigger_all(self, name, *args, **kwargs): ... + +class ContainerServer(netius.base.server.StreamServer): + def __init__(self, *args, **kwargs) -> None: ... + def start(self): ... + def stop(self): ... + def cleanup(self): ... + def add_base(self, base): ... diff --git a/src/typings/netius/base/diag.pyi b/src/typings/netius/base/diag.pyi index 61998dc5..3bdd0635 100644 --- a/src/typings/netius/base/diag.pyi +++ b/src/typings/netius/base/diag.pyi @@ -1,43 +1,18 @@ -""" -This type stub file was generated by pyright. -""" - -import appier - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -loaded = ... -class DiagApp(appier.APIApp): - def __init__(self, system, *args, **kwargs) -> None: - ... - - @appier.route("/logger", "GET") - def show_logger(self): # -> dict[str, Any]: - ... - - @appier.route("/logger/set", ("GET", "POST")) - def set_logger(self): # -> dict[str, Any]: - ... - - @appier.route("/environ", "GET") - def show_environ(self): - ... - - @appier.route("/info", "GET") - def system_info(self): - ... - - @appier.route("/connections", "GET") - def list_connections(self): - ... - - @appier.route("/connections/", "GET") - def show_connection(self, id): - ... - - - +import netius as netius +import netius.mock.appier +import netius.mock.appier as appier +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +loaded: bool + +class DiagApp(netius.mock.appier.APIApp): + show_logger: ClassVar[None] = ... + set_logger: ClassVar[None] = ... + show_environ: ClassVar[None] = ... + system_info: ClassVar[None] = ... + list_connections: ClassVar[None] = ... + show_connection: ClassVar[None] = ... + def __init__(self, system, *args, **kwargs) -> None: ... diff --git a/src/typings/netius/base/errors.pyi b/src/typings/netius/base/errors.pyi index 157c228c..4d2a05c0 100644 --- a/src/typings/netius/base/errors.pyi +++ b/src/typings/netius/base/errors.pyi @@ -1,143 +1,25 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class NetiusError(Exception): - """ - The top level base error to be used in the - netius infra-structure. - - Note that this class inherits from the runtime - error meaning that all the errors are runtime. - """ - def __init__(self, *args, **kwargs) -> None: - ... - - def get_kwarg(self, name, default=...): - ... - - @property - def uid(self): # -> UUID: - ... - - - -class RuntimeError(NetiusError): - """ - Error to be used for situations where an exception - is raised during a typical runtime situation. - - This error class is meant to be used as the parent - class in every exception raised during normal execution. - """ - ... - - -class StopError(RuntimeError): - """ - Error to be used for situations where a stop - intention is meant to be raised to upper layers. - - This error represent an operation and not a real - error and should be used as such. - """ - ... - - -class PauseError(RuntimeError): - """ - Error to be used for situations where a pause - intention is meant to be raised to upper layers. - - This error represent an operation and not a real - error and should be used as such. - """ - ... - - -class WakeupError(RuntimeError): - """ - Error used to send a wakeup intent from one context - or thread to another. - - This is especially useful on the context of signal - handling where an interruption may happen at any time. - """ - ... - - -class DataError(RuntimeError): - """ - Error to be used for situations where the - data that has been received/sent is invalid. - - This error may be used for situations where - the data in the buffer is not sufficient for - parsing the values. - """ - ... - - -class ParserError(RuntimeError): - """ - Error caused by a malformed data that invalidated - the possibility to parse it. - - This error should only be used under a parser infra- - structure and never outside it. - """ - def __init__(self, *args, **kwargs) -> None: - ... - - - -class GeneratorError(RuntimeError): - """ - Error generated by a problem in the generation of - and encoded data (reverse of parser error). - - This error should be raise only in a generator of - an encoded stream buffer. - """ - ... - - -class SecurityError(RuntimeError): - """ - Error caused by a failed security verification this - errors should be properly audited in order to avoid - extra problems that may arise from them. - - This kind of problems is considered to be runtime - as they should not be related with programming. - """ - ... - - -class NotImplemented(RuntimeError): - """ - Error caused by the non implementation of a certain - method/feature at a certain level. This may mean that - the wrong level of abstraction is being called or a - certain feature is pending development. - - This kind of problems is considered to be development - as they may be related with programming. - """ - ... - - -class AssertionError(RuntimeError): - """ - Error raised for failure to meet any pre-condition or - assertion for a certain data set. - """ - ... - - +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class NetiusError(Exception): + def __init__(self, *args, **kwargs) -> None: ... + def get_kwarg(self, name, default: Incomplete | None = ...): ... + @property + def uid(self): ... + +class RuntimeError(NetiusError): ... +class StopError(RuntimeError): ... +class PauseError(RuntimeError): ... +class WakeupError(RuntimeError): ... +class DataError(RuntimeError): ... + +class ParserError(RuntimeError): + def __init__(self, *args, **kwargs) -> None: ... + +class GeneratorError(RuntimeError): ... +class SecurityError(RuntimeError): ... +class NotImplemented(RuntimeError): ... +class AssertionError(RuntimeError): ... diff --git a/src/typings/netius/base/legacy.pyi b/src/typings/netius/base/legacy.pyi index 9063ee05..8734fe2a 100644 --- a/src/typings/netius/base/legacy.pyi +++ b/src/typings/netius/base/legacy.pyi @@ -1,240 +1,93 @@ -""" -This type stub file was generated by pyright. -""" - -import contextlib - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -ArgSpec = ... -@contextlib.contextmanager -def ctx_absolute(): # -> Generator[None, Any, None]: - ... - -PYTHON_3 = ... -PYTHON_35 = ... -PYTHON_36 = ... -PYTHON_39 = ... -PYTHON_ASYNC = ... -PYTHON_ASYNC_GEN = ... -PYTHON_V = ... -if PYTHON_3: - LONG = ... -else: - LONG = ... -if PYTHON_3: - BYTES = ... -else: - BYTES = ... -if PYTHON_3: - UNICODE = ... -else: - UNICODE = ... -if PYTHON_3: - OLD_UNICODE = ... -else: - OLD_UNICODE = ... -if PYTHON_3: - STRINGS = ... -else: - STRINGS = ... -if PYTHON_3: - ALL_STRINGS = ... -else: - ALL_STRINGS = ... -if PYTHON_3: - INTEGERS = ... -else: - INTEGERS = ... -_ord = ... -_chr = ... -_str = str -_bytes = bytes -_range = range -_xrange = ... -if PYTHON_3: - Request = ... -else: - Request = ... -if PYTHON_3: - HTTPHandler = ... -else: - HTTPHandler = ... -if PYTHON_3: - HTTPError = ... -else: - HTTPError = ... -if PYTHON_3: - HTTPConnection = ... -else: - HTTPConnection = ... -if PYTHON_3: - HTTPSConnection = ... -else: - HTTPSConnection = ... -_execfile = ... -_reduce = ... -_reload = ... -_unichr = ... -def with_meta(meta, *bases): - ... - -def eager(iterable): # -> list[Any]: - ... - -def iteritems(associative): - ... - -def iterkeys(associative): - ... - -def itervalues(associative): - ... - -def items(associative): # -> list[Any]: - ... - -def keys(associative): # -> list[Any]: - ... - -def values(associative): # -> list[Any]: - ... - -def xrange(start, stop=..., step=...): # -> _range: - ... - -def range(start, stop=..., step=...): # -> list[Any] | _range: - ... - -def ord(value): # -> int: - ... - -def chr(value): # -> _bytes | str: - ... - -def chri(value): # -> str: - ... - -def bytes(value, encoding=..., errors=..., force=...): # -> _bytes: - ... - -def str(value, encoding=..., errors=..., force=...): - ... - -def u(value, encoding=..., errors=..., force=...): - ... - -def ascii(value, encoding=..., errors=...): # -> bytes | str: - ... - -def orderable(value): # -> Orderable: - ... - -def is_str(value): # -> Any: - ... - -def is_unicode(value): # -> Any: - ... - -def is_bytes(value): # -> Any: - ... - -def is_string(value, all=...): # -> bool: - ... - -def is_generator(value): # -> bool: - ... - -def is_async_generator(value): # -> bool: - ... - -def is_unittest(name=...): # -> bool: - ... - -def execfile(path, global_vars, local_vars=..., encoding=...): # -> None: - ... - -def walk(path, visit, arg): # -> None: - ... - -def getargspec(func): # -> ArgSpec: - ... - -def has_module(name): # -> bool: - ... - -def new_module(name): # -> ModuleType: - ... - -def reduce(*args, **kwargs): - ... - -def reload(*args, **kwargs): # -> ModuleType: - ... - -def unichr(*args, **kwargs): # -> str: - ... - -def urlopen(*args, **kwargs): # -> _UrlopenRet: - ... - -def build_opener(*args, **kwargs): # -> OpenerDirector: - ... - -def urlparse(*args, **kwargs): - ... - -def urlunparse(*args, **kwargs): # -> Literal[b""]: - ... - -def parse_qs(*args, **kwargs): # -> dict[Any, list[Any]]: - ... - -def urlencode(*args, **kwargs): # -> str: - ... - -def quote(*args, **kwargs): # -> str: - ... - -def quote_plus(*args, **kwargs): # -> str: - ... - -def unquote(*args, **kwargs): # -> str: - ... - -def unquote_plus(*args, **kwargs): # -> str: - ... - -def cmp_to_key(*args, **kwargs): # -> dict[str, Callable[[Any], SupportsAllComparisons]] | dict[str, Any]: - ... - -def tobytes(self, *args, **kwargs): - ... - -def tostring(self, *args, **kwargs): - ... - -def StringIO(*args, **kwargs): # -> StringIO: - ... - -def BytesIO(*args, **kwargs): # -> BytesIO | StringIO: - ... - -class Orderable(tuple): - """ - Simple tuple type wrapper that provides a simple - first element ordering, that is compatible with - both the Python 2 and Python 3+ infra-structures. - """ - def __cmp__(self, value): - ... - - def __lt__(self, value) -> bool: - ... - - - +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class ArgSpec(tuple): + _fields: ClassVar[tuple] = ... + _field_defaults: ClassVar[dict] = ... + __match_args__: ClassVar[tuple] = ... + args: Incomplete + varargs: Incomplete + keywords: Incomplete + defaults: Incomplete + def __init__(self, _cls, args, varargs, keywords, defaults) -> None: ... + @classmethod + def _make(cls, iterable): ... + def _replace(self, **kwds): ... + def _asdict(self): ... + def __getnewargs__(self): ... +def ctx_absolute(*args, **kwds): ... + +urllib2: None +httplib: None +PYTHON_3: bool +PYTHON_35: bool +PYTHON_36: bool +PYTHON_39: bool +PYTHON_ASYNC: bool +PYTHON_ASYNC_GEN: bool +PYTHON_V: int +OLD_UNICODE: None +STRINGS: tuple +ALL_STRINGS: tuple +INTEGERS: tuple +_xrange: None +_execfile: None +_reduce: None +_reload: None +_unichr: None +def with_meta(meta, *bases): ... +def eager(iterable): ... +def iteritems(associative): ... +def iterkeys(associative): ... +def itervalues(associative): ... +def items(associative): ... +def keys(associative): ... +def values(associative): ... +def xrange(start, stop: Incomplete | None = ..., step: int = ...): ... +def range(start, stop: Incomplete | None = ..., step: Incomplete | None = ...): ... +def ord(value): ... +def chr(value): ... +def chri(value): ... +def bytes(value, encoding: str = ..., errors: str = ..., force: bool = ...): ... +def str(value, encoding: str = ..., errors: str = ..., force: bool = ...): ... +def u(value, encoding: str = ..., errors: str = ..., force: bool = ...): ... +def ascii(value, encoding: str = ..., errors: str = ...): ... +def orderable(value): ... +def is_str(value): ... +def is_unicode(value): ... +def is_bytes(value): ... +def is_string(value, all: bool = ...): ... +def is_generator(value): ... +def is_async_generator(value): ... +def is_unittest(name: str = ...): ... +def execfile(path, global_vars, local_vars: Incomplete | None = ..., encoding: str = ...): ... +def walk(path, visit, arg): ... +def getargspec(func): ... +def has_module(name): ... +def new_module(name): ... +def reduce(*args, **kwargs): ... +def reload(*args, **kwargs): ... +def unichr(*args, **kwargs): ... +def urlopen(*args, **kwargs): ... +def build_opener(*args, **kwargs): ... +def urlparse(*args, **kwargs): ... +def urlunparse(*args, **kwargs): ... +def parse_qs(*args, **kwargs): ... +def urlencode(*args, **kwargs): ... +def quote(*args, **kwargs): ... +def quote_plus(*args, **kwargs): ... +def unquote(*args, **kwargs): ... +def unquote_plus(*args, **kwargs): ... +def cmp_to_key(*args, **kwargs): ... +def tobytes(self, *args, **kwargs): ... +def tostring(self, *args, **kwargs): ... +def StringIO(*args, **kwargs): ... +def BytesIO(*args, **kwargs): ... + +class Orderable(tuple): + def __cmp__(self, value): ... + def __lt__(self, value) -> bool: ... diff --git a/src/typings/netius/base/log.pyi b/src/typings/netius/base/log.pyi index 6e5c5e45..66975981 100644 --- a/src/typings/netius/base/log.pyi +++ b/src/typings/netius/base/log.pyi @@ -1,20 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SILENT = ... -def rotating_handler(path=..., max_bytes=..., max_log=..., encoding=..., delay=...): # -> RotatingFileHandler: - ... - -def smtp_handler(host=..., port=..., sender=..., receivers=..., subject=..., username=..., password=..., stls=...): # -> SMTPHandler: - ... - -def in_signature(callable, name): # -> list[str] | bool | Literal[''] | None: - ... - +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +SILENT: int +def rotating_handler(path: str = ..., max_bytes: int = ..., max_log: int = ..., encoding: Incomplete | None = ..., delay: bool = ...): ... +def smtp_handler(host: str = ..., port: int = ..., sender: str = ..., receivers: list = ..., subject: str = ..., username: Incomplete | None = ..., password: Incomplete | None = ..., stls: bool = ...): ... +def in_signature(callable, name): ... diff --git a/src/typings/netius/base/observer.pyi b/src/typings/netius/base/observer.pyi index d5c4c50c..e15841ef 100644 --- a/src/typings/netius/base/observer.pyi +++ b/src/typings/netius/base/observer.pyi @@ -1,42 +1,14 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Observable: - """ - The base class that implements the observable - patter allowing the object to handle a series of - event in a dynamic fashion. - - This class should be friendly to multiple inheritance - and should avoid variable naming collision. - """ - def __init__(self, *args, **kwargs) -> None: - ... - - def build(self): # -> None: - ... - - def destroy(self): # -> None: - ... - - def bind(self, name, method, oneshot=...): # -> None: - ... - - def unbind(self, name, method=...): # -> None: - ... - - def unbind_all(self): # -> None: - ... - - def trigger(self, name, *args, **kwargs): # -> None: - ... - - - +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class Observable: + def __init__(self, *args, **kwargs) -> None: ... + def build(self): ... + def destroy(self): ... + def bind(self, name, method, oneshot: bool = ...): ... + def unbind(self, name, method: Incomplete | None = ...): ... + def unbind_all(self): ... + def trigger(self, name, *args, **kwargs): ... diff --git a/src/typings/netius/base/poll.pyi b/src/typings/netius/base/poll.pyi index 163ca1f5..c937f5cc 100644 --- a/src/typings/netius/base/poll.pyi +++ b/src/typings/netius/base/poll.pyi @@ -1,240 +1,89 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -POLL_TIMEOUT = ... -class Poll: - """ - The top level abstract implementation of a poll object - should be used for inheritance and reference on the - various methods that are part of the api. - """ - def __init__(self) -> None: - ... - - @classmethod - def name(cls): # -> str: - ... - - @classmethod - def test(cls): # -> Literal[True]: - ... - - def open(self, timeout=...): # -> None: - ... - - def close(self): # -> None: - ... - - def poll(self): # -> list[Any]: - ... - - def poll_owner(self): # -> dict[Any, Any]: - ... - - def is_open(self): # -> bool: - ... - - def is_edge(self): # -> Literal[False]: - ... - - def is_empty(self): # -> bool: - ... - - def sub_all(self, socket, owner=...): # -> None: - ... - - def unsub_all(self, socket): # -> None: - ... - - def is_sub_read(self, socket): # -> bool: - ... - - def is_sub_write(self, socket): # -> bool: - ... - - def is_sub_error(self, socket): # -> bool: - ... - - def sub_read(self, socket, owner=...): # -> None: - ... - - def sub_write(self, socket, owner=...): # -> None: - ... - - def sub_error(self, socket, owner=...): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - - -class EpollPoll(Poll): - def __init__(self, *args, **kwargs) -> None: - ... - - @classmethod - def test(cls): # -> bool: - ... - - def open(self, timeout=...): # -> None: - ... - - def close(self): # -> None: - ... - - def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: - ... - - def is_edge(self): # -> Literal[True]: - ... - - def sub_read(self, socket, owner=...): # -> None: - ... - - def sub_write(self, socket, owner=...): # -> None: - ... - - def sub_error(self, socket, owner=...): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - - -class KqueuePoll(Poll): - def __init__(self, *args, **kwargs) -> None: - ... - - @classmethod - def test(cls): # -> bool: - ... - - def open(self, timeout=...): # -> None: - ... - - def close(self): # -> None: - ... - - def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: - ... - - def is_edge(self): # -> Literal[True]: - ... - - def sub_read(self, socket, owner=...): # -> None: - ... - - def sub_write(self, socket, owner=...): # -> None: - ... - - def sub_error(self, socket, owner=...): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - - -class PollPoll(Poll): - def __init__(self, *args, **kwargs) -> None: - ... - - @classmethod - def test(cls): # -> bool: - ... - - def open(self, timeout=...): # -> None: - ... - - def close(self): # -> None: - ... - - def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: - ... - - def is_edge(self): # -> Literal[False]: - ... - - def sub_read(self, socket, owner=...): # -> None: - ... - - def sub_write(self, socket, owner=...): # -> None: - ... - - def sub_error(self, socket, owner=...): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - - -class SelectPoll(Poll): - def __init__(self, *args, **kwargs) -> None: - ... - - def open(self, timeout=...): # -> None: - ... - - def close(self): # -> None: - ... - - def poll(self): # -> tuple[list[Any], list[Any], list[Any]]: - ... - - def is_edge(self): # -> Literal[False]: - ... - - def sub_read(self, socket, owner=...): # -> None: - ... - - def sub_write(self, socket, owner=...): # -> None: - ... - - def sub_error(self, socket, owner=...): # -> None: - ... - - def unsub_read(self, socket): # -> None: - ... - - def unsub_write(self, socket): # -> None: - ... - - def unsub_error(self, socket): # -> None: - ... - - - +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +POLL_TIMEOUT: float + +class Poll: + def __init__(self) -> None: ... + @classmethod + def name(cls): ... + @classmethod + def test(cls): ... + def open(self, timeout: float = ...): ... + def close(self): ... + def poll(self): ... + def poll_owner(self): ... + def is_open(self): ... + def is_edge(self): ... + def is_empty(self): ... + def sub_all(self, socket, owner: Incomplete | None = ...): ... + def unsub_all(self, socket): ... + def is_sub_read(self, socket): ... + def is_sub_write(self, socket): ... + def is_sub_error(self, socket): ... + def sub_read(self, socket, owner: Incomplete | None = ...): ... + def sub_write(self, socket, owner: Incomplete | None = ...): ... + def sub_error(self, socket, owner: Incomplete | None = ...): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + +class EpollPoll(Poll): + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def test(cls): ... + def open(self, timeout: float = ...): ... + def close(self): ... + def poll(self): ... + def is_edge(self): ... + def sub_read(self, socket, owner: Incomplete | None = ...): ... + def sub_write(self, socket, owner: Incomplete | None = ...): ... + def sub_error(self, socket, owner: Incomplete | None = ...): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + +class KqueuePoll(Poll): + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def test(cls): ... + def open(self, timeout: float = ...): ... + def close(self): ... + def poll(self): ... + def is_edge(self): ... + def sub_read(self, socket, owner: Incomplete | None = ...): ... + def sub_write(self, socket, owner: Incomplete | None = ...): ... + def sub_error(self, socket, owner: Incomplete | None = ...): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + +class PollPoll(Poll): + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def test(cls): ... + def open(self, timeout: float = ...): ... + def close(self): ... + def poll(self): ... + def is_edge(self): ... + def sub_read(self, socket, owner: Incomplete | None = ...): ... + def sub_write(self, socket, owner: Incomplete | None = ...): ... + def sub_error(self, socket, owner: Incomplete | None = ...): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... + +class SelectPoll(Poll): + def __init__(self, *args, **kwargs) -> None: ... + def open(self, timeout: float = ...): ... + def close(self): ... + def poll(self): ... + def is_edge(self): ... + def sub_read(self, socket, owner: Incomplete | None = ...): ... + def sub_write(self, socket, owner: Incomplete | None = ...): ... + def sub_error(self, socket, owner: Incomplete | None = ...): ... + def unsub_read(self, socket): ... + def unsub_write(self, socket): ... + def unsub_error(self, socket): ... diff --git a/src/typings/netius/base/protocol.pyi b/src/typings/netius/base/protocol.pyi index fcc07b3d..25d004df 100644 --- a/src/typings/netius/base/protocol.pyi +++ b/src/typings/netius/base/protocol.pyi @@ -1,152 +1,60 @@ -""" -This type stub file was generated by pyright. -""" - -from . import observer - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Protocol(observer.Observable): - """ - Abstract class from which concrete implementation of - protocol logic should inherit. - - The logic of a protocol should implement both a reaction - to the arrival of information (receive) and the sending - of processed data (send). - """ - def __init__(self, owner=...) -> None: - ... - - def open(self): # -> None: - ... - - def close(self): # -> None: - ... - - def finish(self): # -> None: - ... - - def open_c(self): # -> None: - ... - - def close_c(self): # -> None: - ... - - def finish_c(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[Any, Any]: - ... - - def connection_made(self, transport): # -> None: - ... - - def connection_lost(self, exception): # -> None: - ... - - def transport(self): # -> None: - ... - - def loop(self): # -> None: - ... - - def loop_set(self, loop): # -> None: - ... - - def loop_unset(self): # -> None: - ... - - def pause_writing(self): # -> None: - ... - - def resume_writing(self): # -> None: - ... - - def delay(self, callable, timeout=...): - ... - - def debug(self, object): # -> None: - ... - - def info(self, object): # -> None: - ... - - def warning(self, object): # -> None: - ... - - def error(self, object): # -> None: - ... - - def critical(self, object): # -> None: - ... - - def is_pending(self): # -> bool: - ... - - def is_open(self): # -> bool: - ... - - def is_closed(self): # -> bool: - ... - - def is_closing(self): # -> bool: - ... - - def is_closed_or_closing(self): # -> bool: - ... - - def is_devel(self): # -> Literal[False]: - ... - - - -class DatagramProtocol(Protocol): - def __init__(self) -> None: - ... - - def datagram_received(self, data, address): # -> None: - ... - - def error_received(self, exception): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def send(self, data, address, delay=..., force=..., callback=...): # -> int: - ... - - def send_to(self, data, address, delay=..., force=..., callback=...): # -> int: - ... - - def add_request(self, request): # -> None: - ... - - def remove_request(self, request): # -> None: - ... - - def get_request(self, id): - ... - - - -class StreamProtocol(Protocol): - def data_received(self, data): # -> None: - ... - - def eof_received(self): # -> None: - ... - - def on_data(self, data): # -> None: - ... - - def send(self, data, delay=..., force=..., callback=...): # -> int: - ... - - - +import netius.base.legacy as legacy +import netius.base.observer +import netius.base.observer as observer +import netius.base.request as request +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class Protocol(netius.base.observer.Observable): + def __init__(self, owner: Incomplete | None = ...) -> None: ... + def open(self): ... + def close(self): ... + def finish(self): ... + def open_c(self): ... + def close_c(self): ... + def finish_c(self): ... + def info_dict(self, full: bool = ...): ... + def connection_made(self, transport): ... + def connection_lost(self, exception): ... + def transport(self): ... + def loop(self): ... + def loop_set(self, loop): ... + def loop_unset(self): ... + def pause_writing(self): ... + def resume_writing(self): ... + def delay(self, callable, timeout: Incomplete | None = ...): ... + def debug(self, object): ... + def info(self, object): ... + def warning(self, object): ... + def error(self, object): ... + def critical(self, object): ... + def is_pending(self): ... + def is_open(self): ... + def is_closed(self): ... + def is_closing(self): ... + def is_closed_or_closing(self): ... + def is_devel(self): ... + def _close_transport(self, force: bool = ...): ... + def _delay_send(self, data, address: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def _flush_callbacks(self): ... + def _flush_send(self): ... + +class DatagramProtocol(Protocol): + def __init__(self) -> None: ... + def datagram_received(self, data, address): ... + def error_received(self, exception): ... + def on_data(self, address, data): ... + def send(self, data, address, delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_to(self, data, address, delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def add_request(self, request): ... + def remove_request(self, request): ... + def get_request(self, id): ... + +class StreamProtocol(Protocol): + def data_received(self, data): ... + def eof_received(self): ... + def on_data(self, data): ... + def send(self, data, delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... diff --git a/src/typings/netius/base/request.pyi b/src/typings/netius/base/request.pyi index 1418c080..fbb5ab5d 100644 --- a/src/typings/netius/base/request.pyi +++ b/src/typings/netius/base/request.pyi @@ -1,48 +1,20 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -REQUEST_TIMEOUT = ... -class Request: - """ - Abstract request structure used to represent - a request in a server/client model, this allows - for easy identification and response (callback). - """ - IDENTIFIER = ... - def __init__(self, timeout=..., callback=...) -> None: - ... - - - -class Response: - """ - Top level abstract representation of a response to - be sent based on a previously created request, the - input of this object should be raw data and a relation - between the request and the response is required. - - The association/relation between the response and the - request should be done using the original request - generated identifier. - """ - def __init__(self, data, request=...) -> None: - ... - - def parse(self): # -> None: - ... - - def get_request(self): # -> None: - ... - - def get_id(self): - ... - - - +import netius.base.errors as errors +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +REQUEST_TIMEOUT: float + +class Request: + IDENTIFIER: ClassVar[int] = ... + def __init__(self, timeout: float = ..., callback: Incomplete | None = ...) -> None: ... + @classmethod + def _generate_id(cls): ... + +class Response: + def __init__(self, data, request: Incomplete | None = ...) -> None: ... + def parse(self): ... + def get_request(self): ... + def get_id(self): ... diff --git a/src/typings/netius/base/server.pyi b/src/typings/netius/base/server.pyi index d49f4d2c..071a692a 100644 --- a/src/typings/netius/base/server.pyi +++ b/src/typings/netius/base/server.pyi @@ -1,153 +1,125 @@ -""" -This type stub file was generated by pyright. -""" - -from .conn import * -from .common import * - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_SIZE_S = ... -BUFFER_SIZE_C = ... -class Server(Base): - def __init__(self, *args, **kwargs) -> None: - ... - - def welcome(self): # -> None: - ... - - def cleanup(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def serve(self, host=..., port=..., type=..., ipv6=..., ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., ssl_host=..., ssl_fingerprint=..., ssl_dump=..., setuid=..., backlog=..., load=..., start=..., env=...): - ... - - def socket_tcp(self, ssl=..., key_file=..., cer_file=..., ca_file=..., ca_root=..., ssl_verify=..., family=..., type=...): # -> SSLSocket | socket: - ... - - def socket_udp(self, family=..., type=...): # -> socket: - ... - - def on_serve(self): # -> None: - ... - - - -class DatagramServer(Server): - def __init__(self, *args, **kwargs) -> None: - ... - - def reads(self, reads, state=...): # -> None: - ... - - def writes(self, writes, state=...): # -> None: - ... - - def errors(self, errors, state=...): # -> None: - ... - - def serve(self, type=..., *args, **kwargs): # -> None: - ... - - def on_read(self, _socket): - ... - - def on_write(self, _socket): # -> None: - ... - - def on_error(self, _socket): # -> None: - ... - - def on_exception(self, exception): # -> None: - ... - - def on_expected(self, exception): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def ensure_write(self): # -> tuple[Any | Literal[-1, 0], int, Any, int, list[bool]] | Orderable | None: - ... - - def remove_write(self): # -> None: - ... - - def enable_read(self): # -> None: - ... - - def disable_read(self): # -> None: - ... - - def send(self, data, address, delay=..., callback=...): # -> None: - ... - - - -class StreamServer(Server): - def reads(self, reads, state=...): # -> None: - ... - - def writes(self, writes, state=...): # -> None: - ... - - def errors(self, errors, state=...): # -> None: - ... - - def serve(self, type=..., *args, **kwargs): # -> None: - ... - - def on_read_s(self, _socket): # -> None: - ... - - def on_write_s(self, _socket): # -> None: - ... - - def on_error_s(self, _socket): # -> None: - ... - - def on_read(self, _socket): - ... - - def on_write(self, _socket): # -> None: - ... - - def on_error(self, _socket): # -> None: - ... - - def on_exception(self, exception, connection): # -> None: - ... - - def on_exception_s(self, exception): # -> None: - ... - - def on_expected(self, exception, connection): # -> None: - ... - - def on_expected_s(self, exception): # -> None: - ... - - def on_upgrade(self, connection): # -> None: - ... - - def on_ssl(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_socket_c(self, socket_c, address): # -> None: - ... - - def on_socket_d(self, socket_c): # -> None: - ... - - - +import netius as netius +import netius.base.async_old as async_old +import netius.base.asynchronous as asynchronous +import netius.base.common +import netius.base.compat as compat +import netius.base.config as config +import netius.base.errors as errors +import netius.base.legacy as legacy +import netius.base.log as log +import netius.base.observer as observer +import netius.base.tls as tls +import netius.base.util as util +import netius.middleware as middleware +import socket +from _typeshed import Incomplete +from netius.base.async_neo import AwaitWrapper as AwaitWrapper, CoroutineWrapper as CoroutineWrapper, Future as Future, coroutine as coroutine, coroutine_return as coroutine_return, ensure_generator as ensure_generator, get_asyncio as get_asyncio, is_coroutine as is_coroutine, is_coroutine_native as is_coroutine_native, is_coroutine_object as is_coroutine_object, is_future as is_future, sleep as sleep, wait as wait +from netius.base.async_old import Executor as Executor, Handle as Handle, Task as Task, ThreadPoolExecutor as ThreadPoolExecutor, async_test as async_test, async_test_all as async_test_all, is_asynclib as is_asynclib, is_await as is_await, is_neo as is_neo, notify as notify, wakeup as wakeup +from netius.base.common import AbstractBase as AbstractBase, Base as Base, BaseThread as BaseThread, DiagBase as DiagBase, build_future as build_future, compat_loop as compat_loop, ensure as ensure, ensure_asyncio as ensure_asyncio, ensure_loop as ensure_loop, ensure_main as ensure_main, ensure_pool as ensure_pool, get_event_loop as get_event_loop, get_loop as get_loop, get_main as get_main, get_poll as get_poll, new_loop as new_loop, new_loop_asyncio as new_loop_asyncio, new_loop_main as new_loop_main, stop_loop as stop_loop +from netius.base.conn import BaseConnection as BaseConnection, Connection as Connection, DiagConnection as DiagConnection +from netius.base.poll import EpollPoll as EpollPoll, KqueuePoll as KqueuePoll, Poll as Poll, PollPoll as PollPoll, SelectPoll as SelectPoll + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int +CHUNK_SIZE: int +is_diag: bool +POLL_TIMEOUT: float +NAME: str +VERSION: str +PLATFORM: str +IDENTIFIER_TINY: str +IDENTIFIER_SHORT: str +IDENTIFIER_LONG: str +IDENTIFIER: str +WSAEWOULDBLOCK: int +WSAECONNABORTED: int +WSAECONNRESET: int +SSL_ERROR_CERT_ALREADY_IN_HASH_TABLE: int +POLL_ORDER: tuple +SILENT_ERRORS: tuple +VALID_ERRORS: tuple +SSL_SILENT_ERRORS: tuple +SSL_VALID_ERRORS: tuple +SSL_ERROR_NAMES: dict +SSL_VALID_REASONS: tuple +TCP_TYPE: int +UDP_TYPE: int +STATE_STOP: int +STATE_START: int +STATE_PAUSE: int +STATE_CONFIG: int +STATE_POLL: int +STATE_TICK: int +STATE_READ: int +STATE_WRITE: int +STATE_ERRROR: int +STATE_STRINGS: tuple +KEEPALIVE_TIMEOUT: int +KEEPALIVE_INTERVAL: int +KEEPALIVE_COUNT: int +ALLOW_BLOCK: bool +LOG_FORMAT: str +BASE_PATH: str +EXTRAS_PATH: str +SSL_KEY_PATH: str +SSL_CER_PATH: str +SSL_CA_PATH: None +SSL_DH_PATH: str +BUFFER_SIZE_S: None +BUFFER_SIZE_C: None + +class Server(netius.base.common.AbstractBase): + def __init__(self, *args, **kwargs) -> None: ... + def welcome(self): ... + def cleanup(self): ... + def info_dict(self, full: bool = ...): ... + def serve(self, host: Incomplete | None = ..., port: int = ..., type: int = ..., ipv6: bool = ..., ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., ssl_host: Incomplete | None = ..., ssl_fingerprint: Incomplete | None = ..., ssl_dump: bool = ..., setuid: Incomplete | None = ..., backlog: int = ..., load: bool = ..., start: bool = ..., env: bool = ...): ... + def socket_tcp(self, ssl: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., ca_file: Incomplete | None = ..., ca_root: bool = ..., ssl_verify: bool = ..., family: socket.AddressFamily = ..., type: socket.SocketKind = ...): ... + def socket_udp(self, family: socket.AddressFamily = ..., type: socket.SocketKind = ...): ... + def on_serve(self): ... + +class DatagramServer(Server): + def __init__(self, *args, **kwargs) -> None: ... + def reads(self, reads, state: bool = ...): ... + def writes(self, writes, state: bool = ...): ... + def errors(self, errors, state: bool = ...): ... + def serve(self, type: int = ..., *args, **kwargs): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception): ... + def on_expected(self, exception): ... + def on_data(self, address, data): ... + def ensure_write(self): ... + def remove_write(self): ... + def enable_read(self): ... + def disable_read(self): ... + def send(self, data, address, delay: bool = ..., callback: Incomplete | None = ...): ... + def _send(self, _socket): ... + def _flush_write(self): ... + +class StreamServer(Server): + def reads(self, reads, state: bool = ...): ... + def writes(self, writes, state: bool = ...): ... + def errors(self, errors, state: bool = ...): ... + def serve(self, type: int = ..., *args, **kwargs): ... + def on_read_s(self, _socket): ... + def on_write_s(self, _socket): ... + def on_error_s(self, _socket): ... + def on_read(self, _socket): ... + def on_write(self, _socket): ... + def on_error(self, _socket): ... + def on_exception(self, exception, connection): ... + def on_exception_s(self, exception): ... + def on_expected(self, exception, connection): ... + def on_expected_s(self, exception): ... + def on_upgrade(self, connection): ... + def on_ssl(self, connection): ... + def on_data(self, connection, data): ... + def on_socket_c(self, socket_c, address): ... + def on_socket_d(self, socket_c): ... + def _ssl_handshake(self, connection): ... diff --git a/src/typings/netius/base/stream.pyi b/src/typings/netius/base/stream.pyi index 7c4b3d18..4dfb2df5 100644 --- a/src/typings/netius/base/stream.pyi +++ b/src/typings/netius/base/stream.pyi @@ -1,54 +1,20 @@ -""" -This type stub file was generated by pyright. -""" - -from . import observer - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -OPEN = ... -CLOSED = ... -PENDING = ... -class Stream(observer.Observable): - """ - Abstract stream class responsible for the representation of - a "virtual" connection state for situation where multiplexing - of single connection exists (connections within connections) - - Most of the interface for a stream should be "logically" similar - to the one defined by a connection. - - A good example of the stream usage is the HTTP2 protocol where - multiple parallel streams co-exist within a single TCP connection - allowing huge performance improvements. - """ - def __init__(self, owner=...) -> None: - ... - - def reset(self): # -> None: - ... - - def open(self): # -> None: - ... - - def close(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, int]: - ... - - def is_open(self): # -> bool: - ... - - def is_closed(self): # -> bool: - ... - - def is_pending(self): # -> bool: - ... - - - +import netius.base.observer +import netius.base.observer as observer +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +OPEN: int +CLOSED: int +PENDING: int + +class Stream(netius.base.observer.Observable): + def __init__(self, owner: Incomplete | None = ...) -> None: ... + def reset(self): ... + def open(self): ... + def close(self): ... + def info_dict(self, full: bool = ...): ... + def is_open(self): ... + def is_closed(self): ... + def is_pending(self): ... diff --git a/src/typings/netius/base/tls.pyi b/src/typings/netius/base/tls.pyi index 1d598b32..a3e25c63 100644 --- a/src/typings/netius/base/tls.pyi +++ b/src/typings/netius/base/tls.pyi @@ -1,25 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def fingerprint(certificate, hash=...): # -> str: - ... - -def match_fingerprint(certificate, exp_fingerprint, hash=...): # -> None: - ... - -def match_hostname(certificate, hostname): # -> None: - ... - -def dnsname_match(domain, hostname, max_wildcards=...): # -> bool: - ... - -def dump_certificate(certificate, certificate_binary, name=...): # -> None: - ... - +import netius.base.config as config +import netius.base.errors as errors +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +def fingerprint(certificate, hash: str = ...): ... +def match_fingerprint(certificate, exp_fingerprint, hash: str = ...): ... +def match_hostname(certificate, hostname): ... +def dnsname_match(domain, hostname, max_wildcards: int = ...): ... +def dump_certificate(certificate, certificate_binary, name: Incomplete | None = ...): ... diff --git a/src/typings/netius/base/transport.pyi b/src/typings/netius/base/transport.pyi index 8f387755..715d6a61 100644 --- a/src/typings/netius/base/transport.pyi +++ b/src/typings/netius/base/transport.pyi @@ -1,120 +1,43 @@ -""" -This type stub file was generated by pyright. -""" - -from . import observer - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Transport(observer.Observable): - """ - Decorator class to be used to add the functionality of a - transport layer using a simplified and standard API. - - Allows adding the functionality to an internal netius - connection (or equivalent) object. - - This approach is heavily influenced by the design of the - asyncio Python infra-structure and should provide a mostly - compatible interface. - """ - def __init__(self, loop, connection, open=...) -> None: - ... - - def open(self): # -> None: - ... - - def close(self): # -> None: - ... - - def abort(self): # -> None: - ... - - def write(self, data): # -> None: - ... - - def sendto(self, data, addr=...): # -> None: - ... - - def get_extra_info(self, name, default=...): # -> None: - ... - - def get_write_buffer_size(self): - ... - - def get_write_buffer_limits(self): # -> tuple[Any, Any]: - ... - - def set_handlers(self): # -> None: - ... - - def set_write_buffer_limits(self, high=..., low=...): # -> None: - """ - Sets the write buffer limits in the underlying connection - object using the provided values. - - If the only one of the values is provided the other one is - going to be calculated using an hardcoded ratio value. - - :type high: int - :param high: The maximum number of bytes that can be set - waiting in the connection internal buffer waiting to be sent - before the connection becomes exhausted (sending blocked). - :type low: int - :param low: The maximum number of bytes waiting in the buffer - before the connection send buffer is unblocked. - """ - ... - - def set_extra_dict(self): # -> None: - ... - - def get_protocol(self): # -> None: - ... - - def set_protocol(self, protocol): # -> None: - ... - - def is_closing(self): # -> bool: - """ - Determines if the current transport/connection is closed - or is in the process of being closed. - - A transport is considered closed in case the underlying - connection object is not set or is closed. - - :rtype: bool - :return: If the current transport is closed or in the process - of being closed, if the connection is not set in the transport - it's also considered to be closing. - """ - ... - - - -class TransportDatagram(Transport): - """ - Abstract class to be used when creating a datagram based - (connectionless) transport. - - This implementation reflects the decisions made for the - netius based transport abstraction, inspired by asyncio. - """ - ... - - -class TransportStream(Transport): - """ - Abstract class to be used when creating a stream based - (connection) transport. - - This implementation reflects the decisions made for the - netius based transport abstraction, inspired by asyncio. - """ - ... - - +import netius.base.errors as errors +import netius.base.observer +import netius.base.observer as observer +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class Transport(netius.base.observer.Observable): + def __init__(self, loop, connection, open: bool = ...) -> None: ... + def open(self): ... + def close(self): ... + def abort(self): ... + def write(self, data): ... + def sendto(self, data, addr: Incomplete | None = ...): ... + def get_extra_info(self, name, default: Incomplete | None = ...): ... + def get_write_buffer_size(self): ... + def get_write_buffer_limits(self): ... + def set_handlers(self): ... + def set_write_buffer_limits(self, high: Incomplete | None = ..., low: Incomplete | None = ...): ... + def set_extra_dict(self): ... + def get_protocol(self): ... + def set_protocol(self, protocol): ... + def is_closing(self): ... + def _on_data(self, connection, data): ... + def _on_close(self, connection): ... + def _set_compat(self, protocol): ... + def _set_binds(self): ... + def _set_protocol(self, protocol, mark: bool = ...): ... + def _buffer_touched(self, connection): ... + def _handle_flow(self): ... + def _cleanup(self): ... + def _call_connection_lost(self, context): ... + def _call_soon(self, callback, *args): ... + +class TransportDatagram(Transport): + def _on_data(self, connection, data): ... + def _on_close(self, connection): ... + +class TransportStream(Transport): + def _on_data(self, connection, data): ... + def _on_close(self, connection): ... diff --git a/src/typings/netius/base/util.pyi b/src/typings/netius/base/util.pyi index 4d5d3120..4ae49a00 100644 --- a/src/typings/netius/base/util.pyi +++ b/src/typings/netius/base/util.pyi @@ -1,51 +1,8 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -FIRST_CAP_REGEX = ... -ALL_CAP_REGEX = ... -def camel_to_underscore(camel, separator=...): # -> str: - """ - Converts the provided camel cased based value into - a normalized underscore based string. - - This is useful as most of the python string standards - are compliant with the underscore strategy. - - :type camel: String - :param camel: The camel cased string that is going to be - converted into an underscore based string. - :type separator: String - :param separator: The separator token that is going to - be used in the camel to underscore conversion. - :rtype: String - :return: The underscore based string resulting from the - conversion of the provided camel cased one. - """ - ... - -def verify(condition, message=..., exception=...): # -> None: - """ - Ensures that the requested condition returns a valid value - and if that's no the case an exception raised breaking the - current execution logic. - - :type condition: bool - :param condition: The condition to be evaluated and that may - trigger an exception raising. - :type message: String - :param message: The message to be used in the building of the - exception that is going to be raised in case of condition failure. - :type exception: Class - :param exception: The exception class that is going to be used - to build the exception to be raised in case the condition - verification operation fails. - """ - ... - +import netius.base.errors as errors +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +def camel_to_underscore(camel, separator: str = ...): ... +def verify(condition, message: Incomplete | None = ..., exception: Incomplete | None = ...): ... diff --git a/src/typings/netius/clients/__init__.pyi b/src/typings/netius/clients/__init__.pyi index 42a0d6b3..0e37b2d9 100644 --- a/src/typings/netius/clients/__init__.pyi +++ b/src/typings/netius/clients/__init__.pyi @@ -1,21 +1,17 @@ -""" -This type stub file was generated by pyright. -""" - -from . import apn, dht, dns, http, mjpg, raw, smtp, ssdp, torrent, ws -from .apn import APNClient, APNProtocol -from .dht import DHTClient, DHTRequest, DHTResponse -from .dns import DNSClient, DNSProtocol, DNSRequest, DNSResponse -from .http import HTTPClient, HTTPProtocol -from .mjpg import MJPGClient, MJPGProtocol -from .raw import RawClient, RawProtocol -from .smtp import SMTPClient, SMTPConnection -from .ssdp import SSDPClient, SSDPProtocol -from .torrent import CHOKED, TorrentClient, TorrentConnection, UNCHOKED -from .ws import WSClient, WSProtocol - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import apn as apn, dht as dht, dns as dns, http as http, mjpg as mjpg, raw as raw, smtp as smtp, ssdp as ssdp, torrent as torrent, ws as ws +from netius.clients.apn import APNClient as APNClient, APNProtocol as APNProtocol +from netius.clients.dht import DHTClient as DHTClient, DHTRequest as DHTRequest, DHTResponse as DHTResponse +from netius.clients.dns import DNSClient as DNSClient, DNSProtocol as DNSProtocol, DNSRequest as DNSRequest, DNSResponse as DNSResponse +from netius.clients.http import HTTPClient as HTTPClient, HTTPProtocol as HTTPProtocol +from netius.clients.mjpg import MJPGClient as MJPGClient, MJPGProtocol as MJPGProtocol +from netius.clients.raw import RawClient as RawClient, RawProtocol as RawProtocol +from netius.clients.smtp import SMTPClient as SMTPClient, SMTPConnection as SMTPConnection +from netius.clients.ssdp import SSDPClient as SSDPClient, SSDPProtocol as SSDPProtocol +from netius.clients.torrent import TorrentClient as TorrentClient, TorrentConnection as TorrentConnection +from netius.clients.ws import WSClient as WSClient, WSProtocol as WSProtocol + +__version__: str +__revision__: str +__date__: str +CHOKED: int +UNCHOKED: int diff --git a/src/typings/netius/clients/apn.pyi b/src/typings/netius/clients/apn.pyi index 588a4db1..241787de 100644 --- a/src/typings/netius/clients/apn.pyi +++ b/src/typings/netius/clients/apn.pyi @@ -1,59 +1,34 @@ -""" -This type stub file was generated by pyright. -""" - -import netius - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class APNProtocol(netius.StreamProtocol): - """ - Protocol class that defines the interface to operate - an apple push notifications (APN) protocol that is - able to send push notifications to Apple devices. - - Should be compliant with a simple message oriented - interface for easy of usage from developers. - """ - HOST = ... - PORT = ... - SANDBOX_HOST = ... - SANDBOX_PORT = ... - def __init__(self, *args, **kwargs) -> None: - ... - - def connection_made(self, transport): # -> None: - ... - - def send_notification(self, token, message, sound=..., badge=..., close=...): # -> None: - ... - - def set(self, token, message, sound=..., badge=..., sandbox=..., key_file=..., cer_file=..., _close=...): # -> None: - ... - - def notify(self, token, loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | None, Self]: - ... - - - -class APNClient(netius.ClientAgent): - protocol = APNProtocol - @classmethod - def notify_s(cls, token, loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - - -if __name__ == "__main__": - def on_finish(protocol): # -> None: - ... - - token = ... - key_file = ... - cer_file = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class APNProtocol(netius.base.protocol.StreamProtocol): + HOST: ClassVar[str] = ... + PORT: ClassVar[int] = ... + SANDBOX_HOST: ClassVar[str] = ... + SANDBOX_PORT: ClassVar[int] = ... + def __init__(self, *args, **kwargs) -> None: ... + def connection_made(self, transport): ... + def send_notification(self, token, message, sound: str = ..., badge: int = ..., close: bool = ...): ... + def set(self, token, message, sound: str = ..., badge: int = ..., sandbox: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., _close: bool = ...): ... + def notify(self, token, loop: Incomplete | None = ..., **kwargs): ... + +class APNClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.StreamProtocol): + HOST: ClassVar[str] = ... + PORT: ClassVar[int] = ... + SANDBOX_HOST: ClassVar[str] = ... + SANDBOX_PORT: ClassVar[int] = ... + def __init__(self, *args, **kwargs) -> None: ... + def connection_made(self, transport): ... + def send_notification(self, token, message, sound: str = ..., badge: int = ..., close: bool = ...): ... + def set(self, token, message, sound: str = ..., badge: int = ..., sandbox: bool = ..., key_file: Incomplete | None = ..., cer_file: Incomplete | None = ..., _close: bool = ...): ... + def notify(self, token, loop: Incomplete | None = ..., **kwargs): ... + @classmethod + def notify_s(cls, token, loop: Incomplete | None = ..., **kwargs): ... diff --git a/src/typings/netius/clients/dht.pyi b/src/typings/netius/clients/dht.pyi index 47723cdd..22d69498 100644 --- a/src/typings/netius/clients/dht.pyi +++ b/src/typings/netius/clients/dht.pyi @@ -1,86 +1,35 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DHTRequest(netius.Request): - def __init__(self, peer_id, host=..., port=..., type=..., callback=..., *args, **kwargs) -> None: - ... - - @classmethod - def contact(cls, host, port): # -> bytes: - ... - - def request(self): # -> bytes: - ... - - def ping(self): # -> dict[str, Any | bytes]: - ... - - def find_node(self): # -> dict[str, Any | bytes]: - ... - - def get_peers(self): # -> dict[str, Any | bytes]: - ... - - def announce_peer(self): # -> dict[str, Any | bytes]: - ... - - - -class DHTResponse(netius.Response): - def __init__(self, data) -> None: - ... - - def parse(self): # -> None: - ... - - def get_id(self): # -> int: - ... - - def get_payload(self): - ... - - def is_error(self): - ... - - def is_response(self): - ... - - - -class DHTClient(netius.DatagramClient): - """ - Implementation of the DHT (Distributed hash table) for the torrent - protocol as the defined in the official specification. - - This implementation is meant to be used in an asynchronous environment - for maximum performance. - - :see: http://www.bittorrent.org/beps/bep_0005.html - """ - def ping(self, host, port, peer_id, *args, **kwargs): # -> None: - ... - - def find_node(self, *args, **kwargs): # -> None: - ... - - def get_peers(self, *args, **kwargs): # -> None: - ... - - def query(self, host=..., port=..., peer_id=..., type=..., callback=..., *args, **kwargs): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def on_data_dht(self, address, response): # -> None: - ... - - - +import netius as netius +import netius.base.client +import netius.base.request +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class DHTRequest(netius.base.request.Request): + def __init__(self, peer_id, host: str = ..., port: int = ..., type: str = ..., callback: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def contact(cls, host, port): ... + def request(self): ... + def ping(self): ... + def find_node(self): ... + def get_peers(self): ... + def announce_peer(self): ... + def _get_peer_id(self): ... + +class DHTResponse(netius.base.request.Response): + def __init__(self, data) -> None: ... + def parse(self): ... + def get_id(self): ... + def get_payload(self): ... + def is_error(self): ... + def is_response(self): ... + +class DHTClient(netius.base.client.DatagramClient): + def ping(self, host, port, peer_id, *args, **kwargs): ... + def find_node(self, *args, **kwargs): ... + def get_peers(self, *args, **kwargs): ... + def query(self, host: str = ..., port: int = ..., peer_id: Incomplete | None = ..., type: str = ..., callback: Incomplete | None = ..., *args, **kwargs): ... + def on_data(self, address, data): ... + def on_data_dht(self, address, response): ... diff --git a/src/typings/netius/clients/dns.pyi b/src/typings/netius/clients/dns.pyi index a9d1d087..82fe2dd3 100644 --- a/src/typings/netius/clients/dns.pyi +++ b/src/typings/netius/clients/dns.pyi @@ -1,141 +1,84 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -DNS_QUERY = ... -DNS_RESPONSE = ... -DNS_SQUERY = ... -DNS_IQUERY = ... -DNS_STATUS = ... -DNS_AA = ... -DNS_TC = ... -DNS_RD = ... -DNS_TYPES = ... -DNS_CLASSES = ... -DNS_TYPES_R = ... -DNS_CLASSES_R = ... -class DNSRequest(netius.Request): - def __init__(self, name, type=..., cls=..., callback=...) -> None: - ... - - def request(self): # -> bytes: - ... - - - -class DNSResponse(netius.Response): - def parse(self): # -> None: - ... - - def get_id(self): # -> Any: - ... - - def parse_qd(self, data, index): # -> tuple[Any, tuple[bytes, str, str]]: - ... - - def parse_an(self, data, index): # -> tuple[Any, tuple[bytes, str, str, Any, Any]]: - ... - - def parse_payload(self, data, index, type_s): # -> Any: - ... - - def parse_a(self, data, index): # -> tuple[Any, str]: - ... - - def parse_aaaa(self, data, index): # -> tuple[Any, LiteralString]: - ... - - def parse_mx(self, data, index): # -> tuple[Any, tuple[Any, bytes]]: - ... - - def parse_cname(self, data, index): # -> tuple[Any, bytes]: - ... - - def parse_ns(self, data, index): # -> None: - ... - - def parse_ar(self, data, index): # -> None: - ... - - def parse_label(self, data, index): # -> tuple[Any, bytes]: - ... - - def parse_pointer(self, data, index): # -> tuple[Any, Any]: - ... - - def parse_ip4(self, data, index): # -> tuple[Any, str]: - ... - - def parse_ip6(self, data, index): # -> tuple[Any, LiteralString]: - ... - - def parse_byte(self, data, index): # -> tuple[Any, Any]: - ... - - def parse_short(self, data, index): # -> tuple[Any, Any]: - ... - - def parse_long(self, data, index): # -> tuple[Any, Any]: - ... - - def parse_long_long(self, data, index): # -> tuple[Any, Any]: - ... - - - -class DNSProtocol(netius.DatagramProtocol): - ns_file_l = ... - @classmethod - def ns_system(cls, type=...): # -> str | None: - ... - - @classmethod - def ns_conf(cls, type=..., force=...): # -> list[Any]: - ... - - @classmethod - def ns_file(cls, type=..., force=...): # -> list[Any] | None: - ... - - @classmethod - def ns_google(cls, type=...): # -> list[str] | list[Any]: - ... - - @classmethod - def ns_cloudfare(cls, type=...): # -> list[str] | list[Any]: - ... - - def query(self, name, type=..., cls=..., ns=..., callback=...): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def on_data_dns(self, address, response): # -> None: - ... - - - -class DNSClient(netius.ClientAgent): - protocol = DNSProtocol - @classmethod - def query_s(cls, name, type=..., cls_=..., ns=..., callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - - -if __name__ == "__main__": - def handler(response): # -> None: - ... - - name = ... - type = ... - ns = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +import netius.base.request +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +DNS_QUERY: int +DNS_RESPONSE: int +DNS_SQUERY: int +DNS_IQUERY: int +DNS_STATUS: int +DNS_AA: int +DNS_TC: int +DNS_RD: int +DNS_TYPES: dict +DNS_CLASSES: dict +DNS_TYPES_R: dict +DNS_CLASSES_R: dict + +class DNSRequest(netius.base.request.Request): + def __init__(self, name, type: str = ..., cls: str = ..., callback: Incomplete | None = ...) -> None: ... + def request(self): ... + def _query(self, name, type: str = ..., cls: str = ...): ... + def _label(self, value): ... + +class DNSResponse(netius.base.request.Response): + def parse(self): ... + def get_id(self): ... + def parse_qd(self, data, index): ... + def parse_an(self, data, index): ... + def parse_payload(self, data, index, type_s): ... + def parse_a(self, data, index): ... + def parse_aaaa(self, data, index): ... + def parse_mx(self, data, index): ... + def parse_cname(self, data, index): ... + def parse_ns(self, data, index): ... + def parse_ar(self, data, index): ... + def parse_label(self, data, index): ... + def parse_pointer(self, data, index): ... + def parse_ip4(self, data, index): ... + def parse_ip6(self, data, index): ... + def parse_byte(self, data, index): ... + def parse_short(self, data, index): ... + def parse_long(self, data, index): ... + def parse_long_long(self, data, index): ... + +class DNSProtocol(netius.base.protocol.DatagramProtocol): + ns_file_l: ClassVar[None] = ... + @classmethod + def ns_system(cls, type: str = ...): ... + @classmethod + def ns_conf(cls, type: str = ..., force: bool = ...): ... + @classmethod + def ns_file(cls, type: str = ..., force: bool = ...): ... + @classmethod + def ns_google(cls, type: str = ...): ... + @classmethod + def ns_cloudfare(cls, type: str = ...): ... + def query(self, name, type: str = ..., cls: str = ..., ns: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def on_data(self, address, data): ... + def on_data_dns(self, address, response): ... + +class DNSClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.DatagramProtocol): + ns_file_l: ClassVar[None] = ... + @classmethod + def ns_system(cls, type: str = ...): ... + @classmethod + def ns_conf(cls, type: str = ..., force: bool = ...): ... + @classmethod + def ns_file(cls, type: str = ..., force: bool = ...): ... + @classmethod + def ns_google(cls, type: str = ...): ... + @classmethod + def ns_cloudfare(cls, type: str = ...): ... + def query(self, name, type: str = ..., cls: str = ..., ns: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def on_data(self, address, data): ... + def on_data_dns(self, address, response): ... + @classmethod + def query_s(cls, name, type: str = ..., cls_: str = ..., ns: Incomplete | None = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ...): ... diff --git a/src/typings/netius/clients/http.pyi b/src/typings/netius/clients/http.pyi index 7276bc4a..9f5cc585 100644 --- a/src/typings/netius/clients/http.pyi +++ b/src/typings/netius/clients/http.pyi @@ -1,286 +1,164 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -Z_PARTIAL_FLUSH = ... -class HTTPProtocol(netius.StreamProtocol): - """ - Implementation of the HTTP protocol to be used by a client - of the HTTP implementation to send requests and receive - responses. - """ - BASE_HEADERS = ... - def __init__(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., asynchronous=..., timeout=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., *args, **kwargs) -> None: - ... - - @classmethod - def key_g(cls, url): # -> tuple[Any, Any | Literal[443, 80], Any]: - ... - - @classmethod - def decode_gzip(cls, data): # -> bytes: - ... - - @classmethod - def decode_deflate(cls, data): # -> bytes: - ... - - @classmethod - def decode_zlib_file(cls, input, output, buffer_size=..., wbits=...): - ... - - @classmethod - def decode_gzip_file(cls, input, output, buffer_size=..., wbits=...): - ... - - @classmethod - def decode_deflate_file(cls, input, output, buffer_size=..., wbits=...): - ... - - @classmethod - def set_request(cls, parser, buffer, request=...): # -> dict[Any, Any]: - ... - - @classmethod - def set_request_file(cls, parser, input, request=..., output=..., buffer_size=...): # -> dict[Any, Any]: - ... - - @classmethod - def set_error(cls, error, message=..., request=..., force=...): # -> dict[Any, Any] | None: - ... - - def open_c(self, *args, **kwargs): # -> None: - ... - - def close_c(self, *args, **kwargs): # -> None: - ... - - def info_dict(self, full=...): # -> dict[Any, Any]: - ... - - def connection_made(self, transport): # -> None: - ... - - def loop_set(self, loop): # -> None: - ... - - def flush(self, force=..., callback=...): # -> None: - ... - - def send_base(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int | None: - ... - - def send_plain(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int: - ... - - def send_chunked(self, data, stream=..., final=..., delay=..., force=..., callback=...): # -> int: - ... - - def send_gzip(self, data, stream=..., final=..., delay=..., force=..., callback=..., level=...): # -> int: - ... - - def set(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., asynchronous=..., timeout=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=...): # -> Self: - ... - - def set_all(self): # -> None: - ... - - def set_static(self): # -> None: - ... - - def set_dynamic(self): # -> None: - ... - - def run_request(self): # -> None: - ... - - def send_request(self, callback=...): - ... - - def wrap_request(self, use_file=..., callback=..., on_close=..., on_data=..., on_result=...): # -> tuple[dict[str, None], Callable[..., None], Callable[..., None], Callable[..., None]]: - """ - Wraps the current set of operations for the protocol so that - a request object is going to be created and properly populated - according to the multiple protocol events. - - This method should focus on wrapping the provided callback handlers - with ones that change the request object state. - - :type use_file: bool - :param use_file: If a filesystem based approach should be used - for the storing of the request information. - :type callback: Function - :param callback: Callback function to be called when the message - response has been completely received. - :type on_close: Function - :param on_close: Callback function to be called when the underlying - protocol is closed. - :type on_data: Function - :param on_data: Function to be called whenever some data is received - from the client side, notice that this data may be encoded (eg: gzip). - :type on_result: Function - :param on_result: Callback function to be called on the final result - with the resulting request object. - :rtype: Tuple - :return: The tuple containing both the request dictionary object that - is going to store the information for the request in the current protocol - and the multiple changed callback methods. - """ - ... - - def set_headers(self, headers, normalize=...): # -> None: - ... - - def normalize_headers(self): # -> None: - ... - - def parse(self, data): # -> int | Any: - ... - - def raw_data(self, data): # -> bytes: - """ - Tries to obtain the raw version of the provided data, taking - into account the possible content encoding present for compression - or any other kind of operation. - - :type data: String - :param data: The data to be converted back to its original - raw value (probably through decompression). - :rtype: String - :return: The final raw value for the provided data. - """ - ... - - def is_plain(self): # -> bool: - ... - - def is_chunked(self): # -> bool: - ... - - def is_gzip(self): # -> bool: - ... - - def is_deflate(self): # -> bool: - ... - - def is_compressed(self): # -> bool: - ... - - def is_uncompressed(self): # -> bool: - ... - - def is_flushed(self): # -> bool: - ... - - def is_measurable(self, strict=...): # -> bool: - ... - - def on_data(self, data): # -> None: - ... - - def on_partial(self, data): # -> None: - ... - - def on_headers(self): # -> None: - ... - - def on_chunk(self, range): # -> None: - ... - - - -class HTTPClient(netius.ClientAgent): - """ - Simple test of an HTTP client, supports a series of basic - operations and makes use of the HTTP parser from netius. - - The current implementation supports the auto-release of the - connection once the message has been received, this is optional - and may be disabled with an argument in the constructor. - """ - protocol = HTTPProtocol - def __init__(self, auto_release=..., *args, **kwargs) -> None: - ... - - @classmethod - def get_s(cls, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - @classmethod - def post_s(cls, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - @classmethod - def put_s(cls, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - @classmethod - def delete_s(cls, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - @classmethod - def method_s(cls, method, url, params=..., headers=..., data=..., version=..., safe=..., asynchronous=..., daemon=..., timeout=..., ssl_verify=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., http_client=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - @classmethod - def to_response(cls, map, raise_e=...): # -> HTTPResponse: - """ - Simple utility method that takes the classic dictionary - based request and converts it into a simple HTTP response - object to be used in a more interactive way. - - :type map: Dictionary - :param map: The dictionary backed request object that is - going to be converted into a response. - :type raise_e: bool - :param raise_e: If an exception should be raised in case - there's an error in the HTTP status field. - :rtype: HTTPResponse - :return: The normalized response value. - """ - ... - - def cleanup(self): # -> None: - ... - - def get(self, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - def post(self, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - def put(self, url, params=..., headers=..., data=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - def delete(self, url, params=..., headers=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - def method(self, method, url, params=..., headers=..., data=..., version=..., encoding=..., encodings=..., safe=..., request=..., close=..., asynchronous=..., timeout=..., ssl_verify=..., use_file=..., callback=..., on_init=..., on_open=..., on_close=..., on_headers=..., on_data=..., on_result=..., loop=..., **kwargs): # -> tuple[Any | AbstractEventLoop | CompatLoop | AbstractBase | DiagBase | None, protocol | Any] | dict[str, None] | None: - ... - - - -if __name__ == "__main__": - buffer = ... - def on_headers(protocol, parser): # -> None: - ... - - def on_partial(protocol, parser, data): # -> None: - ... - - def on_message(protocol, parser, message): # -> None: - ... - - def on_finish(protocol): # -> None: - ... - - url = ... - client = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +PLAIN_ENCODING: int +CHUNKED_ENCODING: int +GZIP_ENCODING: int +DEFLATE_ENCODING: int +Z_PARTIAL_FLUSH: int + +class HTTPProtocol(netius.base.protocol.StreamProtocol): + BASE_HEADERS: ClassVar[dict] = ... + def __init__(self, method, url, params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., version: str = ..., encoding: int = ..., encodings: str = ..., safe: bool = ..., request: bool = ..., asynchronous: bool = ..., timeout: Incomplete | None = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def key_g(cls, url): ... + @classmethod + def decode_gzip(cls, data): ... + @classmethod + def decode_deflate(cls, data): ... + @classmethod + def decode_zlib_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def decode_gzip_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def decode_deflate_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def set_request(cls, parser, buffer, request: Incomplete | None = ...): ... + @classmethod + def set_request_file(cls, parser, input, request: Incomplete | None = ..., output: Incomplete | None = ..., buffer_size: int = ...): ... + @classmethod + def set_error(cls, error, message: Incomplete | None = ..., request: Incomplete | None = ..., force: bool = ...): ... + def open_c(self, *args, **kwargs): ... + def close_c(self, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + def connection_made(self, transport): ... + def loop_set(self, loop): ... + def flush(self, force: bool = ..., callback: Incomplete | None = ...): ... + def send_base(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_plain(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_chunked(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_gzip(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ..., level: int = ...): ... + def set(self, method, url, params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., version: str = ..., encoding: int = ..., encodings: str = ..., safe: bool = ..., request: bool = ..., asynchronous: bool = ..., timeout: Incomplete | None = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ...): ... + def set_all(self): ... + def set_static(self): ... + def set_dynamic(self): ... + def run_request(self): ... + def send_request(self, callback: Incomplete | None = ...): ... + def wrap_request(self, use_file: bool = ..., callback: Incomplete | None = ..., on_close: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ...): ... + def set_headers(self, headers, normalize: bool = ...): ... + def normalize_headers(self): ... + def parse(self, data): ... + def raw_data(self, data): ... + def is_plain(self): ... + def is_chunked(self): ... + def is_gzip(self): ... + def is_deflate(self): ... + def is_compressed(self): ... + def is_uncompressed(self): ... + def is_flushed(self): ... + def is_measurable(self, strict: bool = ...): ... + def on_data(self, data): ... + def _on_data(self): ... + def on_partial(self, data): ... + def on_headers(self): ... + def on_chunk(self, range): ... + def _flush_plain(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _flush_chunked(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _flush_gzip(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _close_gzip(self, safe: bool = ...): ... + def _apply_base(self, headers, replace: bool = ...): ... + def _apply_dynamic(self, headers): ... + def _apply_connection(self, headers, strict: bool = ...): ... + def _headers_normalize(self, headers): ... + +class HTTPClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.StreamProtocol): + BASE_HEADERS: ClassVar[dict] = ... + def __init__(self, method, url, params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., version: str = ..., encoding: int = ..., encodings: str = ..., safe: bool = ..., request: bool = ..., asynchronous: bool = ..., timeout: Incomplete | None = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def key_g(cls, url): ... + @classmethod + def decode_gzip(cls, data): ... + @classmethod + def decode_deflate(cls, data): ... + @classmethod + def decode_zlib_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def decode_gzip_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def decode_deflate_file(cls, input, output, buffer_size: int = ..., wbits: int = ...): ... + @classmethod + def set_request(cls, parser, buffer, request: Incomplete | None = ...): ... + @classmethod + def set_request_file(cls, parser, input, request: Incomplete | None = ..., output: Incomplete | None = ..., buffer_size: int = ...): ... + @classmethod + def set_error(cls, error, message: Incomplete | None = ..., request: Incomplete | None = ..., force: bool = ...): ... + def open_c(self, *args, **kwargs): ... + def close_c(self, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + def connection_made(self, transport): ... + def loop_set(self, loop): ... + def flush(self, force: bool = ..., callback: Incomplete | None = ...): ... + def send_base(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_plain(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_chunked(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def send_gzip(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., force: bool = ..., callback: Incomplete | None = ..., level: int = ...): ... + def set(self, method, url, params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., version: str = ..., encoding: int = ..., encodings: str = ..., safe: bool = ..., request: bool = ..., asynchronous: bool = ..., timeout: Incomplete | None = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ...): ... + def set_all(self): ... + def set_static(self): ... + def set_dynamic(self): ... + def run_request(self): ... + def send_request(self, callback: Incomplete | None = ...): ... + def wrap_request(self, use_file: bool = ..., callback: Incomplete | None = ..., on_close: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ...): ... + def set_headers(self, headers, normalize: bool = ...): ... + def normalize_headers(self): ... + def parse(self, data): ... + def raw_data(self, data): ... + def is_plain(self): ... + def is_chunked(self): ... + def is_gzip(self): ... + def is_deflate(self): ... + def is_compressed(self): ... + def is_uncompressed(self): ... + def is_flushed(self): ... + def is_measurable(self, strict: bool = ...): ... + def on_data(self, data): ... + def _on_data(self): ... + def on_partial(self, data): ... + def on_headers(self): ... + def on_chunk(self, range): ... + def _flush_plain(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _flush_chunked(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _flush_gzip(self, force: bool = ..., callback: Incomplete | None = ...): ... + def _close_gzip(self, safe: bool = ...): ... + def _apply_base(self, headers, replace: bool = ...): ... + def _apply_dynamic(self, headers): ... + def _apply_connection(self, headers, strict: bool = ...): ... + def _headers_normalize(self, headers): ... + def __init__(self, auto_release: bool = ..., *args, **kwargs) -> None: ... + @classmethod + def get_s(cls, url, params: dict = ..., headers: dict = ..., **kwargs): ... + @classmethod + def post_s(cls, url, params: dict = ..., headers: dict = ..., data: Incomplete | None = ..., **kwargs): ... + @classmethod + def put_s(cls, url, params: dict = ..., headers: dict = ..., data: Incomplete | None = ..., **kwargs): ... + @classmethod + def delete_s(cls, url, params: dict = ..., headers: dict = ..., **kwargs): ... + @classmethod + def method_s(cls, method, url, params: dict = ..., headers: dict = ..., data: Incomplete | None = ..., version: str = ..., safe: bool = ..., asynchronous: bool = ..., daemon: bool = ..., timeout: Incomplete | None = ..., ssl_verify: bool = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ..., http_client: Incomplete | None = ..., **kwargs): ... + @classmethod + def to_response(cls, map, raise_e: bool = ...): ... + def cleanup(self): ... + def get(self, url, params: dict = ..., headers: dict = ..., **kwargs): ... + def post(self, url, params: dict = ..., headers: dict = ..., data: Incomplete | None = ..., **kwargs): ... + def put(self, url, params: dict = ..., headers: dict = ..., data: Incomplete | None = ..., **kwargs): ... + def delete(self, url, params: dict = ..., headers: dict = ..., **kwargs): ... + def method(self, method, url, params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., version: str = ..., encoding: int = ..., encodings: str = ..., safe: bool = ..., request: bool = ..., close: bool = ..., asynchronous: bool = ..., timeout: Incomplete | None = ..., ssl_verify: bool = ..., use_file: bool = ..., callback: Incomplete | None = ..., on_init: Incomplete | None = ..., on_open: Incomplete | None = ..., on_close: Incomplete | None = ..., on_headers: Incomplete | None = ..., on_data: Incomplete | None = ..., on_result: Incomplete | None = ..., loop: Incomplete | None = ..., **kwargs): ... + def _get_loop(self, **kwargs): ... + def _close_loop(self): ... diff --git a/src/typings/netius/clients/mjpg.pyi b/src/typings/netius/clients/mjpg.pyi index 006ecea2..31bc2544 100644 --- a/src/typings/netius/clients/mjpg.pyi +++ b/src/typings/netius/clients/mjpg.pyi @@ -1,49 +1,27 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class MJPGProtocol(http.HTTPProtocol): - MAGIC_JPEG = ... - EOI_JPEG = ... - def __init__(self, *args, **kwargs) -> None: - ... - - def add_buffer(self, data): # -> None: - ... - - def get_buffer(self, delete=...): # -> bytes: - ... - - def on_partial(self, data): # -> None: - ... - - def on_frame_mjpg(self, data): # -> None: - ... - - - -class MJPGClient(http.HTTPClient): - protocol = MJPGProtocol - - -if __name__ == "__main__": - index = ... - limit = ... - def on_frame(protocol, data): # -> None: - ... - - def on_finish(protocol): # -> None: - ... - - url = ... - client = ... -else: - __path__ = ... +import netius as netius +import netius.clients.http +import netius.clients.http as http +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class MJPGProtocol(netius.clients.http.HTTPProtocol): + MAGIC_JPEG: ClassVar[bytes] = ... + EOI_JPEG: ClassVar[bytes] = ... + def __init__(self, *args, **kwargs) -> None: ... + def add_buffer(self, data): ... + def get_buffer(self, delete: bool = ...): ... + def on_partial(self, data): ... + def on_frame_mjpg(self, data): ... + +class MJPGClient(netius.clients.http.HTTPClient): + class protocol(netius.clients.http.HTTPProtocol): + MAGIC_JPEG: ClassVar[bytes] = ... + EOI_JPEG: ClassVar[bytes] = ... + def __init__(self, *args, **kwargs) -> None: ... + def add_buffer(self, data): ... + def get_buffer(self, delete: bool = ...): ... + def on_partial(self, data): ... + def on_frame_mjpg(self, data): ... diff --git a/src/typings/netius/clients/raw.pyi b/src/typings/netius/clients/raw.pyi index adc82d0d..0223cf45 100644 --- a/src/typings/netius/clients/raw.pyi +++ b/src/typings/netius/clients/raw.pyi @@ -1,42 +1,17 @@ -""" -This type stub file was generated by pyright. -""" - -import netius - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class RawProtocol(netius.StreamProtocol): - def send_basic(self): # -> None: - """ - Sends a basic HTTP 1.0 request, that can be used to - run a simple operation on the raw protocol. - """ - ... - - - -class RawClient(netius.ClientAgent): - protocol = RawProtocol - @classmethod - def run_s(cls, host, port=..., loop=..., *args, **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - - -if __name__ == "__main__": - def on_open(protocol): # -> None: - ... - - def on_data(protocol, data): # -> None: - ... - - def on_finsh(protocol): # -> None: - ... - -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class RawProtocol(netius.base.protocol.StreamProtocol): + def send_basic(self): ... + +class RawClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.StreamProtocol): + def send_basic(self): ... + @classmethod + def run_s(cls, host, port: int = ..., loop: Incomplete | None = ..., *args, **kwargs): ... diff --git a/src/typings/netius/clients/smtp.pyi b/src/typings/netius/clients/smtp.pyi index 1beb4d4d..d29a78d1 100644 --- a/src/typings/netius/clients/smtp.pyi +++ b/src/typings/netius/clients/smtp.pyi @@ -1,229 +1,88 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -HELO_STATE = ... -EHLO_STATE = ... -CAPA_STATE = ... -STLS_STATE = ... -UPGRADE_STATE = ... -AUTH_STATE = ... -USERNAME_STATE = ... -PASSWORD_STATE = ... -FROM_STATE = ... -TO_STATE = ... -DATA_STATE = ... -CONTENTS_STATE = ... -QUIT_STATE = ... -FINAL_STATE = ... -class SMTPConnection(netius.Connection): - AUTH_METHODS = ... - def __init__(self, host=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def build(self): # -> None: - """ - Builds the initial set of states ordered according to - their internal integer definitions, this method provides - a fast and scalable way of parsing data. - """ - ... - - def destroy(self): # -> None: - """ - Destroys the current structure for the stats meaning that - it's restored to the original values, this method should only - be called on situation where no more client usage is required. - """ - ... - - def set_smtp(self, froms, tos, contents, username=..., password=...): # -> None: - ... - - def set_sequence(self, sequence, safe=...): # -> None: - ... - - def set_message_seq(self, ehlo=...): # -> None: - ... - - def set_message_stls_seq(self, ehlo=...): # -> None: - ... - - def set_capabilities(self, capabilities, force=...): # -> None: - ... - - def next_sequence(self): # -> None: - ... - - def parse(self, data): # -> int: - ... - - def send_smtp(self, code, message=..., delay=..., callback=...): # -> int: - ... - - def on_line(self, code, message, is_final=...): # -> None: - ... - - def call(self): # -> None: - ... - - def skip(self): # -> None: - ... - - def helo_t(self): # -> None: - ... - - def ehlo_t(self): # -> None: - ... - - def capa_t(self): # -> None: - ... - - def stls_t(self): # -> None: - ... - - def upgrade_t(self): # -> None: - ... - - def auth_t(self): # -> None: - ... - - def username_t(self): # -> None: - ... - - def password_t(self): # -> None: - ... - - def mail_t(self): # -> None: - ... - - def rcpt_t(self): # -> None: - ... - - def data_t(self): # -> None: - ... - - def contents_t(self): # -> None: - ... - - def quit_t(self): # -> None: - ... - - def close_t(self): # -> None: - ... - - def pass_t(self): # -> None: - ... - - def helo(self, host): # -> None: - ... - - def ehlo(self, host): # -> None: - ... - - def starttls(self): # -> None: - ... - - def auth(self, username, password, method=...): # -> None: - ... - - def auth_plain(self, username, password): # -> None: - ... - - def auth_login(self, username, password): # -> None: - ... - - def login_username(self, username): # -> None: - ... - - def login_password(self, password): # -> None: - ... - - def mail(self, value): # -> None: - ... - - def rcpt(self, value): # -> None: - ... - - def data(self): # -> None: - ... - - def quit(self): # -> None: - ... - - def set_expected(self, expected): # -> None: - ... - - def assert_c(self, code): # -> None: - ... - - def assert_s(self, expected): # -> None: - ... - - def best_auth(self): # -> Literal['plain']: - ... - - - -class SMTPClient(netius.StreamClient): - def __init__(self, host=..., auto_close=..., *args, **kwargs) -> None: - ... - - @classmethod - def message_s(cls, froms, tos, contents, daemon=..., host=..., mark=..., callback=...): # -> None: - ... - - def message(self, froms, tos, contents, host=..., port=..., username=..., password=..., ehlo=..., stls=..., mark=..., ensure_loop=..., callback=...): # -> None: - ... - - def on_connect(self, connection): # -> None: - ... - - def on_upgrade(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> SMTPConnection: - ... - - def mark(self, contents): # -> str: - ... - - def date(self, message): # -> None: - ... - - def user_agent(self, message): # -> None: - ... - - - -if __name__ == "__main__": - sender = ... - receiver = ... - host = ... - port = ... - username = ... - password = ... - stls = ... - mime = ... - contents = ... - client = ... -else: - __path__ = ... +import netius as netius +import netius.base.client +import netius.base.conn +import netius.clients.dns as dns +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +HELO_STATE: int +EHLO_STATE: int +CAPA_STATE: int +STLS_STATE: int +UPGRADE_STATE: int +AUTH_STATE: int +USERNAME_STATE: int +PASSWORD_STATE: int +FROM_STATE: int +TO_STATE: int +DATA_STATE: int +CONTENTS_STATE: int +QUIT_STATE: int +FINAL_STATE: int + +class SMTPConnection(netius.base.conn.BaseConnection): + AUTH_METHODS: ClassVar[tuple] = ... + def __init__(self, host: str = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def build(self): ... + def destroy(self): ... + def set_smtp(self, froms, tos, contents, username: Incomplete | None = ..., password: Incomplete | None = ...): ... + def set_sequence(self, sequence, safe: bool = ...): ... + def set_message_seq(self, ehlo: bool = ...): ... + def set_message_stls_seq(self, ehlo: bool = ...): ... + def set_capabilities(self, capabilities, force: bool = ...): ... + def next_sequence(self): ... + def parse(self, data): ... + def send_smtp(self, code, message: str = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def on_line(self, code, message, is_final: bool = ...): ... + def call(self): ... + def skip(self): ... + def helo_t(self): ... + def ehlo_t(self): ... + def capa_t(self): ... + def stls_t(self): ... + def upgrade_t(self): ... + def auth_t(self): ... + def username_t(self): ... + def password_t(self): ... + def mail_t(self): ... + def rcpt_t(self): ... + def data_t(self): ... + def contents_t(self): ... + def quit_t(self): ... + def close_t(self): ... + def pass_t(self): ... + def helo(self, host): ... + def ehlo(self, host): ... + def starttls(self): ... + def auth(self, username, password, method: str = ...): ... + def auth_plain(self, username, password): ... + def auth_login(self, username, password): ... + def login_username(self, username): ... + def login_password(self, password): ... + def mail(self, value): ... + def rcpt(self, value): ... + def data(self): ... + def quit(self): ... + def set_expected(self, expected): ... + def assert_c(self, code): ... + def assert_s(self, expected): ... + def best_auth(self): ... + +class SMTPClient(netius.base.client.StreamClient): + def __init__(self, host: Incomplete | None = ..., auto_close: bool = ..., *args, **kwargs) -> None: ... + @classmethod + def message_s(cls, froms, tos, contents, daemon: bool = ..., host: Incomplete | None = ..., mark: bool = ..., callback: Incomplete | None = ...): ... + def message(self, froms, tos, contents, host: Incomplete | None = ..., port: int = ..., username: Incomplete | None = ..., password: Incomplete | None = ..., ehlo: bool = ..., stls: bool = ..., mark: bool = ..., ensure_loop: bool = ..., callback: Incomplete | None = ...): ... + def on_connect(self, connection): ... + def on_upgrade(self, connection): ... + def on_data(self, connection, data): ... + def on_connection_d(self, connection): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def mark(self, contents): ... + def date(self, message): ... + def user_agent(self, message): ... diff --git a/src/typings/netius/clients/ssdp.pyi b/src/typings/netius/clients/ssdp.pyi index 3fb761bc..1a6860fb 100644 --- a/src/typings/netius/clients/ssdp.pyi +++ b/src/typings/netius/clients/ssdp.pyi @@ -1,54 +1,25 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class SSDPProtocol(netius.DatagramProtocol): - """ - Protocol implementation of the SSDP protocol meant to be - used under the UPnP standard for discovery and control of - internet activated devices. - - Using this implementation it should be possible to discover - and control devices like routes, media centers, etc. - - :see: http://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol - """ - def on_data(self, address, data): # -> None: - ... - - def on_headers_parser(self): # -> None: - ... - - def discover(self, target, *args, **kwargs): # -> None: - ... - - def method(self, method, target, namespace, mx=..., path=..., params=..., headers=..., data=..., host=..., port=..., version=..., callback=...): # -> None: - ... - - - -class SSDPClient(netius.ClientAgent): - protocol = SSDPProtocol - @classmethod - def discover_s(cls, target, *args, **kwargs): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - @classmethod - def method_s(cls, method, target, namespace, mx=..., path=..., params=..., headers=..., data=..., host=..., port=..., version=..., callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - - -if __name__ == "__main__": - def on_headers(client, parser, headers): # -> None: - ... - - target = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class SSDPProtocol(netius.base.protocol.DatagramProtocol): + def on_data(self, address, data): ... + def on_headers_parser(self): ... + def discover(self, target, *args, **kwargs): ... + def method(self, method, target, namespace, mx: int = ..., path: str = ..., params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., host: str = ..., port: int = ..., version: str = ..., callback: Incomplete | None = ...): ... + +class SSDPClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.DatagramProtocol): + def on_data(self, address, data): ... + def on_headers_parser(self): ... + def discover(self, target, *args, **kwargs): ... + def method(self, method, target, namespace, mx: int = ..., path: str = ..., params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., host: str = ..., port: int = ..., version: str = ..., callback: Incomplete | None = ...): ... + @classmethod + def discover_s(cls, target, *args, **kwargs): ... + @classmethod + def method_s(cls, method, target, namespace, mx: int = ..., path: str = ..., params: Incomplete | None = ..., headers: Incomplete | None = ..., data: Incomplete | None = ..., host: str = ..., port: int = ..., version: str = ..., callback: Incomplete | None = ..., loop: Incomplete | None = ...): ... diff --git a/src/typings/netius/clients/torrent.pyi b/src/typings/netius/clients/torrent.pyi index d17a1a1b..80acc308 100644 --- a/src/typings/netius/clients/torrent.pyi +++ b/src/typings/netius/clients/torrent.pyi @@ -1,132 +1,51 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -HANDSHAKE_STATE = ... -NORMAL_STATE = ... -CHOKED = ... -UNCHOKED = ... -ALIVE_TIMEOUT = ... -SPEED_LIMIT = ... -BLOCK_SIZE = ... -class TorrentConnection(netius.Connection): - def __init__(self, max_requests=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def on_close(self, connection): # -> None: - ... - - def on_handshake(self, protocol, reserved, info_hash, peer_id): # -> None: - ... - - def on_message(self, length, type, data): # -> None: - ... - - def parse(self, data): # -> None: - ... - - def handle(self, type, data): # -> None: - ... - - def bitfield_t(self, data): # -> None: - ... - - def choke_t(self, data): # -> None: - ... - - def unchoke_t(self, data): # -> None: - ... - - def piece_t(self, data): # -> None: - ... - - def port_t(self, data): # -> None: - ... - - def next(self, count=...): # -> None: - ... - - def add_request(self, block): # -> None: - ... - - def remove_request(self, block): # -> None: - ... - - def reset(self): # -> None: - ... - - def release(self): # -> None: - ... - - def handshake(self): # -> None: - ... - - def keep_alive(self): # -> None: - ... - - def choke(self): # -> None: - ... - - def unchoke(self): # -> None: - ... - - def interested(self): # -> None: - ... - - def not_interested(self): # -> None: - ... - - def have(self, index): # -> None: - ... - - def request(self, index, begin=..., length=...): # -> None: - ... - - def is_alive(self, timeout=..., schedule=...): # -> Callable[[], None]: - ... - - - -class TorrentClient(netius.StreamClient): - """ - Implementation of the torrent protocol, able to download - and seed files across a peer to peer mesh network. - - The client provides a series of top level methods that - provide the main interface with the system. - - The current implementation support both a torrent file - (using trackers) strategy and also a DHT (distributed - has table) strategy for completely decentralized usage. - - :see: http://www.bittorrent.org/beps/bep_0003.html - """ - def peer(self, task, host, port, ssl=..., connection=...): - ... - - def on_connect(self, connection): # -> None: - ... - - def on_acquire(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> TorrentConnection: - ... - - - +import netius as netius +import netius.base.client +import netius.base.conn +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +HANDSHAKE_STATE: int +NORMAL_STATE: int +CHOKED: int +UNCHOKED: int +ALIVE_TIMEOUT: float +SPEED_LIMIT: int +BLOCK_SIZE: int + +class TorrentConnection(netius.base.conn.BaseConnection): + def __init__(self, max_requests: int = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def on_close(self, connection): ... + def on_handshake(self, protocol, reserved, info_hash, peer_id): ... + def on_message(self, length, type, data): ... + def parse(self, data): ... + def handle(self, type, data): ... + def bitfield_t(self, data): ... + def choke_t(self, data): ... + def unchoke_t(self, data): ... + def piece_t(self, data): ... + def port_t(self, data): ... + def next(self, count: Incomplete | None = ...): ... + def add_request(self, block): ... + def remove_request(self, block): ... + def reset(self): ... + def release(self): ... + def handshake(self): ... + def keep_alive(self): ... + def choke(self): ... + def unchoke(self): ... + def interested(self): ... + def not_interested(self): ... + def have(self, index): ... + def request(self, index, begin: int = ..., length: int = ...): ... + def is_alive(self, timeout: float = ..., schedule: bool = ...): ... + +class TorrentClient(netius.base.client.StreamClient): + def peer(self, task, host, port, ssl: bool = ..., connection: Incomplete | None = ...): ... + def on_connect(self, connection): ... + def on_acquire(self, connection): ... + def on_data(self, connection, data): ... + def build_connection(self, socket, address, ssl: bool = ...): ... diff --git a/src/typings/netius/clients/ws.pyi b/src/typings/netius/clients/ws.pyi index ad02b288..89ebe797 100644 --- a/src/typings/netius/clients/ws.pyi +++ b/src/typings/netius/clients/ws.pyi @@ -1,77 +1,46 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class WSProtocol(netius.StreamProtocol): - """ - Abstract WebSockets protocol to be used for real-time bidirectional - communication on top of the HTTP protocol. - - :see: https://tools.ietf.org/html/rfc6455 - """ - MAGIC_VALUE = ... - def __init__(self, *args, **kwargs) -> None: - ... - - def connection_made(self, transport): # -> None: - ... - - def on_data(self, data): # -> None: - ... - - def on_data_ws(self, data): # -> None: - ... - - def on_handshake(self): # -> None: - ... - - def connect_ws(self, url, callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, Self]: - ... - - def send_ws(self, data, callback=...): # -> int: - ... - - def receive_ws(self, decoded): # -> None: - ... - - def add_buffer(self, data): # -> None: - ... - - def get_buffer(self, delete=...): # -> bytes: - ... - - def do_handshake(self): # -> None: - ... - - def validate_key(self): # -> None: - ... - - - -class WSClient(netius.ClientAgent): - protocol = WSProtocol - @classmethod - def connect_ws_s(cls, url, callback=..., loop=...): # -> tuple[Any | AbstractEventLoop | None, protocol]: - ... - - - -if __name__ == "__main__": - def on_handshake(protocol): # -> None: - ... - - def on_message(protocol, data): # -> None: - ... - - def on_close(protocol): # -> None: - ... - - url = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class WSProtocol(netius.base.protocol.StreamProtocol): + MAGIC_VALUE: ClassVar[str] = ... + @classmethod + def _key(cls, size: int = ...): ... + def __init__(self, *args, **kwargs) -> None: ... + def connection_made(self, transport): ... + def on_data(self, data): ... + def on_data_ws(self, data): ... + def on_handshake(self): ... + def connect_ws(self, url, callback: Incomplete | None = ..., loop: Incomplete | None = ...): ... + def send_ws(self, data, callback: Incomplete | None = ...): ... + def receive_ws(self, decoded): ... + def add_buffer(self, data): ... + def get_buffer(self, delete: bool = ...): ... + def do_handshake(self): ... + def validate_key(self): ... + +class WSClient(netius.base.agent.ClientAgent): + class protocol(netius.base.protocol.StreamProtocol): + MAGIC_VALUE: ClassVar[str] = ... + @classmethod + def _key(cls, size: int = ...): ... + def __init__(self, *args, **kwargs) -> None: ... + def connection_made(self, transport): ... + def on_data(self, data): ... + def on_data_ws(self, data): ... + def on_handshake(self): ... + def connect_ws(self, url, callback: Incomplete | None = ..., loop: Incomplete | None = ...): ... + def send_ws(self, data, callback: Incomplete | None = ...): ... + def receive_ws(self, decoded): ... + def add_buffer(self, data): ... + def get_buffer(self, delete: bool = ...): ... + def do_handshake(self): ... + def validate_key(self): ... + @classmethod + def connect_ws_s(cls, url, callback: Incomplete | None = ..., loop: Incomplete | None = ...): ... diff --git a/src/typings/netius/common/__init__.pyi b/src/typings/netius/common/__init__.pyi index fe58737c..5a946002 100644 --- a/src/typings/netius/common/__init__.pyi +++ b/src/typings/netius/common/__init__.pyi @@ -1,34 +1,83 @@ -""" -This type stub file was generated by pyright. -""" - -from . import asn, calc, dhcp, dkim, ftp, geo, http, http2, mime, parser, pop, rsa, setup, smtp, socks, stream, structures, style, tftp, tls, torrent, util, ws -from .asn import asn1_build, asn1_gen, asn1_length, asn1_parse -from .calc import ceil_integer, egcd, gcd, is_prime, jacobi, jacobi_witness, modinv, prime, random_integer_interval, random_primality, relatively_prime -from .dhcp import ACK_DHCP, AddressPool, BROADCAST_DHCP, DECLINE_DHCP, DISCOVER_DHCP, DNS_DHCP, END_DHCP, IDENTIFIER_DHCP, LEASE_DHCP, NAK_DHCP, NAME_DHCP, OFFER_DHCP, OPTIONS_DHCP, PROXY_DHCP, REBIND_DHCP, RENEWAL_DHCP, REQUESTED_DHCP, REQUEST_DHCP, ROUTER_DHCP, SUBNET_DHCP, TYPES_DHCP, VERBS_DHCP -from .dkim import dkim_body, dkim_fold, dkim_generate, dkim_headers, dkim_sign -from .ftp import FTPParser -from .geo import GeoResolver -from .http import CHUNKED_ENCODING, CODE_STRINGS, DEFLATE_ENCODING, GZIP_ENCODING, HTTPParser, HTTPResponse, HTTP_09, HTTP_10, HTTP_11, PLAIN_ENCODING, REQUEST, RESPONSE, VERSIONS_MAP -from .http2 import CONTINUATION, DATA, GOAWAY, HEADERS, HTTP2Parser, HTTP2Stream, HTTP2_NAMES, HTTP2_PREFACE, HTTP2_SETTINGS, HTTP2_SETTINGS_OPTIMAL, HTTP2_SETTINGS_OPTIMAL_T, HTTP2_SETTINGS_T, HTTP2_TUPLES, HTTP2_WINDOW, PING, PRIORITY, PUSH_PROMISE, RST_STREAM, SETTINGS, WINDOW_UPDATE -from .mime import mime_register, rfc822_join, rfc822_parse -from .parser import Parser -from .pop import POPParser -from .rsa import asn_private_key, asn_public_key, assert_private, open_pem_data, open_pem_key, open_private_key, open_private_key_b64, open_private_key_data, open_public_key, open_public_key_b64, open_public_key_data, pem_limiters, pem_to_der, private_to_public, rsa_bits, rsa_crypt, rsa_crypt_s, rsa_exponents, rsa_primes, rsa_private, rsa_sign, rsa_verify, write_pem_key, write_private_key, write_public_key -from .setup import ensure_ca, ensure_setup -from .smtp import SMTPParser -from .socks import SOCKSParser -from .tls import LetsEncryptDict, TLSContextDict -from .stream import FileStream, FilesStream, Stream -from .structures import PriorityDict, file_iterator -from .style import BASE_STYLE -from .tftp import ACK_TFTP, DATA_TFTP, ERROR_TFTP, RRQ_TFTP, TYPES_TFTP, WRQ_TFTP -from .torrent import TorrentParser, bdecode, bencode, chunk, dechunk, info_hash -from .util import addr_to_ip4, addr_to_ip6, assert_ip4, bytes_to_integer, chunks, cstring, header_down, header_up, host, hostname, in_subnet_ip4, integer_to_bytes, ip4_to_addr, is_ip4, is_ip6, random_integer, size_round_unit, string_to_bits, verify, verify_equal, verify_many, verify_not_equal, verify_type -from .ws import assert_ws, decode_ws, encode_ws - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import asn as asn, calc as calc, dhcp as dhcp, dkim as dkim, ftp as ftp, geo as geo, http as http, http2 as http2, mime as mime, parser as parser, pop as pop, rsa as rsa, setup as setup, smtp as smtp, socks as socks, stream as stream, structures as structures, style as style, tftp as tftp, tls as tls, torrent as torrent, util as util, ws as ws +from netius.common.asn import asn1_build as asn1_build, asn1_gen as asn1_gen, asn1_length as asn1_length, asn1_parse as asn1_parse +from netius.common.calc import ceil_integer as ceil_integer, egcd as egcd, gcd as gcd, is_prime as is_prime, jacobi as jacobi, jacobi_witness as jacobi_witness, modinv as modinv, prime as prime, random_integer_interval as random_integer_interval, random_primality as random_primality, relatively_prime as relatively_prime +from netius.common.dhcp import AddressPool as AddressPool +from netius.common.dkim import dkim_body as dkim_body, dkim_fold as dkim_fold, dkim_generate as dkim_generate, dkim_headers as dkim_headers, dkim_sign as dkim_sign +from netius.common.ftp import FTPParser as FTPParser +from netius.common.geo import GeoResolver as GeoResolver +from netius.common.http import HTTPParser as HTTPParser, HTTPResponse as HTTPResponse +from netius.common.http2 import HTTP2Parser as HTTP2Parser, HTTP2Stream as HTTP2Stream +from netius.common.mime import mime_register as mime_register, rfc822_join as rfc822_join, rfc822_parse as rfc822_parse +from netius.common.parser import Parser as Parser +from netius.common.pop import POPParser as POPParser +from netius.common.rsa import asn_private_key as asn_private_key, asn_public_key as asn_public_key, assert_private as assert_private, open_pem_data as open_pem_data, open_pem_key as open_pem_key, open_private_key as open_private_key, open_private_key_b64 as open_private_key_b64, open_private_key_data as open_private_key_data, open_public_key as open_public_key, open_public_key_b64 as open_public_key_b64, open_public_key_data as open_public_key_data, pem_limiters as pem_limiters, pem_to_der as pem_to_der, private_to_public as private_to_public, rsa_bits as rsa_bits, rsa_crypt as rsa_crypt, rsa_crypt_s as rsa_crypt_s, rsa_exponents as rsa_exponents, rsa_primes as rsa_primes, rsa_private as rsa_private, rsa_sign as rsa_sign, rsa_verify as rsa_verify, write_pem_key as write_pem_key, write_private_key as write_private_key, write_public_key as write_public_key +from netius.common.setup import ensure_ca as ensure_ca, ensure_setup as ensure_setup +from netius.common.smtp import SMTPParser as SMTPParser +from netius.common.socks import SOCKSParser as SOCKSParser +from netius.common.stream import FileStream as FileStream, FilesStream as FilesStream, Stream as Stream +from netius.common.structures import PriorityDict as PriorityDict, file_iterator as file_iterator +from netius.common.tls import LetsEncryptDict as LetsEncryptDict, TLSContextDict as TLSContextDict +from netius.common.torrent import TorrentParser as TorrentParser, bdecode as bdecode, bencode as bencode, chunk as chunk, dechunk as dechunk, info_hash as info_hash +from netius.common.util import addr_to_ip4 as addr_to_ip4, addr_to_ip6 as addr_to_ip6, assert_ip4 as assert_ip4, bytes_to_integer as bytes_to_integer, chunks as chunks, cstring as cstring, header_down as header_down, header_up as header_up, host as host, hostname as hostname, in_subnet_ip4 as in_subnet_ip4, integer_to_bytes as integer_to_bytes, ip4_to_addr as ip4_to_addr, is_ip4 as is_ip4, is_ip6 as is_ip6, random_integer as random_integer, size_round_unit as size_round_unit, string_to_bits as string_to_bits, verify as verify, verify_equal as verify_equal, verify_many as verify_many, verify_not_equal as verify_not_equal, verify_type as verify_type +from netius.common.ws import assert_ws as assert_ws, decode_ws as decode_ws, encode_ws as encode_ws + +__version__: str +__revision__: str +__date__: str +SUBNET_DHCP: int +ROUTER_DHCP: int +DNS_DHCP: int +NAME_DHCP: int +BROADCAST_DHCP: int +REQUESTED_DHCP: int +LEASE_DHCP: int +DISCOVER_DHCP: int +OFFER_DHCP: int +REQUEST_DHCP: int +DECLINE_DHCP: int +ACK_DHCP: int +NAK_DHCP: int +IDENTIFIER_DHCP: int +RENEWAL_DHCP: int +REBIND_DHCP: int +PROXY_DHCP: int +END_DHCP: int +OPTIONS_DHCP: dict +TYPES_DHCP: dict +VERBS_DHCP: dict +REQUEST: int +RESPONSE: int +PLAIN_ENCODING: int +CHUNKED_ENCODING: int +GZIP_ENCODING: int +DEFLATE_ENCODING: int +HTTP_09: int +HTTP_10: int +HTTP_11: int +VERSIONS_MAP: dict +CODE_STRINGS: dict +DATA: int +HEADERS: int +PRIORITY: int +RST_STREAM: int +SETTINGS: int +PUSH_PROMISE: int +PING: int +GOAWAY: int +WINDOW_UPDATE: int +CONTINUATION: int +HTTP2_WINDOW: int +HTTP2_PREFACE: bytes +HTTP2_TUPLES: tuple +HTTP2_NAMES: dict +HTTP2_SETTINGS: dict +HTTP2_SETTINGS_OPTIMAL: dict +HTTP2_SETTINGS_T: list +HTTP2_SETTINGS_OPTIMAL_T: list +BASE_STYLE: str +RRQ_TFTP: int +WRQ_TFTP: int +DATA_TFTP: int +ACK_TFTP: int +ERROR_TFTP: int +TYPES_TFTP: dict diff --git a/src/typings/netius/common/asn.pyi b/src/typings/netius/common/asn.pyi index ca9ef7ca..705c38a0 100644 --- a/src/typings/netius/common/asn.pyi +++ b/src/typings/netius/common/asn.pyi @@ -1,66 +1,22 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -INTEGER = ... -BIT_STRING = ... -OCTET_STRING = ... -NULL = ... -OBJECT_IDENTIFIER = ... -SEQUENCE = ... -ASN1_OBJECT = ... -ASN1_RSA_PUBLIC_KEY = ... -ASN1_RSA_PRIVATE_KEY = ... -RSAID_PKCS1 = ... -HASHID_SHA1 = ... -HASHID_SHA256 = ... -def asn1_parse(template, data): # -> list[Any]: - """ - Parse a data structure according to asn.1 template, - the provided template should respect the predefined - structure. The provided data is going to be validated - against the template format and a exception raised in - case the data is not conformant. - - :type template: List/Tuple - :param template: A list of tuples comprising the asn.1 template. - :type: List - :param data: A list of bytes to parse. - """ - ... - -def asn1_length(length): # -> _bytes | str: - """ - Returns a string representing a field length in asn.1 format. - This value is computed taking into account the multiple byte - representation of very large values. - - :type length: int - :param length:The integer based length value that is going to - be used in the conversion to a string representation. - :rtype: String - :return: The string based representation of the provided length - integer value according to the asn.1 specification. - """ - ... - -def asn1_gen(node): # -> bytes: - ... - -def asn1_build(node): # -> Generator[Any, Any, None]: - """ - Builds an asn.1 data structure based on pairs of (type, data), - this function may be used as a generator of a buffer. - - :type node: Tuple - :param node: The root node of the structure that is going to be - used as reference for the generation of the asn.1 buffer. - """ - ... - +import netius as netius +import netius.common.util as util + +__version__: str +__revision__: str +__date__: str +INTEGER: int +BIT_STRING: int +OCTET_STRING: int +NULL: int +OBJECT_IDENTIFIER: int +SEQUENCE: int +ASN1_OBJECT: list +ASN1_RSA_PUBLIC_KEY: list +ASN1_RSA_PRIVATE_KEY: list +RSAID_PKCS1: bytes +HASHID_SHA1: bytes +HASHID_SHA256: bytes +def asn1_parse(template, data): ... +def asn1_length(length): ... +def asn1_gen(node): ... +def asn1_build(node): ... diff --git a/src/typings/netius/common/calc.pyi b/src/typings/netius/common/calc.pyi index 5a17cfcd..3ce33865 100644 --- a/src/typings/netius/common/calc.pyi +++ b/src/typings/netius/common/calc.pyi @@ -1,160 +1,17 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def prime(number_bits): - """ - Generates a prime number with the given number of bits - in length. This is a brute force based generation as a - random number is generated and then tested for primality. - - :type number_bits: int - :param number_bits: The number of bits to be used in - the prime number generation. - :rtype: int - :return: The generated prime number, that should have - been verified for primality. - """ - ... - -def is_prime(number): # -> bool: - ... - -def relatively_prime(first, second): - ... - -def gcd(first, second): - """ - Calculates the greatest common divisor of p value and q value. - This method uses the classic euclidean algorithm. - - :type first: int - :param first: The first number to obtain the greatest - common divisor using the euclidean algorithm. - :type second: int - :param second: The second number to obtain the greatest - common divisor using the euclidean algorithm. - :rtype: int - :return: The greatest common divisor between both values. - :see: http://en.wikipedia.org/wiki/Euclidean_algorithm - """ - ... - -def egcd(first, second): # -> tuple[Any, Literal[1], Literal[0]] | tuple[Any, Any, Any]: - """ - Extended version of the greatest common divisor created - by Euclid. Computes additional coefficients of the - Bézout's identity. - - :type first: int - :param first: The first number to obtain the greatest - common divisor using the euclidean algorithm. - :type second: int - :param second: The second number to obtain the greatest - common divisor using the euclidean algorithm. - :rtype: Tuple - :return: A tuple containing the various coefficients calculated - for this extended approach of the greatest common divisor. - :see: http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm - """ - ... - -def modinv(first, second): - """ - Uses the extended greatest common divisor algorithm to compute - the modulus of an inverted value against another. - - The execution of this method is equivalent to (1 / first mod second) - using mathematical terms. - - :type first: int - :param first: The first value, that is going to be inverted before - the modulus operation is performed. - :type second: int - :param second: The second value that is going to be used as the basis - for the modulus operation. - :rtype: int - :return: The result of the computation of inverted modulus according - to its mathematical definition. - """ - ... - -def random_integer_interval(min_value, max_value): - ... - -def random_primality(number, k): # -> bool: - """ - Uses a probabilistic approach to the testing of primality - of a number. The resulting value has an error probability - of (2 ** -k), so a k value should be chosen taking a low - error as target. - - :type number: int - :param number: The value that is going to be tested for - primality. - :type k: int - :param k: The coefficient that is going to be used in the - test, the higher this value is the small the error is. - :see: http://en.wikipedia.org/wiki/Solovay%E2%80%93Strassen_primality_test - """ - ... - -def jacobi_witness(x, n): # -> bool: - """ - Checks if the given x value is witness to n value - non primality. - This check is made according to euler's theorem. - The provided value x is considered to be a witness - to n in case it is an euler's pseudo-prime with base x - - :type x: int - :param x: The value to be checked for witness. - :type n: int - :param n: The value to be checked for primality. - :rtype: bool - :return: The result of the checking, if it passed - the test or not (is witness or not). - """ - ... - -def jacobi(a, b): # -> int: - """ - Calculates the value of the jacobi symbol, using the - given a and b values. - - The possible return values for jacobi symbols are: - -1, 0 or 1. - - :type a: int - :param a: The a value of the jacobi symbol. - :type b: int - :param b: The b value of the jacobi symbol. - :rtype: int - :return: The calculated jacobi symbol, possible values - are: -1, 0 or 1. - :see: http://en.wikipedia.org/wiki/Jacobi_symbol - """ - ... - -def ceil_integer(value): # -> int: - """ - Retrieves the ceil of a value and then converts it - into a valid integer for integer computation. - The conversion to integer ensures that the ceil - is compatible with certain (integer) operations. - - :type value: int - :param value: The value to apply the ceil and that - will latter be converted into a valid integer. - :rtype: int - :return: The ceil of the given value "casted" as an - integer to be able to be used in integer math. - """ - ... - +import netius as netius +import netius.common.util as util + +__version__: str +__revision__: str +__date__: str +def prime(number_bits): ... +def is_prime(number): ... +def relatively_prime(first, second): ... +def gcd(first, second): ... +def egcd(first, second): ... +def modinv(first, second): ... +def random_integer_interval(min_value, max_value): ... +def random_primality(number, k): ... +def jacobi_witness(x, n): ... +def jacobi(a, b): ... +def ceil_integer(value): ... diff --git a/src/typings/netius/common/dhcp.pyi b/src/typings/netius/common/dhcp.pyi index 8e147f28..86a9b2b4 100644 --- a/src/typings/netius/common/dhcp.pyi +++ b/src/typings/netius/common/dhcp.pyi @@ -1,62 +1,40 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SUBNET_DHCP = ... -ROUTER_DHCP = ... -DNS_DHCP = ... -NAME_DHCP = ... -BROADCAST_DHCP = ... -REQUESTED_DHCP = ... -LEASE_DHCP = ... -DISCOVER_DHCP = ... -OFFER_DHCP = ... -REQUEST_DHCP = ... -DECLINE_DHCP = ... -ACK_DHCP = ... -NAK_DHCP = ... -IDENTIFIER_DHCP = ... -RENEWAL_DHCP = ... -REBIND_DHCP = ... -PROXY_DHCP = ... -END_DHCP = ... -OPTIONS_DHCP = ... -TYPES_DHCP = ... -VERBS_DHCP = ... -class AddressPool: - def __init__(self, start_addr, end_addr) -> None: - ... - - @classmethod - def get_next(cls, current): # -> str: - ... - - def peek(self): - ... - - def reserve(self, owner=..., lease=...): - ... - - def touch(self, addr, lease=...): # -> None: - ... - - def exists(self, addr): # -> bool: - ... - - def assigned(self, owner): - ... - - def is_valid(self, addr): - ... - - def is_owner(self, owner, addr): # -> Literal[False]: - ... - - - +import netius as netius +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +SUBNET_DHCP: int +ROUTER_DHCP: int +DNS_DHCP: int +NAME_DHCP: int +BROADCAST_DHCP: int +REQUESTED_DHCP: int +LEASE_DHCP: int +DISCOVER_DHCP: int +OFFER_DHCP: int +REQUEST_DHCP: int +DECLINE_DHCP: int +ACK_DHCP: int +NAK_DHCP: int +IDENTIFIER_DHCP: int +RENEWAL_DHCP: int +REBIND_DHCP: int +PROXY_DHCP: int +END_DHCP: int +OPTIONS_DHCP: dict +TYPES_DHCP: dict +VERBS_DHCP: dict + +class AddressPool: + def __init__(self, start_addr, end_addr) -> None: ... + @classmethod + def get_next(cls, current): ... + def peek(self): ... + def reserve(self, owner: Incomplete | None = ..., lease: int = ...): ... + def touch(self, addr, lease: int = ...): ... + def exists(self, addr): ... + def assigned(self, owner): ... + def is_valid(self, addr): ... + def is_owner(self, owner, addr): ... + def _populate(self): ... diff --git a/src/typings/netius/common/dkim.pyi b/src/typings/netius/common/dkim.pyi index f456c1ff..c9e36e2c 100644 --- a/src/typings/netius/common/dkim.pyi +++ b/src/typings/netius/common/dkim.pyi @@ -1,42 +1,15 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def dkim_sign(message, selector, domain, private_key, identity=..., separator=..., creation=...): - ... - -def dkim_headers(headers): - ... - -def dkim_body(body): # -> bytes: - ... - -def dkim_fold(header, length=...): - """ - Folds a header line into multiple line feed separated lines - at column length defined (defaults to 72). - - This is required so that the header field is defined according - to the dkim rules and the default mime encoding. - - :type header: String - :param header: The string value of the header that is going to - be folded into multiple lines. - :type length: int - :param length: The maximum length of a column until it gets - broken into multiple lines (in case it's possible). - :rtype: String - :return: The folded string value for the header after the correct - processing of the string value. - """ - ... - -def dkim_generate(domain, suffix=..., number_bits=...): # -> dict[str, bytes | str | Any]: - ... - +import netius as netius +import netius.common.asn as asn +import netius.common.mime as mime +import netius.common.rsa as rsa +import netius.common.util as util +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +def dkim_sign(message, selector, domain, private_key, identity: Incomplete | None = ..., separator: str = ..., creation: Incomplete | None = ...): ... +def dkim_headers(headers): ... +def dkim_body(body): ... +def dkim_fold(header, length: int = ...): ... +def dkim_generate(domain, suffix: Incomplete | None = ..., number_bits: int = ...): ... diff --git a/src/typings/netius/common/ftp.pyi b/src/typings/netius/common/ftp.pyi index e45cc4a2..5518f099 100644 --- a/src/typings/netius/common/ftp.pyi +++ b/src/typings/netius/common/ftp.pyi @@ -1,34 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SEPARATOR_REGEX = ... -class FTPParser(parser.Parser): - def __init__(self, owner, store=...) -> None: - ... - - def parse(self, data): # -> int: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser + +__version__: str +__revision__: str +__date__: str + +class FTPParser(netius.common.parser.Parser): + def __init__(self, owner, store: bool = ...) -> None: ... + def parse(self, data): ... + def _parse_line(self, data): ... diff --git a/src/typings/netius/common/geo.pyi b/src/typings/netius/common/geo.pyi index 553e9387..3f438dff 100644 --- a/src/typings/netius/common/geo.pyi +++ b/src/typings/netius/common/geo.pyi @@ -1,26 +1,27 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class GeoResolver: - DB_NAME = ... - DOWNLOAD_URL = ... - VALID = ... - PREFIXES = ... - _db = ... - @classmethod - def resolve(cls, address, simplified=...): # -> None: - ... - - - -if __name__ == "__main__": - prefix = ... -else: - __path__ = ... +import netius as netius +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class GeoResolver: + DB_NAME: ClassVar[str] = ... + DOWNLOAD_URL: ClassVar[str] = ... + VALID: ClassVar[tuple] = ... + PREFIXES: ClassVar[tuple] = ... + _db: ClassVar[None] = ... + @classmethod + def resolve(cls, address, simplified: bool = ...): ... + @classmethod + def _simplify(cls, result, locale: str = ..., valid: tuple = ...): ... + @classmethod + def _get_db(cls): ... + @classmethod + def _try_all(cls, prefixes: tuple = ...): ... + @classmethod + def _try_db(cls, path: str = ..., download: bool = ...): ... + @classmethod + def _download_db(cls, path: str = ...): ... + @classmethod + def _store_db(cls, contents, path: str = ...): ... diff --git a/src/typings/netius/common/http.pyi b/src/typings/netius/common/http.pyi index 3464fa73..930c0ee9 100644 --- a/src/typings/netius/common/http.pyi +++ b/src/typings/netius/common/http.pyi @@ -1,210 +1,59 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -FILE_LIMIT = ... -REQUEST = ... -RESPONSE = ... -LINE_STATE = ... -HEADERS_STATE = ... -MESSAGE_STATE = ... -FINISH_STATE = ... -PLAIN_ENCODING = ... -CHUNKED_ENCODING = ... -GZIP_ENCODING = ... -DEFLATE_ENCODING = ... -HTTP_09 = ... -HTTP_10 = ... -HTTP_11 = ... -VERSIONS_MAP = ... -CODE_STRINGS = ... -HEADER_NAME_REGEX = ... -class HTTPParser(parser.Parser): - """ - Parser object for the HTTP format, should be able to - parse both request and response messages. - - The parser itself should be event driven an callback - functions should be called upon partials information - parsing. But the object itself is not thread safe. - """ - FIELDS = ... - def __init__(self, owner, type=..., store=..., file_limit=...) -> None: - ... - - def build(self): # -> None: - """ - Builds the initial set of states ordered according to - their internal integer definitions, this method provides - a fast and scalable way of parsing data. - """ - ... - - def destroy(self): # -> None: - """ - Destroys the current structure for the parser meaning that - it's restored to the original values, this method should only - be called on situation where no more parser usage is required. - """ - ... - - def reset(self, type=..., store=..., file_limit=...): # -> None: - """ - Initializes the state of the parser setting the values - for the various internal structures to the original value. - After this operation the parser is ready for a new parse. - - :type type: int - :param type: The type of HTTP message that is going to be - parsed using the current parser. - :type store: bool - :param store: If the complete message body should be stored - in memory as the message gets loaded, this option may create - some serious performance issues. - :type file_limit: int - :param file_limit: The maximum content for the payload message - from which a in file buffer will be used instead of the one that - is stored in memory (avoid memory starvation). - """ - ... - - def clear(self, force=...): # -> None: - ... - - def close(self): # -> None: - ... - - def get_path(self, normalize=...): # -> bytes | str: - """ - Retrieves the path associated with the request, this - value should be interpreted from the HTTP status line. - - In case the normalize flag is set a possible absolute - URL value should be normalized into an absolute path. - This may be required under some proxy related scenarios. - - :type normalize: bool - :param normalize: If the normalization process should be - applied for absolute URL scenarios. - :rtype: String - :return: The path associated with the current request. - """ - ... - - def get_query(self): # -> bytes | str: - """ - Retrieves the (GET) query part of the path, this is considered - to be the part of the path after the first question mark. - - This query string may be used to parse any possible (GET) - arguments. - - :rtype: String - :return: The query part of the path, to be used for parsing - of (GET) arguments. - """ - ... - - def get_message(self): # -> bytes | str: - """ - Gathers the complete set of message contents for the current - request/response in parsing. The proper gathering strategy will - depend on the current strategy (eg: in memory vs file strategies). - - The result of this process is cached meaning that further calls - to this method will return the same result. - - This method should be used carefully as it may create some memory - performance issues when retrieving large message values. - - :rtype: String - :return: The message for the current parsing process as a linear - string value that may be used as a simple buffer. - """ - ... - - def get_message_f(self): # -> bytes | str: - ... - - def get_message_b(self, copy=..., size=...): # -> BytesIO | StringIO | _TemporaryFileWrapper[bytes]: - """ - Retrieves a new buffer associated with the currently - loaded message, the first time this method is called a - new in memory object will be created for the storage. - - In case the current parsing operation is using a file like - object for the handling this object it is returned instead. - - The call of this method is only considered to be safe after - the complete message has been received and processed, otherwise - and invalid message file structure may be created. - - Note that the returned object will always be set at the - beginning of the file, so some care should be taken in usage. - - :type copy: bool - :param copy: If a copy of the file object should be returned - or if instead the shallow copy associated with the parser should - be returned instead, this should be used carefully to avoid any - memory leak from file descriptors. - :type size: int - :param size: Size (in bytes) of the buffer to be used in a possible - copy operation between buffers. - :rtype: File - :return: The file like object that may be used to percolate - over the various parts of the current message contents. - """ - ... - - def get_headers(self): # -> dict[Any, Any]: - ... - - def get_encodings(self): # -> list[Any]: - ... - - def parse(self, data): # -> int | Any: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - - -class HTTPResponse: - def __init__(self, data=..., code=..., status=..., headers=...) -> None: - ... - - def read(self): # -> None: - ... - - def readline(self): # -> None: - ... - - def close(self): # -> None: - ... - - def getcode(self): # -> int: - ... - - def info(self): # -> None: - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser +import netius.common.util as util +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +FILE_LIMIT: int +REQUEST: int +RESPONSE: int +LINE_STATE: int +HEADERS_STATE: int +MESSAGE_STATE: int +FINISH_STATE: int +PLAIN_ENCODING: int +CHUNKED_ENCODING: int +GZIP_ENCODING: int +DEFLATE_ENCODING: int +HTTP_09: int +HTTP_10: int +HTTP_11: int +VERSIONS_MAP: dict +CODE_STRINGS: dict + +class HTTPParser(netius.common.parser.Parser): + FIELDS: ClassVar[tuple] = ... + def __init__(self, owner, type: int = ..., store: bool = ..., file_limit: int = ...) -> None: ... + def build(self): ... + def destroy(self): ... + def reset(self, type: int = ..., store: bool = ..., file_limit: int = ...): ... + def clear(self, force: bool = ...): ... + def close(self): ... + def get_path(self, normalize: bool = ...): ... + def get_query(self): ... + def get_message(self): ... + def get_message_f(self): ... + def get_message_b(self, copy: bool = ..., size: int = ...): ... + def get_headers(self): ... + def get_encodings(self): ... + def parse(self, data): ... + def _parse_line(self, data): ... + def _parse_headers(self, data): ... + def _parse_message(self, data): ... + def _parse_normal(self, data): ... + def _parse_chunked(self, data): ... + def _store_data(self, data, memory: bool = ...): ... + def _parse_query(self, query): ... + def _decode_params(self, params): ... + +class HTTPResponse: + def __init__(self, data: Incomplete | None = ..., code: int = ..., status: Incomplete | None = ..., headers: Incomplete | None = ...) -> None: ... + def read(self): ... + def readline(self): ... + def close(self): ... + def getcode(self): ... + def info(self): ... diff --git a/src/typings/netius/common/http2.pyi b/src/typings/netius/common/http2.pyi index 3dd7b97f..ac06bf1b 100644 --- a/src/typings/netius/common/http2.pyi +++ b/src/typings/netius/common/http2.pyi @@ -1,468 +1,166 @@ -""" -This type stub file was generated by pyright. -""" - -import contextlib -import netius -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -HEADER_SIZE = ... -SETTING_SIZE = ... -DATA = ... -HEADERS = ... -PRIORITY = ... -RST_STREAM = ... -SETTINGS = ... -PUSH_PROMISE = ... -PING = ... -GOAWAY = ... -WINDOW_UPDATE = ... -CONTINUATION = ... -PROTOCOL_ERROR = ... -INTERNAL_ERROR = ... -FLOW_CONTROL_ERROR = ... -SETTINGS_TIMEOUT = ... -STREAM_CLOSED = ... -FRAME_SIZE_ERROR = ... -REFUSED_STREAM = ... -CANCEL = ... -COMPRESSION_ERROR = ... -CONNECT_ERROR = ... -ENHANCE_YOUR_CALM = ... -INADEQUATE_SECURITY = ... -HTTP_1_1_REQUIRED = ... -SETTINGS_HEADER_TABLE_SIZE = ... -SETTINGS_ENABLE_PUSH = ... -SETTINGS_MAX_CONCURRENT_STREAMS = ... -SETTINGS_INITIAL_WINDOW_SIZE = ... -SETTINGS_MAX_FRAME_SIZE = ... -SETTINGS_MAX_HEADER_LIST_SIZE = ... -HTTP_20 = ... -HEADER_STATE = ... -PAYLOAD_STATE = ... -FINISH_STATE = ... -HTTP2_WINDOW = ... -HTTP2_FRAME_SIZE = ... -HTTP2_PREFACE = ... -HTTP2_PSEUDO = ... -HTTP2_TUPLES = ... -HTTP2_NAMES = ... -HTTP2_SETTINGS = ... -HTTP2_SETTINGS_OPTIMAL = ... -HTTP2_SETTINGS_T = ... -HTTP2_SETTINGS_OPTIMAL_T = ... -class HTTP2Parser(parser.Parser): - FIELDS = ... - def __init__(self, owner, store=..., file_limit=...) -> None: - ... - - def build(self): # -> None: - """ - Builds the initial set of states ordered according to - their internal integer definitions, this method provides - a fast and scalable way of parsing data. - """ - ... - - def destroy(self): # -> None: - """ - Destroys the current structure for the parser meaning that - it's restored to the original values, this method should only - be called on situation where no more parser usage is required. - """ - ... - - def info_dict(self): # -> dict[Any, Any]: - ... - - def info_streams(self): # -> list[Any]: - ... - - def reset(self, store=..., file_limit=...): # -> None: - ... - - def clear(self, force=..., save=...): # -> None: - ... - - def close(self): # -> None: - ... - - def parse(self, data): # -> int | Any: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - def get_type_s(self, type): # -> str | None: - """ - Retrieves the string based representation of the frame - type according to the HTTP2 specification. - - :type type: int - :param type: The frame type as an integer that is going - to be converted to the string representation. - :rtype: String - :return: The string based representation of the frame type. - """ - ... - - def assert_header(self): # -> None: - """ - Runs a series of assertion operations related with the - header of the frame, making sure it remains compliant - with the HTTP 2 specification. - """ - ... - - def assert_stream(self, stream): # -> None: - ... - - def assert_data(self, stream, end_stream): # -> None: - ... - - def assert_headers(self, stream, end_stream): # -> None: - ... - - def assert_priority(self, stream, dependency): # -> None: - ... - - def assert_rst_stream(self, stream): # -> None: - ... - - def assert_settings(self, settings, ack, extended=...): # -> None: - ... - - def assert_push_promise(self, promised_stream): - ... - - def assert_ping(self): # -> None: - ... - - def assert_goaway(self): # -> None: - ... - - def assert_window_update(self, stream, increment): # -> None: - ... - - def assert_continuation(self, stream): # -> None: - ... - - @property - def type_s(self): # -> str | None: - ... - - @property - def buffer_size(self): # -> int: - ... - - @property - def buffer_data(self, empty=...): # -> bytes: - ... - - @property - def encoder(self): - ... - - @property - def decoder(self): - ... - - - -class HTTP2Stream(netius.Stream): - """ - Object representing a stream of data interchanged between two - peers under the HTTP 2 protocol. - - A stream may be considered a node in a tree of dependencies, - the children references are stored on the parent node. - - Should be compatible with both the parser and the connection - interfaces and may be used for both types of operations. - - :see: https://tools.ietf.org/html/rfc7540 - """ - def __init__(self, identifier=..., header_b=..., dependency=..., weight=..., exclusive=..., end_headers=..., end_stream=..., end_stream_l=..., store=..., file_limit=..., window=..., frame_size=..., *args, **kwargs) -> None: - ... - - def __getattr__(self, name): # -> Any: - ... - - def reset(self, store=..., file_limit=..., window=..., frame_size=...): # -> None: - ... - - def open(self): # -> None: - ... - - def close(self, flush=..., destroy=..., reset=...): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, int]: - ... - - def available(self): # -> None: - """ - Method called upon the become available event triggered - when a blocked stream becomes "unblocked" again, this is a - level operation that is only called once. - """ - ... - - def unavailable(self): # -> None: - """ - Called whenever an "unblocked" stream becomes "blocked" again - this is called only upon the "edge" (once). After this event - the stream should no longer send frames containing data. - """ - ... - - def set_encoding(self, encoding): # -> None: - ... - - def set_uncompressed(self): # -> None: - ... - - def set_plain(self): # -> None: - ... - - def set_chunked(self): # -> None: - ... - - def set_gzip(self): # -> None: - ... - - def set_deflate(self): # -> None: - ... - - def is_plain(self): # -> bool: - ... - - def is_chunked(self): # -> bool: - ... - - def is_gzip(self): # -> bool: - ... - - def is_deflate(self): # -> bool: - ... - - def is_compressed(self): # -> bool: - ... - - def is_uncompressed(self): # -> bool: - ... - - def is_flushed(self): # -> bool: - ... - - def is_measurable(self, strict=...): # -> bool: - ... - - def is_exhausted(self): # -> bool: - ... - - def is_restored(self): # -> bool: - ... - - def decode_headers(self, force=..., assert_h=...): # -> None: - ... - - def extend_headers(self, fragment): # -> None: - """ - Extends the headers data buffer with the provided - data fragment. This method may be used for adding - headers data coming from a continuation frame. - - :type fragment: String - :param fragment: The data fragment to be used in - the extension of the headers data. - """ - ... - - def extend_data(self, data): # -> None: - """ - Adds a data chunk to the buffer associated with the - stream. Note that the buffer is only populated in case - the store flag is currently set. - - Even if the store flag is not set this method should be - called whenever a new data chunk is received in the stream. - - :type data: String - :param data: The data chunk to be added to the stream's - internal buffers. - """ - ... - - def remote_update(self, increment): # -> None: - """ - Updates the remote window value, the remote windows is - the window that controls the output stream of bytes and - should represent the number of available bytes in the - remote peer that can be immediately processed. - - :type increment: int - :param increment: The increment in bytes to be added to - the current remote window value, this value may be negative. - """ - ... - - def local_update(self, increment): # -> None: - """ - Increments the current local window value with the increment - (in bytes) passed as parameter. - - The local window represents the number of bytes that can be - processed in the current local buffer, effectively representing - the number of bytes that may still be received in the stream. - - In case the window threshold is reached the method triggers - the sending of the window update frame. - - :type increment: int - :param increment: The number of bytes that are going to be - incremented in the local window value. - """ - ... - - def get_path(self, normalize=...): # -> str: - """ - Retrieves the path associated with the request, this - value should be interpreted from the HTTP status line. - - In case the normalize flag is set a possible absolute - URL value should be normalized into an absolute path. - This may be required under some proxy related scenarios. - - :type normalize: bool - :param normalize: If the normalization process should be - applied for absolute URL scenarios. - :rtype: String - :return: The path associated with the current request. - """ - ... - - def get_query(self): # -> str: - """ - Retrieves the (GET) query part of the path, this is considered - to be the part of the path after the first question mark. - - This query string may be used to parse any possible (GET) - arguments. - - :rtype: String - :return: The query part of the path, to be used for parsing - of (GET) arguments. - """ - ... - - def get_message_b(self, copy=..., size=...): # -> _TemporaryFileWrapper[bytes] | BytesIO | StringIO | None: - """ - Retrieves a new buffer associated with the currently - loaded message. - - In case the current parsing operation is using a file like - object for the handling this object it is returned instead. - - The call of this method is only considered to be safe after - the complete message has been received and processed, otherwise - and invalid message file structure may be created. - - Note that the returned object will always be set at the - beginning of the file, so some care should be taken in usage. - - :type copy: bool - :param copy: If a copy of the file object should be returned - or if instead the shallow copy associated with the parser should - be returned instead, this should be used carefully to avoid any - memory leak from file descriptors. - :type size: int - :param size: Size (in bytes) of the buffer to be used in a possible - copy operation between buffers. - :rtype: File - :return: The file like object that may be used to percolate - over the various parts of the current message contents. - """ - ... - - def get_encodings(self): # -> list[Any]: - ... - - def fragment(self, data): # -> Generator[Any, Any, None]: - ... - - def fragmentable(self, data): # -> bool: - ... - - def flush(self, *args, **kwargs): # -> Literal[0]: - ... - - def flush_s(self, *args, **kwargs): # -> Literal[0]: - ... - - def send_response(self, *args, **kwargs): # -> Literal[0]: - ... - - def send_header(self, *args, **kwargs): # -> Literal[0]: - ... - - def send_part(self, *args, **kwargs): # -> Literal[0]: - ... - - def send_reset(self, *args, **kwargs): # -> Literal[0]: - ... - - def assert_headers(self): # -> None: - ... - - def assert_ready(self): # -> None: - ... - - @contextlib.contextmanager - def ctx_request(self, args=..., kwargs=...): # -> Generator[None, Any, None]: - ... - - @property - def parser(self): # -> Self: - ... - - @property - def is_ready(self, calculate=..., assert_r=...): # -> bool: - """ - Determines if the stream is ready, meaning that the complete - set of headers and data have been passed to peer and the request - is ready to be passed to underlying layers for processing. - - :type calculate: bool - :param calculate: If the calculus of the content length should be - taken into consideration meaning that the content/data length should - be ensured to be calculated. - :type assert_r: bool - :param assert_r: If the extra assert (ready) operation should be - performed to ensure that proper data values are defined in the request. - :rtype: bool - :return: The final value on the is ready (for processing). - """ - ... - - @property - def is_headers(self): # -> bool: - ... - - - +import netius as netius +import netius.base.stream +import netius.common.http as http +import netius.common.parser +import netius.common.parser as parser +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +HEADER_SIZE: int +SETTING_SIZE: int +DATA: int +HEADERS: int +PRIORITY: int +RST_STREAM: int +SETTINGS: int +PUSH_PROMISE: int +PING: int +GOAWAY: int +WINDOW_UPDATE: int +CONTINUATION: int +PROTOCOL_ERROR: int +INTERNAL_ERROR: int +FLOW_CONTROL_ERROR: int +SETTINGS_TIMEOUT: int +STREAM_CLOSED: int +FRAME_SIZE_ERROR: int +REFUSED_STREAM: int +CANCEL: int +COMPRESSION_ERROR: int +CONNECT_ERROR: int +ENHANCE_YOUR_CALM: int +INADEQUATE_SECURITY: int +HTTP_1_1_REQUIRED: int +SETTINGS_HEADER_TABLE_SIZE: int +SETTINGS_ENABLE_PUSH: int +SETTINGS_MAX_CONCURRENT_STREAMS: int +SETTINGS_INITIAL_WINDOW_SIZE: int +SETTINGS_MAX_FRAME_SIZE: int +SETTINGS_MAX_HEADER_LIST_SIZE: int +HTTP_20: int +HEADER_STATE: int +PAYLOAD_STATE: int +FINISH_STATE: int +HTTP2_WINDOW: int +HTTP2_FRAME_SIZE: int +HTTP2_PREFACE: bytes +HTTP2_PSEUDO: tuple +HTTP2_TUPLES: tuple +HTTP2_NAMES: dict +HTTP2_SETTINGS: dict +HTTP2_SETTINGS_OPTIMAL: dict +HTTP2_SETTINGS_T: list +HTTP2_SETTINGS_OPTIMAL_T: list + +class HTTP2Parser(netius.common.parser.Parser): + FIELDS: ClassVar[tuple] = ... + def __init__(self, owner, store: bool = ..., file_limit: int = ...) -> None: ... + def build(self): ... + def destroy(self): ... + def info_dict(self): ... + def info_streams(self): ... + def reset(self, store: bool = ..., file_limit: int = ...): ... + def clear(self, force: bool = ..., save: bool = ...): ... + def close(self): ... + def parse(self, data): ... + def get_type_s(self, type): ... + def assert_header(self): ... + def assert_stream(self, stream): ... + def assert_data(self, stream, end_stream): ... + def assert_headers(self, stream, end_stream): ... + def assert_priority(self, stream, dependency): ... + def assert_rst_stream(self, stream): ... + def assert_settings(self, settings, ack, extended: bool = ...): ... + def assert_push_promise(self, promised_stream): ... + def assert_ping(self): ... + def assert_goaway(self): ... + def assert_window_update(self, stream, increment): ... + def assert_continuation(self, stream): ... + def _parse_header(self, data): ... + def _parse_payload(self, data): ... + def _parse_data(self, data): ... + def _parse_headers(self, data): ... + def _parse_priority(self, data): ... + def _parse_rst_stream(self, data): ... + def _parse_settings(self, data): ... + def _parse_push_promise(self, data): ... + def _parse_ping(self, data): ... + def _parse_goaway(self, data): ... + def _parse_window_update(self, data): ... + def _parse_continuation(self, data): ... + def _has_stream(self, stream): ... + def _get_stream(self, stream: Incomplete | None = ..., default: Incomplete | None = ..., strict: bool = ..., closed_s: bool = ..., unopened_s: bool = ..., exists_s: bool = ...): ... + def _set_stream(self, stream): ... + def _del_stream(self, stream): ... + def _invalid_type(self): ... + @property + def type_s(self): ... + @property + def buffer_size(self): ... + @property + def buffer_data(self): ... + @property + def encoder(self): ... + @property + def decoder(self): ... + +class HTTP2Stream(netius.base.stream.Stream): + def __init__(self, identifier: Incomplete | None = ..., header_b: Incomplete | None = ..., dependency: int = ..., weight: int = ..., exclusive: bool = ..., end_headers: bool = ..., end_stream: bool = ..., end_stream_l: bool = ..., store: bool = ..., file_limit: int = ..., window: int = ..., frame_size: int = ..., *args, **kwargs) -> None: ... + def __getattr__(self, name): ... + def reset(self, store: bool = ..., file_limit: int = ..., window: int = ..., frame_size: int = ...): ... + def open(self): ... + def close(self, flush: bool = ..., destroy: bool = ..., reset: bool = ...): ... + def info_dict(self, full: bool = ...): ... + def available(self): ... + def unavailable(self): ... + def set_encoding(self, encoding): ... + def set_uncompressed(self): ... + def set_plain(self): ... + def set_chunked(self): ... + def set_gzip(self): ... + def set_deflate(self): ... + def is_plain(self): ... + def is_chunked(self): ... + def is_gzip(self): ... + def is_deflate(self): ... + def is_compressed(self): ... + def is_uncompressed(self): ... + def is_flushed(self): ... + def is_measurable(self, strict: bool = ...): ... + def is_exhausted(self): ... + def is_restored(self): ... + def decode_headers(self, force: bool = ..., assert_h: bool = ...): ... + def extend_headers(self, fragment): ... + def extend_data(self, data): ... + def remote_update(self, increment): ... + def local_update(self, increment): ... + def get_path(self, normalize: bool = ...): ... + def get_query(self): ... + def get_message_b(self, copy: bool = ..., size: int = ...): ... + def get_encodings(self): ... + def fragment(self, data): ... + def fragmentable(self, data): ... + def flush(self, *args, **kwargs): ... + def flush_s(self, *args, **kwargs): ... + def send_response(self, *args, **kwargs): ... + def send_header(self, *args, **kwargs): ... + def send_part(self, *args, **kwargs): ... + def send_reset(self, *args, **kwargs): ... + def assert_headers(self): ... + def assert_ready(self): ... + def ctx_request(self, *args, **kwds): ... + def _calculate(self): ... + def _calculate_headers(self): ... + def _build_b(self): ... + def _build_c(self, callback, validate: bool = ...): ... + def _parse_query(self, query): ... + def _decode_params(self, params): ... + @property + def parser(self): ... + @property + def is_ready(self): ... + @property + def is_headers(self): ... diff --git a/src/typings/netius/common/mime.pyi b/src/typings/netius/common/mime.pyi index 1eb8bb0f..a0a6059c 100644 --- a/src/typings/netius/common/mime.pyi +++ b/src/typings/netius/common/mime.pyi @@ -1,81 +1,23 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -LINE_REGEX = ... -SPACE_REGEX = ... -HEADER_NAME_REGEX = ... -MIME_TYPES = ... -MIME_REGISTERED = ... -class Headers(list): - """ - Mutable structure that allow the access to header tuples - using both a list style strategy and a dictionary based - strategy, providing easy manipulation of the items. - - The order of insertion is preserved so that it may be - respected if a re-construction of the message is required. - """ - def __getitem__(self, key): - ... - - def __setitem__(self, key, value): # -> None: - ... - - def __delitem__(self, key): # -> None: - ... - - def __contains__(self, item): # -> bool: - ... - - def item(self, key): - ... - - def get(self, key, default=...): # -> None: - ... - - def set(self, key, value, append=...): # -> None: - ... - - def pop(self, key, default=...): # -> None: - ... - - def join(self, separator=...): # -> bytes | str: - ... - - - -def rfc822_parse(message, strip=...): # -> tuple[Headers, bytes]: - """ - Parse a message in rfc822 format. This format is similar to - the mime one with only some small changes. The returning value - for this function a set of dictionary tuples and the body of - the processed message as a standard encoded string. - - :type message: String - :param message: The message in rfc822 format, with both carriage - return and line feed support. - :type strip: bool - :param strip: If the initial white spaces in the first header line - should be removed and the proper abstract structure created with no - extra space values (no strict representation). This should not be - used when the strict representation of the headers is required - (eg: for cryptographic signing purposes). - :rtype: Tuple - :return: Returns a tuple of headers and body where headers is - a list of (name and value) pairs. - """ - ... - -def rfc822_join(headers, body): - ... - -def mime_register(): # -> None: - ... - +import netius as netius +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +MIME_TYPES: tuple +MIME_REGISTERED: bool + +class Headers(list): + def __getitem__(self, key): ... + def __setitem__(self, key, value) -> None: ... + def __delitem__(self, key) -> None: ... + def __contains__(self, item) -> bool: ... + def item(self, key): ... + def get(self, key, default: Incomplete | None = ...): ... + def set(self, key, value, append: bool = ...): ... + def pop(self, key, default: Incomplete | None = ...): ... + def join(self, separator: str = ...): ... + def _normalize(self, value): ... +def rfc822_parse(message, strip: bool = ...): ... +def rfc822_join(headers, body): ... +def mime_register(): ... diff --git a/src/typings/netius/common/parser.pyi b/src/typings/netius/common/parser.pyi index e717bed1..fe61200d 100644 --- a/src/typings/netius/common/parser.pyi +++ b/src/typings/netius/common/parser.pyi @@ -1,41 +1,19 @@ -""" -This type stub file was generated by pyright. -""" - -import netius - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Parser(netius.Observable): - FIELDS = ... - def __init__(self, owner) -> None: - ... - - @classmethod - def mock(cls, owner, state): # -> Self: - ... - - def build(self): # -> None: - ... - - def destroy(self): # -> None: - ... - - def get_state(self): # -> dict[Any, Any]: - ... - - def set_state(self, state): # -> None: - ... - - def info_dict(self): # -> dict[Any, Any]: - ... - - def parse(self, data): # -> None: - ... - - - +import netius as netius +import netius.base.observer +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class Parser(netius.base.observer.Observable): + FIELDS: ClassVar[tuple] = ... + def __init__(self, owner) -> None: ... + @classmethod + def mock(cls, owner, state): ... + def build(self): ... + def destroy(self): ... + def get_state(self): ... + def set_state(self, state): ... + def info_dict(self): ... + def parse(self, data): ... diff --git a/src/typings/netius/common/pop.pyi b/src/typings/netius/common/pop.pyi index 4d82da9e..867fbb9f 100644 --- a/src/typings/netius/common/pop.pyi +++ b/src/typings/netius/common/pop.pyi @@ -1,33 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class POPParser(parser.Parser): - def __init__(self, owner, store=...) -> None: - ... - - def parse(self, data): # -> int: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser + +__version__: str +__revision__: str +__date__: str + +class POPParser(netius.common.parser.Parser): + def __init__(self, owner, store: bool = ...) -> None: ... + def parse(self, data): ... + def _parse_line(self, data): ... diff --git a/src/typings/netius/common/rsa.pyi b/src/typings/netius/common/rsa.pyi index 0d96a436..8da3d5ef 100644 --- a/src/typings/netius/common/rsa.pyi +++ b/src/typings/netius/common/rsa.pyi @@ -1,134 +1,36 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -PRIVATE_TOKEN = ... -PUBLIC_TOKEN = ... -def open_pem_key(path, token=...): # -> bytes: - ... - -def open_pem_data(data, token=...): # -> bytes: - ... - -def write_pem_key(path, data, token=..., width=...): # -> None: - ... - -def open_private_key(path): # -> dict[str, int]: - ... - -def open_private_key_b64(data_b64): # -> dict[str, int]: - ... - -def open_private_key_data(data): # -> dict[str, int]: - ... - -def open_public_key(path): # -> dict[str, int]: - ... - -def open_public_key_b64(data_b64): # -> dict[str, int]: - ... - -def open_public_key_data(data): # -> dict[str, int]: - ... - -def write_private_key(path, private_key): # -> None: - ... - -def write_public_key(path, public_key): # -> None: - ... - -def asn_private_key(private_key): # -> bytes: - ... - -def asn_public_key(public_key): # -> bytes: - ... - -def pem_to_der(in_path, out_path, token=...): # -> None: - ... - -def pem_limiters(token): # -> tuple[Any | _bytes, Any | _bytes]: - ... - -def private_to_public(private_key): # -> dict[str, Any]: - ... - -def assert_private(private_key, number_bits=...): # -> None: - ... - -def rsa_private(number_bits): # -> dict[str, int]: - """ - Generates a new "random" private with the requested number - of bits as the base for exponents and modulus. - - This method is extremely time consuming in terms of processor - and should be used carefully to avoid any problem. - - :type number_bits: int - :param number_bits: The number of bits that are going to be - used for the generation of the private key. - :rtype: Dictionary - :return: The generated private key structure, may then be used - for processing or written to a file. - """ - ... - -def rsa_primes(number_bits): # -> tuple[Any, Any]: - """ - Generates two different prime numbers (p and q values) - and returns them inside a tuple structure. - - The generation is made according to the number of bits - defined and using a trial and error strategy (expensive). - - :type number_bits: int - :param number_bits: The number of bits to be used in - prime generation, this affects security. - :rtype: Tuple - :return: A tuple containing the two different prime - numbers to be returned. - """ - ... - -def rsa_exponents(prime_1, prime_2, number_bits, basic=...): # -> tuple[Any | Literal[65537], Any | Literal[1]]: - """ - Generates both the public and the private exponents for - the RSA cryptography system taking as base the provided - prime numbers and the amount of bits for the values. - - :type prime_1: int - :param prime_1: The first prime number use for RSA. - :type prime_2: int - :param prime_2: The second prime number use for RSA. - :type number_bits: int - :param number_bits: The number of bits that are going to be - used for the generation of the values. - :type basic: bool - :param basic: If the basic approach to the generation of the - public exponent should be taken into account. - :rtype: Tuple - :return: The tuple containing the generated public and - private keys (properly tested). - """ - ... - -def rsa_bits(modulus): # -> int: - ... - -def rsa_sign(message, private_key): # -> LiteralString | bytes: - ... - -def rsa_verify(signature, public_key): # -> LiteralString | bytes: - ... - -def rsa_crypt_s(message, exponent, modulus): # -> LiteralString | bytes: - ... - -def rsa_crypt(number, exponent, modulus): - ... - +import netius as netius +import netius.common.asn as asn +import netius.common.calc as calc +import netius.common.util as util +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +PRIVATE_TOKEN: str +PUBLIC_TOKEN: str +def open_pem_key(path, token: str = ...): ... +def open_pem_data(data, token: str = ...): ... +def write_pem_key(path, data, token: str = ..., width: int = ...): ... +def open_private_key(path): ... +def open_private_key_b64(data_b64): ... +def open_private_key_data(data): ... +def open_public_key(path): ... +def open_public_key_b64(data_b64): ... +def open_public_key_data(data): ... +def write_private_key(path, private_key): ... +def write_public_key(path, public_key): ... +def asn_private_key(private_key): ... +def asn_public_key(public_key): ... +def pem_to_der(in_path, out_path, token: str = ...): ... +def pem_limiters(token): ... +def private_to_public(private_key): ... +def assert_private(private_key, number_bits: Incomplete | None = ...): ... +def rsa_private(number_bits): ... +def rsa_primes(number_bits): ... +def rsa_exponents(prime_1, prime_2, number_bits, basic: bool = ...): ... +def rsa_bits(modulus): ... +def rsa_sign(message, private_key): ... +def rsa_verify(signature, public_key): ... +def rsa_crypt_s(message, exponent, modulus): ... +def rsa_crypt(number, exponent, modulus): ... diff --git a/src/typings/netius/common/setup.pyi b/src/typings/netius/common/setup.pyi index f3e63a37..ee638088 100644 --- a/src/typings/netius/common/setup.pyi +++ b/src/typings/netius/common/setup.pyi @@ -1,21 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -CA_URL = ... -COMMON_PATH = ... -BASE_PATH = ... -EXTRAS_PATH = ... -SSL_CA_PATH = ... -def ensure_setup(): # -> None: - ... - -def ensure_ca(path=...): # -> None: - ... - +__version__: str +__revision__: str +__date__: str +CA_URL: str +COMMON_PATH: str +BASE_PATH: str +EXTRAS_PATH: str +SSL_CA_PATH: str +def ensure_setup(): ... +def ensure_ca(path: str = ...): ... +def _download_ca(path: str = ..., raise_e: bool = ...): ... +def _store_contents(contents, path): ... diff --git a/src/typings/netius/common/smtp.pyi b/src/typings/netius/common/smtp.pyi index 6eb0e37b..7aa21ea7 100644 --- a/src/typings/netius/common/smtp.pyi +++ b/src/typings/netius/common/smtp.pyi @@ -1,34 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SEPARATOR_REGEX = ... -class SMTPParser(parser.Parser): - def __init__(self, owner, store=...) -> None: - ... - - def parse(self, data): # -> int: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser + +__version__: str +__revision__: str +__date__: str + +class SMTPParser(netius.common.parser.Parser): + def __init__(self, owner, store: bool = ...) -> None: ... + def parse(self, data): ... + def _parse_line(self, data): ... diff --git a/src/typings/netius/common/socks.pyi b/src/typings/netius/common/socks.pyi index d5c285c1..291320f8 100644 --- a/src/typings/netius/common/socks.pyi +++ b/src/typings/netius/common/socks.pyi @@ -1,75 +1,42 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -IPV4 = ... -IPV6 = ... -DOMAIN = ... -VERSION_STATE = ... -HEADER_STATE = ... -USER_ID_STATE = ... -DOMAIN_STATE = ... -AUTH_COUNT_STATE = ... -AUTH_METHODS_STATE = ... -HEADER_EXTRA_STATE = ... -SIZE_STATE = ... -ADDRESS_STATE = ... -PORT_STATE = ... -FINISH_STATE = ... -class SOCKSParser(parser.Parser): - def __init__(self, owner) -> None: - ... - - def build(self): # -> None: - """ - Builds the initial set of states ordered according to - their internal integer definitions, this method provides - a fast and scalable way of parsing data. - """ - ... - - def destroy(self): # -> None: - """ - Destroys the current structure for the parser meaning that - it's restored to the original values, this method should only - be called on situation where no more parser usage is required. - """ - ... - - def reset(self): # -> None: - ... - - def clear(self, force=...): # -> None: - ... - - def parse(self, data): # -> int | Any: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - def get_host(self): # -> bytes | str | None: - ... - - def get_address(self): # -> bytes | None: - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser +import netius.common.util as util + +__version__: str +__revision__: str +__date__: str +IPV4: int +IPV6: int +DOMAIN: int +VERSION_STATE: int +HEADER_STATE: int +USER_ID_STATE: int +DOMAIN_STATE: int +AUTH_COUNT_STATE: int +AUTH_METHODS_STATE: int +HEADER_EXTRA_STATE: int +SIZE_STATE: int +ADDRESS_STATE: int +PORT_STATE: int +FINISH_STATE: int + +class SOCKSParser(netius.common.parser.Parser): + def __init__(self, owner) -> None: ... + def build(self): ... + def destroy(self): ... + def reset(self): ... + def clear(self, force: bool = ...): ... + def parse(self, data): ... + def get_host(self): ... + def get_address(self): ... + def _parse_version(self, data): ... + def _parse_header(self, data): ... + def _parse_user_id(self, data): ... + def _parse_domain(self, data): ... + def _parse_auth_count(self, data): ... + def _parse_auth_methods(self, data): ... + def _parse_header_extra(self, data): ... + def _parse_size(self, data): ... + def _parse_address(self, data): ... + def _parse_port(self, data): ... diff --git a/src/typings/netius/common/stream.pyi b/src/typings/netius/common/stream.pyi index 85c55c5d..6f073804 100644 --- a/src/typings/netius/common/stream.pyi +++ b/src/typings/netius/common/stream.pyi @@ -1,79 +1,31 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Stream: - def open(self, mode=...): - ... - - def close(self): - ... - - def seek(self, offset): - ... - - def read(self, size): - ... - - def write(self, data): - ... - - def flish(self): - ... - - - -class FileStream(Stream): - def __init__(self, path, size) -> None: - ... - - def open(self, mode=..., allocate=...): # -> None: - ... - - def close(self): # -> None: - ... - - def seek(self, offset): # -> None: - ... - - def read(self, size): # -> Any: - ... - - def write(self, data): # -> None: - ... - - def flush(self): # -> None: - ... - - - -class FilesStream(Stream): - def __init__(self, dir_path, size, files_m) -> None: - ... - - def open(self, mode=..., allocate=...): # -> None: - ... - - def close(self): # -> None: - ... - - def seek(self, offset): # -> None: - ... - - def read(self, size): # -> bytes: - ... - - def write(self, data): # -> None: - ... - - def flush(self): # -> None: - ... - - - +import netius as netius + +__version__: str +__revision__: str +__date__: str + +class Stream: + def open(self, mode: str = ...): ... + def close(self): ... + def seek(self, offset): ... + def read(self, size): ... + def write(self, data): ... + def flish(self): ... + +class FileStream(Stream): + def __init__(self, path, size) -> None: ... + def open(self, mode: str = ..., allocate: bool = ...): ... + def close(self): ... + def seek(self, offset): ... + def read(self, size): ... + def write(self, data): ... + def flush(self): ... + +class FilesStream(Stream): + def __init__(self, dir_path, size, files_m) -> None: ... + def open(self, mode: str = ..., allocate: bool = ...): ... + def close(self): ... + def seek(self, offset): ... + def read(self, size): ... + def write(self, data): ... + def flush(self): ... diff --git a/src/typings/netius/common/structures.pyi b/src/typings/netius/common/structures.pyi index e1a3b1e1..c9db5015 100644 --- a/src/typings/netius/common/structures.pyi +++ b/src/typings/netius/common/structures.pyi @@ -1,37 +1,14 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class PriorityDict(dict): - def __init__(self, *args, **kwargs) -> None: - ... - - def __setitem__(self, key, val): # -> None: - ... - - def smallest(self): - ... - - def pop_smallest(self): - ... - - def setdefault(self, key, val): - ... - - def update(self, *args, **kwargs): # -> None: - ... - - def sorted_iter(self): # -> Generator[Any, Any, None]: - ... - - - -def file_iterator(file_object, chunk_size=...): # -> Generator[Any, Any, None]: - ... - +__version__: str +__revision__: str +__date__: str + +class PriorityDict(dict): + def __init__(self, *args, **kwargs) -> None: ... + def __setitem__(self, key, val) -> None: ... + def smallest(self): ... + def pop_smallest(self): ... + def setdefault(self, key, val): ... + def update(self, *args, **kwargs): ... + def sorted_iter(self): ... + def _rebuild_heap(self): ... +def file_iterator(file_object, chunk_size: int = ...): ... diff --git a/src/typings/netius/common/style.pyi b/src/typings/netius/common/style.pyi index 3a1327ba..d00fa6c6 100644 --- a/src/typings/netius/common/style.pyi +++ b/src/typings/netius/common/style.pyi @@ -1,11 +1,4 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BASE_STYLE = ... +__version__: str +__revision__: str +__date__: str +BASE_STYLE: str diff --git a/src/typings/netius/common/tftp.pyi b/src/typings/netius/common/tftp.pyi index a1e1a130..ee0be72e 100644 --- a/src/typings/netius/common/tftp.pyi +++ b/src/typings/netius/common/tftp.pyi @@ -1,16 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -RRQ_TFTP = ... -WRQ_TFTP = ... -DATA_TFTP = ... -ACK_TFTP = ... -ERROR_TFTP = ... -TYPES_TFTP = ... +__version__: str +__revision__: str +__date__: str +RRQ_TFTP: int +WRQ_TFTP: int +DATA_TFTP: int +ACK_TFTP: int +ERROR_TFTP: int +TYPES_TFTP: dict diff --git a/src/typings/netius/common/tls.pyi b/src/typings/netius/common/tls.pyi index a6af10d0..a9fc6076 100644 --- a/src/typings/netius/common/tls.pyi +++ b/src/typings/netius/common/tls.pyi @@ -1,40 +1,17 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class TLSContextDict(dict): - def __init__(self, owner, domains, *args, **kwargs) -> None: - ... - - def load(self, domains): # -> None: - ... - - def has_definition(self, domain): # -> bool: - ... - - def cer_path(self, domain): - ... - - def key_path(self, domain): - ... - - - -class LetsEncryptDict(TLSContextDict): - def __init__(self, owner, domains, *args, **kwargs) -> None: - ... - - def cer_path(self, domain): # -> str: - ... - - def key_path(self, domain): # -> str: - ... - - - +import netius as netius + +__version__: str +__revision__: str +__date__: str + +class TLSContextDict(dict): + def __init__(self, owner, domains, *args, **kwargs) -> None: ... + def load(self, domains): ... + def has_definition(self, domain): ... + def cer_path(self, domain): ... + def key_path(self, domain): ... + +class LetsEncryptDict(TLSContextDict): + def __init__(self, owner, domains, *args, **kwargs) -> None: ... + def cer_path(self, domain): ... + def key_path(self, domain): ... diff --git a/src/typings/netius/common/torrent.pyi b/src/typings/netius/common/torrent.pyi index afad3cae..156b7be6 100644 --- a/src/typings/netius/common/torrent.pyi +++ b/src/typings/netius/common/torrent.pyi @@ -1,67 +1,23 @@ -""" -This type stub file was generated by pyright. -""" - -from . import parser - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -HANDSHAKE_SIZE = ... -DECIMAL_REGEX = ... -TORRENT_TYPES = ... -def info_hash(root): # -> bytes: - ... - -def bencode(root): # -> bytes: - ... - -def bdecode(data): # -> dict[Any, Any] | list[Any] | int | LiteralString: - ... - -def chunk(item): # -> Generator[Any | _bytes | str, Any, None]: - ... - -def dechunk(chunks): # -> dict[Any, Any] | list[Any] | int | LiteralString: - ... - -class TorrentParser(parser.Parser): - def __init__(self, owner, store=...) -> None: - ... - - def build(self): # -> None: - """ - Builds the initial set of states ordered according to - their internal integer definitions, this method provides - a fast and scalable way of parsing data. - """ - ... - - def destroy(self): # -> None: - """ - Destroys the current structure for the parser meaning that - it's restored to the original values, this method should only - be called on situation where no more parser usage is required. - """ - ... - - def parse(self, data): # -> int | Any: - """ - Parses the provided data chunk, changing the current - state of the parser accordingly and returning the - number of processed bytes from it. - - :type data: String - :param data: The string containing the data to be parsed - in the current parse operation. - :rtype: int - :return: The amount of bytes of the data string that have - been "parsed" in the current parse operation. - """ - ... - - - +import netius as netius +import netius.common.parser +import netius.common.parser as parser + +__version__: str +__revision__: str +__date__: str +HANDSHAKE_SIZE: int +TORRENT_TYPES: dict +def info_hash(root): ... +def bencode(root): ... +def bdecode(data): ... +def chunk(item): ... +def dechunk(chunks): ... + +class TorrentParser(netius.common.parser.Parser): + def __init__(self, owner, store: bool = ...) -> None: ... + def build(self): ... + def destroy(self): ... + def parse(self, data): ... + def _join(self, data): ... + def _parse_handshake(self, data): ... + def _parse_message(self, data): ... diff --git a/src/typings/netius/common/util.pyi b/src/typings/netius/common/util.pyi index 44913713..81fd20f5 100644 --- a/src/typings/netius/common/util.pyi +++ b/src/typings/netius/common/util.pyi @@ -1,181 +1,35 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SIZE_UNITS_LIST = ... -SIZE_UNITS_LIST_S = ... -SIZE_UNIT_COEFFICIENT = ... -DEFAULT_MINIMUM = ... -DEFAULT_PLACES = ... -_HOST = ... -def cstring(value): - ... - -def chunks(sequence, count): # -> Generator[Any, Any, None]: - ... - -def header_down(name): # -> LiteralString: - ... - -def header_up(name): # -> LiteralString: - ... - -def is_ip4(address): # -> bool: - ... - -def is_ip6(address): # -> bool: - ... - -def assert_ip4(address, allowed, default=...): # -> bool: - ... - -def in_subnet_ip4(address, subnet): # -> Any: - ... - -def addr_to_ip4(number): # -> str: - ... - -def addr_to_ip6(number): # -> LiteralString: - ... - -def ip4_to_addr(value): # -> int: - ... - -def string_to_bits(value): # -> str: - ... - -def integer_to_bytes(number, length=...): # -> LiteralString | bytes: - ... - -def bytes_to_integer(bytes): # -> int: - ... - -def random_integer(number_bits): - """ - Generates a random integer of approximately the - size of the provided number bits bits rounded up - to whole bytes. - - :type number_bits: int - :param number_bits: The number of bits of the generated - random integer, this value will be used as the basis - for the calculus of the required bytes. - :rtype: int - :return: The generated random integer, should be provided - with the requested size. - """ - ... - -def host(default=...): # -> bytes | str: - """ - Retrieves the host for the current machine, - typically this would be the ipv4 address of - the main network interface. - - No result type are guaranteed and a local address - (eg: 127.0.0.1) may be returned instead. - - The returned value is cached to avoid multiple - blocking calls from blocking the processor. - - :type default: String - :param default: The default value that is going to - be returned in case no resolution is possible, take - into account that this result is going to be cached. - :rtype: Strong - :return: The string that contains the host address - as defined by specification for the current machine. - """ - ... - -def hostname(): # -> str: - """ - The name as a simple string o the name of the current - local machine. This value may or may not be a fully - qualified domain name for the machine. - - The result of this function call is unpredictable and - should not be trusted for critical operations. - - :rtype: String - :return: The name as a string of the current local - machine, the definition of this value varies. - """ - ... - -def size_round_unit(size_value, minimum=..., places=..., reduce=..., space=..., justify=..., simplified=..., depth=...): - """ - Rounds the size unit, returning a string representation - of the value with a good rounding precision. - This method should be used to round data sizing units. - - Note that using the places parameter it's possible to control - the number of digits (including decimal places) of the - number that is going to be "generated". - - :type size_value: int/float - :param size_value: The current size value (in bytes). - :type minimum: int - :param minimum: The minimum value to be used. - :type places: int - :param places: The target number of digits to be used for - describing the value to be used for output, this is going - to be used to calculate the proper number of decimal places. - :type reduce: bool - :param reduce: If the final string value should be reduced - meaning that right decimal zeros should be removed as they - represent an extra unused value. - :type space: bool - :param space: If a space character must be used dividing - the value from the unit symbol. - :type justify: bool - :param justify: If the size string value should be (right) - justified important for properly aligned values in a table. - :type simplified: bool - :param simplified: If the simplified version of the units - should be used instead of the longer one. - :type depth: int - :param depth: The current iteration depth value. - :rtype: String - :return: The string representation of the data size - value in a simplified manner (unit). - """ - ... - -def verify(condition, message=..., exception=...): # -> None: - """ - Ensures that the requested condition returns a valid value - and if that's no the case an exception raised breaking the - current execution logic. - - :type condition: bool - :param condition: The condition to be evaluated and that may - trigger an exception raising. - :type message: String - :param message: The message to be used in the building of the - exception that is going to be raised in case of condition failure. - :type exception: Class - :param exception: The exception class that is going to be used - to build the exception to be raised in case the condition - verification operation fails. - """ - ... - -def verify_equal(first, second, message=..., exception=...): # -> None: - ... - -def verify_not_equal(first, second, message=..., exception=...): # -> None: - ... - -def verify_type(value, types, null=..., message=..., exception=..., **kwargs): # -> None: - ... - -def verify_many(sequence, message=..., exception=...): # -> None: - ... - +import netius as netius +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +SIZE_UNITS_LIST: tuple +SIZE_UNITS_LIST_S: tuple +SIZE_UNIT_COEFFICIENT: int +DEFAULT_MINIMUM: int +DEFAULT_PLACES: int +_HOST: None +def cstring(value): ... +def chunks(sequence, count): ... +def header_down(name): ... +def header_up(name): ... +def is_ip4(address): ... +def is_ip6(address): ... +def assert_ip4(address, allowed, default: bool = ...): ... +def in_subnet_ip4(address, subnet): ... +def addr_to_ip4(number): ... +def addr_to_ip6(number): ... +def ip4_to_addr(value): ... +def string_to_bits(value): ... +def integer_to_bytes(number, length: int = ...): ... +def bytes_to_integer(bytes): ... +def random_integer(number_bits): ... +def host(default: str = ...): ... +def hostname(): ... +def size_round_unit(size_value, minimum: int = ..., places: int = ..., reduce: bool = ..., space: bool = ..., justify: bool = ..., simplified: bool = ..., depth: int = ...): ... +def verify(condition, message: Incomplete | None = ..., exception: Incomplete | None = ...): ... +def verify_equal(first, second, message: Incomplete | None = ..., exception: Incomplete | None = ...): ... +def verify_not_equal(first, second, message: Incomplete | None = ..., exception: Incomplete | None = ...): ... +def verify_type(value, types, null: bool = ..., message: Incomplete | None = ..., exception: Incomplete | None = ..., **kwargs): ... +def verify_many(sequence, message: Incomplete | None = ..., exception: Incomplete | None = ...): ... diff --git a/src/typings/netius/common/ws.pyi b/src/typings/netius/common/ws.pyi index 2d07af27..3fbe634d 100644 --- a/src/typings/netius/common/ws.pyi +++ b/src/typings/netius/common/ws.pyi @@ -1,19 +1,8 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def encode_ws(data, final=..., opcode=..., mask=...): # -> bytes: - ... - -def decode_ws(data): # -> tuple[Any, Literal[b""]] | tuple[bytes, Any]: - ... - -def assert_ws(data_l, size): # -> None: - ... - +import netius as netius + +__version__: str +__revision__: str +__date__: str +def encode_ws(data, final: bool = ..., opcode: int = ..., mask: bool = ...): ... +def decode_ws(data): ... +def assert_ws(data_l, size): ... diff --git a/src/typings/netius/examples/__init__.pyi b/src/typings/netius/examples/__init__.pyi index 38927725..0c932ff0 100644 --- a/src/typings/netius/examples/__init__.pyi +++ b/src/typings/netius/examples/__init__.pyi @@ -1,13 +1,7 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http, upnp -from .http import http_callback, http_static -from .upnp import upnp_map - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import http as http, upnp as upnp +from netius.examples.http import http_callback as http_callback, http_static as http_static +from netius.examples.upnp import upnp_map as upnp_map + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/examples/http.pyi b/src/typings/netius/examples/http.pyi index b8eb17e0..a3bf905c 100644 --- a/src/typings/netius/examples/http.pyi +++ b/src/typings/netius/examples/http.pyi @@ -1,16 +1,7 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def http_static(): # -> None: - ... - -def http_callback(): # -> None: - ... - +import netius as netius + +__version__: str +__revision__: str +__date__: str +def http_static(): ... +def http_callback(): ... diff --git a/src/typings/netius/examples/upnp.pyi b/src/typings/netius/examples/upnp.pyi index c2fb6502..9503f720 100644 --- a/src/typings/netius/examples/upnp.pyi +++ b/src/typings/netius/examples/upnp.pyi @@ -1,22 +1,6 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def upnp_map(ext_port, int_port, host, protocol=..., description=...): # -> None: - """ - Defines a router port forwarding rule using an UPnP based - request that tries to find the first available router. - - In case there's no available router with UPnP features the - client may become idle, leaking memory. - - :see: http://www.upnp.org/specs/gw/UPnP-gw-WANIPConnection-v1-Service.pdf - """ - ... - +import netius as netius + +__version__: str +__revision__: str +__date__: str +def upnp_map(ext_port, int_port, host, protocol: str = ..., description: str = ...): ... diff --git a/src/typings/netius/extra/__init__.pyi b/src/typings/netius/extra/__init__.pyi index d1fcf287..9c983058 100644 --- a/src/typings/netius/extra/__init__.pyi +++ b/src/typings/netius/extra/__init__.pyi @@ -1,20 +1,14 @@ -""" -This type stub file was generated by pyright. -""" - -from . import desktop, dhcp_s, file, filea, hello, hello_w, proxy_d, proxy_f, proxy_r, smtp_r -from .desktop import DesktopServer -from .dhcp_s import DHCPServerS -from .file import FileServer -from .filea import FileAsyncServer -from .hello import HelloServer -from .proxy_d import DockerProxyServer -from .proxy_f import ForwardProxyServer -from .proxy_r import ReverseProxyServer -from .smtp_r import RelaySMTPServer - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import desktop as desktop, dhcp_s as dhcp_s, file as file, filea as filea, hello as hello, hello_w as hello_w, proxy_d as proxy_d, proxy_f as proxy_f, proxy_r as proxy_r, smtp_r as smtp_r +from netius.extra.desktop import DesktopServer as DesktopServer +from netius.extra.dhcp_s import DHCPServerS as DHCPServerS +from netius.extra.file import FileServer as FileServer +from netius.extra.filea import FileAsyncServer as FileAsyncServer +from netius.extra.hello import HelloServer as HelloServer +from netius.extra.proxy_d import DockerProxyServer as DockerProxyServer +from netius.extra.proxy_f import ForwardProxyServer as ForwardProxyServer +from netius.extra.proxy_r import ReverseProxyServer as ReverseProxyServer +from netius.extra.smtp_r import RelaySMTPServer as RelaySMTPServer + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/extra/desktop.pyi b/src/typings/netius/extra/desktop.pyi index d72321b7..6a7f19ce 100644 --- a/src/typings/netius/extra/desktop.pyi +++ b/src/typings/netius/extra/desktop.pyi @@ -1,25 +1,11 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DesktopServer(netius.servers.MJPGServer): - def get_delay(self, connection): # -> Literal[1]: - ... - - def get_image(self, connection): # -> bytes | str | None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.mjpg + +__version__: str +__revision__: str +__date__: str +PIL: None + +class DesktopServer(netius.servers.mjpg.MJPGServer): + def get_delay(self, connection): ... + def get_image(self, connection): ... diff --git a/src/typings/netius/extra/dhcp_s.pyi b/src/typings/netius/extra/dhcp_s.pyi index c6bdf88c..bb0c1c69 100644 --- a/src/typings/netius/extra/dhcp_s.pyi +++ b/src/typings/netius/extra/dhcp_s.pyi @@ -1,34 +1,16 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DHCPServerS(netius.servers.DHCPServer): - def __init__(self, pool=..., options=..., *args, **kwargs) -> None: - ... - - def get_type(self, request): # -> Literal[9, 12, 13]: - ... - - def get_options(self, request): # -> dict[Any, Any]: - ... - - def get_yiaddr(self, request): - ... - - - -if __name__ == "__main__": - host = ... - pool = ... - options = ... - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.dhcp +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class DHCPServerS(netius.servers.dhcp.DHCPServer): + def __init__(self, pool: Incomplete | None = ..., options: dict = ..., *args, **kwargs) -> None: ... + def get_type(self, request): ... + def get_options(self, request): ... + def get_yiaddr(self, request): ... + def _build(self, options): ... + def _reserve(self, request): ... + def _confirm(self, request): ... diff --git a/src/typings/netius/extra/file.pyi b/src/typings/netius/extra/file.pyi index 44a3cb25..461867e6 100644 --- a/src/typings/netius/extra/file.pyi +++ b/src/typings/netius/extra/file.pyi @@ -1,63 +1,43 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_SIZE = ... -FOLDER_SVG = ... -FILE_SVG = ... -EMPTY_GIF = ... -class FileServer(netius.servers.HTTP2Server): - """ - Simple implementation of a file server that is able to list files - for directories taking into account the base path values. - - This is a synchronous implementation meaning that the server loop - will block for the various I/O operations to be performed. - - Current implementation supports byte ranges so that partial retrieval - of a file is possible. - """ - def __init__(self, base_path=..., style_urls=..., index_files=..., path_regex=..., list_dirs=..., list_engine=..., cors=..., cache=..., *args, **kwargs) -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_stream_d(self, stream): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - def on_dir_file(self, connection, parser, path, style=...): # -> None: - ... - - def on_normal_file(self, connection, parser, path): # -> None: - ... - - def on_no_file(self, connection): # -> None: - ... - - def on_exception_file(self, connection, exception): # -> None: - ... - - def on_not_modified(self, connection, path): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.http2 +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +BUFFER_SIZE: int +FOLDER_SVG: str +FILE_SVG: str +EMPTY_GIF: str + +class FileServer(netius.servers.http2.HTTP2Server): + def __init__(self, base_path: str = ..., style_urls: list = ..., index_files: list = ..., path_regex: list = ..., list_dirs: bool = ..., list_engine: str = ..., cors: bool = ..., cache: int = ..., *args, **kwargs) -> None: ... + @classmethod + def _sorter_build(cls, name: Incomplete | None = ...): ... + @classmethod + def _items_normalize(cls, items, path, pad: bool = ..., space: bool = ..., simplified: bool = ...): ... + @classmethod + def _gen_dir(cls, engine, path, path_v, query_m, style: bool = ..., style_urls: list = ..., **kwargs): ... + @classmethod + def _gen_dir_base(cls, path, path_v, query_m, style: bool = ..., style_urls: list = ..., **kwargs): ... + @classmethod + def _gen_dir_apache(cls, path, path_v, query_m, **kwargs): ... + @classmethod + def _gen_dir_legacy(cls, path, path_v, query_m, **kwargs): ... + def on_connection_d(self, connection): ... + def on_stream_d(self, stream): ... + def on_serve(self): ... + def on_data_http(self, connection, parser): ... + def on_dir_file(self, connection, parser, path, style: bool = ...): ... + def on_normal_file(self, connection, parser, path): ... + def on_no_file(self, connection): ... + def on_exception_file(self, connection, exception): ... + def on_not_modified(self, connection, path): ... + def _next_queue(self, connection): ... + def _file_send(self, connection): ... + def _file_finish(self, connection): ... + def _file_close(self, connection): ... + def _file_check_close(self, connection): ... + def _resolve(self, path): ... + def _build_regex(self): ... + def _resolve_regex(self, path): ... diff --git a/src/typings/netius/extra/filea.pyi b/src/typings/netius/extra/filea.pyi index f76faf62..31cb46d4 100644 --- a/src/typings/netius/extra/filea.pyi +++ b/src/typings/netius/extra/filea.pyi @@ -1,38 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -from . import file as _file - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_SIZE = ... -class FileAsyncServer(_file.FileServer): - """ - Simple implementation of a file server that uses the async - file pool infra-structure. - - This is a test implementation and should never be used for - production work that required mature and stable codebase. - - Using this kind of server (file pool based) is not recommended - for system that don't provide some system of event fd (eg: windows) - as it would provide very slow performance or even stall the - event loop as no notification occurs on events. - """ - def on_connection_d(self, connection): # -> None: - ... - - def on_stream_d(self, stream): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius.extra.file +import netius.extra.file as _file + +__version__: str +__revision__: str +__date__: str +BUFFER_SIZE: int + +class FileAsyncServer(netius.extra.file.FileServer): + def on_connection_d(self, connection): ... + def on_stream_d(self, stream): ... + def _file_send(self, connection): ... diff --git a/src/typings/netius/extra/hello.pyi b/src/typings/netius/extra/hello.pyi index c6ce3991..7199a60e 100644 --- a/src/typings/netius/extra/hello.pyi +++ b/src/typings/netius/extra/hello.pyi @@ -1,38 +1,13 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class HelloServer(netius.servers.HTTP2Server): - """ - Simple Hello (World) HTTP server meant to be used for benchmarks - and other operations that require a simple in-memory HTTP server. - - Most of the implementation on the server is done in the upper - layers from which this server class inherits. - - Performance should always be considered critical when changing - or adding new features to this server implementation. - """ - def __init__(self, message=..., *args, **kwargs) -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.http2 + +__version__: str +__revision__: str +__date__: str + +class HelloServer(netius.servers.http2.HTTP2Server): + def __init__(self, message: str = ..., *args, **kwargs) -> None: ... + def on_serve(self): ... + def on_data_http(self, connection, parser): ... + def _hello_close(self, connection): ... + def _hello_keep(self, connection): ... diff --git a/src/typings/netius/extra/hello_w.pyi b/src/typings/netius/extra/hello_w.pyi index abbef670..6cac633d 100644 --- a/src/typings/netius/extra/hello_w.pyi +++ b/src/typings/netius/extra/hello_w.pyi @@ -1,17 +1,6 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def app(environ, start_response): # -> Generator[Literal['Hello World'], Any, None]: - ... - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius + +__version__: str +__revision__: str +__date__: str +def app(environ, start_response): ... diff --git a/src/typings/netius/extra/proxy_d.pyi b/src/typings/netius/extra/proxy_d.pyi index 34bdb44d..04b36bda 100644 --- a/src/typings/netius/extra/proxy_d.pyi +++ b/src/typings/netius/extra/proxy_d.pyi @@ -1,35 +1,21 @@ -""" -This type stub file was generated by pyright. -""" - -from . import proxy_r - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DockerProxyServer(proxy_r.ReverseProxyServer): - """ - Specialized reverse proxy server that handles many of the - inner details of the reverse proxy server configuration - server using environment variables information, making it - easier for the automatic configuration and association of - servers to the proxy server in a Docker environment. - - Although an optimal usage implies a Docker context the usage - of the Docker proxy servers is not limited to such use cases. - """ - def __init__(self, host_suffixes=..., *args, **kwargs) -> None: - ... - - def on_serve(self): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.extra.proxy_r +import netius.extra.proxy_r as proxy_r + +__version__: str +__revision__: str +__date__: str + +class DockerProxyServer(netius.extra.proxy_r.ReverseProxyServer): + def __init__(self, host_suffixes: list = ..., *args, **kwargs) -> None: ... + def on_serve(self): ... + def _build_docker(self): ... + def _build_regex(self, token: str = ..., sort: bool = ...): ... + def _build_hosts(self, alias: bool = ...): ... + def _build_alias(self): ... + def _build_passwords(self): ... + def _build_redirect(self): ... + def _build_error_urls(self): ... + def _build_redirect_ssl(self, alias: bool = ...): ... + def _build_suffixes(self, alias: bool = ..., redirect: bool = ...): ... + def _valid_url(self, value): ... diff --git a/src/typings/netius/extra/proxy_f.pyi b/src/typings/netius/extra/proxy_f.pyi index 2a67e984..60c69548 100644 --- a/src/typings/netius/extra/proxy_f.pyi +++ b/src/typings/netius/extra/proxy_f.pyi @@ -1,29 +1,11 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class ForwardProxyServer(netius.servers.ProxyServer): - def __init__(self, config=..., rules=..., *args, **kwargs) -> None: - ... - - def on_headers(self, connection, parser): # -> None: - ... - - def compile(self): # -> None: - ... - - - -if __name__ == "__main__": - rules = ... - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.proxy + +__version__: str +__revision__: str +__date__: str + +class ForwardProxyServer(netius.servers.proxy.ProxyServer): + def __init__(self, config: str = ..., rules: dict = ..., *args, **kwargs) -> None: ... + def on_headers(self, connection, parser): ... + def compile(self): ... diff --git a/src/typings/netius/extra/proxy_r.pyi b/src/typings/netius/extra/proxy_r.pyi index 5c2fcbbc..367055b1 100644 --- a/src/typings/netius/extra/proxy_r.pyi +++ b/src/typings/netius/extra/proxy_r.pyi @@ -1,110 +1,45 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -DEFAULT_NAME = ... -class ReverseProxyServer(netius.servers.ProxyServer): - """ - Reverse HTTP proxy implementation based on the more generalized - infra-structure of proxy server. - - Supports multiple scheduling strategies, being the "smart" one - the most efficient for most of the possible scenarios. - - Conditional re-usage of connections based on boolean flag is possible, - but care should be taken when using re-usage so that no multiple - rules are applied for the same connection (eg: https://host.com/hive, - https://host.com/colony as different rules), this would pose serious - problems if the back-end servers are different for each rule or if - the way the final back-end URL is created is different for each rule. - """ - def __init__(self, config=..., regex=..., hosts=..., alias=..., auth=..., auth_regex=..., redirect=..., redirect_regex=..., error_urls=..., forward=..., strategy=..., reuse=..., sts=..., resolve=..., resolve_t=..., host_f=..., echo=..., *args, **kwargs) -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def proxy_r_dict(self): # -> dict[str, dict[Any, Any] | None]: - ... - - def on_diag(self): # -> None: - ... - - def on_start(self): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_headers(self, connection, parser): - ... - - def rules(self, url, parser): # -> tuple[None, None] | tuple[Any, Any | None] | tuple[Any, None] | Any: - ... - - def rules_regex(self, url, parser): # -> tuple[None, None] | tuple[Any, Any | None]: - ... - - def rules_host(self, url, parser): # -> tuple[Any, None] | Any: - ... - - def rules_forward(self, url, parser): # -> tuple[Any, None] | Any: - ... - - def balancer(self, values): # -> tuple[Any, None] | Any: - ... - - def balancer_robin(self, values): # -> tuple[Any, None]: - ... - - def balancer_smart(self, values): # -> tuple[Any, tuple[Any, PriorityDict | Any]]: - ... - - def acquirer(self, state): # -> None: - ... - - def acquirer_robin(self, state): # -> None: - ... - - def acquirer_smart(self, state): # -> None: - ... - - def releaser(self, state): # -> None: - ... - - def releaser_robin(self, state): # -> None: - ... - - def releaser_smart(self, state): # -> None: - ... - - def dns_start(self, timeout=...): # -> None: - ... - - def dns_tick(self, timeout=...): # -> None: - ... - - def dns_callback(self, host, hostname, parsed, index=..., resolved=...): # -> Callable[..., None]: - ... - - - -if __name__ == "__main__": - regex = ... - hosts = ... - alias = ... - auth = ... - auth_regex = ... - redirect = ... - error_urls = ... - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.proxy +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +DEFAULT_NAME: str + +class ReverseProxyServer(netius.servers.proxy.ProxyServer): + def __init__(self, config: str = ..., regex: dict = ..., hosts: dict = ..., alias: dict = ..., auth: dict = ..., auth_regex: dict = ..., redirect: dict = ..., redirect_regex: dict = ..., error_urls: dict = ..., forward: Incomplete | None = ..., strategy: str = ..., reuse: bool = ..., sts: int = ..., resolve: bool = ..., resolve_t: float = ..., host_f: bool = ..., echo: bool = ..., *args, **kwargs) -> None: ... + def info_dict(self, full: bool = ...): ... + def proxy_r_dict(self): ... + def on_diag(self): ... + def on_start(self): ... + def on_serve(self): ... + def on_headers(self, connection, parser): ... + def rules(self, url, parser): ... + def rules_regex(self, url, parser): ... + def rules_host(self, url, parser): ... + def rules_forward(self, url, parser): ... + def balancer(self, values): ... + def balancer_robin(self, values): ... + def balancer_smart(self, values): ... + def acquirer(self, state): ... + def acquirer_robin(self, state): ... + def acquirer_smart(self, state): ... + def releaser(self, state): ... + def releaser_robin(self, state): ... + def releaser_smart(self, state): ... + def dns_start(self, timeout: float = ...): ... + def dns_tick(self, timeout: float = ...): ... + def dns_callback(self, host, hostname, parsed, index: int = ..., resolved: list = ...): ... + def _on_prx_message(self, client, parser, message): ... + def _on_prx_close(self, client, _connection): ... + def _apply_all(self, parser, connection, headers, upper: bool = ..., normalize: bool = ..., replace: bool = ...): ... + def _apply_headers(self, parser, connection, parser_prx, headers, upper: bool = ...): ... + def _set_strategy(self): ... + def _resolve_regex(self, value, regexes, default: Incomplete | None = ...): ... + def _echo(self, sort: bool = ...): ... + def _echo_regex(self, sort: bool = ...): ... + def _echo_hosts(self, sort: bool = ...): ... + def _echo_alias(self, sort: bool = ...): ... + def _echo_redirect(self, sort: bool = ...): ... + def _echo_error_urls(self, sort: bool = ...): ... diff --git a/src/typings/netius/extra/smtp_r.pyi b/src/typings/netius/extra/smtp_r.pyi index d73446ef..f03fa3b6 100644 --- a/src/typings/netius/extra/smtp_r.pyi +++ b/src/typings/netius/extra/smtp_r.pyi @@ -1,53 +1,18 @@ -""" -This type stub file was generated by pyright. -""" - -import netius.servers - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class RelaySMTPServer(netius.servers.SMTPServer): - """ - Relay version of the smtp server that relays messages - that are not considered to be local to other servers. - - The servers uses the default smtp client implementation - to relay the messages. - """ - def __init__(self, *args, **kwargs) -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_header_smtp(self, connection, from_l, to_l): # -> None: - ... - - def on_data_smtp(self, connection, data): # -> None: - ... - - def on_message_smtp(self, connection): # -> None: - ... - - def relay(self, connection, froms, tos, contents): # -> None: - ... - - def date(self): # -> str: - ... - - def message_id(self, connection, email=...): # -> str: - ... - - def dkim_contents(self, contents, email=..., creation=...): - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.smtp +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class RelaySMTPServer(netius.servers.smtp.SMTPServer): + def __init__(self, *args, **kwargs) -> None: ... + def on_serve(self): ... + def on_header_smtp(self, connection, from_l, to_l): ... + def on_data_smtp(self, connection, data): ... + def on_message_smtp(self, connection): ... + def relay(self, connection, froms, tos, contents): ... + def date(self): ... + def message_id(self, connection, email: str = ...): ... + def dkim_contents(self, contents, email: str = ..., creation: Incomplete | None = ...): ... diff --git a/src/typings/netius/middleware/__init__.pyi b/src/typings/netius/middleware/__init__.pyi index bd514f80..07c9fd67 100644 --- a/src/typings/netius/middleware/__init__.pyi +++ b/src/typings/netius/middleware/__init__.pyi @@ -1,17 +1,11 @@ -""" -This type stub file was generated by pyright. -""" - -from . import annoyer, base, blacklist, dummy, flood, proxy -from .annoyer import AnnoyerMiddleware -from .base import Middleware -from .blacklist import BlacklistMiddleware -from .dummy import DummyMiddleware -from .flood import FloodMiddleware -from .proxy import ProxyMiddleware - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import annoyer as annoyer, base as base, blacklist as blacklist, dummy as dummy, flood as flood, proxy as proxy +from netius.middleware.annoyer import AnnoyerMiddleware as AnnoyerMiddleware +from netius.middleware.base import Middleware as Middleware +from netius.middleware.blacklist import BlacklistMiddleware as BlacklistMiddleware +from netius.middleware.dummy import DummyMiddleware as DummyMiddleware +from netius.middleware.flood import FloodMiddleware as FloodMiddleware +from netius.middleware.proxy import ProxyMiddleware as ProxyMiddleware + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/middleware/annoyer.pyi b/src/typings/netius/middleware/annoyer.pyi index f49a0a68..610b4bcb 100644 --- a/src/typings/netius/middleware/annoyer.pyi +++ b/src/typings/netius/middleware/annoyer.pyi @@ -1,29 +1,13 @@ -""" -This type stub file was generated by pyright. -""" - -from .base import Middleware - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class AnnoyerMiddleware(Middleware): - """ - Simple middleware that prints an "annoying" status message - to the standard output (stdout) from time to time providing - a simple diagnostics strategy. - """ - def __init__(self, owner, period=...) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - - +import netius as netius +import netius.middleware.base +from netius.middleware.base import Middleware as Middleware + +__version__: str +__revision__: str +__date__: str + +class AnnoyerMiddleware(netius.middleware.base.Middleware): + def __init__(self, owner, period: float = ...) -> None: ... + def start(self): ... + def stop(self): ... + def _run(self): ... diff --git a/src/typings/netius/middleware/base.pyi b/src/typings/netius/middleware/base.pyi index dfa8faf4..bde6d9d6 100644 --- a/src/typings/netius/middleware/base.pyi +++ b/src/typings/netius/middleware/base.pyi @@ -1,22 +1,8 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class Middleware: - def __init__(self, owner) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - - +__version__: str +__revision__: str +__date__: str + +class Middleware: + def __init__(self, owner) -> None: ... + def start(self): ... + def stop(self): ... diff --git a/src/typings/netius/middleware/blacklist.pyi b/src/typings/netius/middleware/blacklist.pyi index a2c03461..5d233d59 100644 --- a/src/typings/netius/middleware/blacklist.pyi +++ b/src/typings/netius/middleware/blacklist.pyi @@ -1,31 +1,14 @@ -""" -This type stub file was generated by pyright. -""" - -from .base import Middleware - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class BlacklistMiddleware(Middleware): - """ - Simple middleware implementation for blacklisting of IP - addresses using a very minimalistic approach. - """ - def __init__(self, owner, blacklist=..., whitelist=...) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def on_connection_c(self, owner, connection): # -> None: - ... - - - +import netius as netius +import netius.middleware.base +from _typeshed import Incomplete +from netius.middleware.base import Middleware as Middleware + +__version__: str +__revision__: str +__date__: str + +class BlacklistMiddleware(netius.middleware.base.Middleware): + def __init__(self, owner, blacklist: Incomplete | None = ..., whitelist: Incomplete | None = ...) -> None: ... + def start(self): ... + def stop(self): ... + def on_connection_c(self, owner, connection): ... diff --git a/src/typings/netius/middleware/dummy.pyi b/src/typings/netius/middleware/dummy.pyi index ecda694e..640da15f 100644 --- a/src/typings/netius/middleware/dummy.pyi +++ b/src/typings/netius/middleware/dummy.pyi @@ -1,29 +1,11 @@ -""" -This type stub file was generated by pyright. -""" - -from .base import Middleware - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DummyMiddleware(Middleware): - """ - Simple middleware implementation for testing/debugging - purposes that may be used as reference for the implementation - of more complex middleware units. - """ - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def on_connection_c(self, owner, connection): # -> None: - ... - - - +import netius.middleware.base +from netius.middleware.base import Middleware as Middleware + +__version__: str +__revision__: str +__date__: str + +class DummyMiddleware(netius.middleware.base.Middleware): + def start(self): ... + def stop(self): ... + def on_connection_c(self, owner, connection): ... diff --git a/src/typings/netius/middleware/flood.pyi b/src/typings/netius/middleware/flood.pyi index bb37a12c..7096338d 100644 --- a/src/typings/netius/middleware/flood.pyi +++ b/src/typings/netius/middleware/flood.pyi @@ -1,31 +1,15 @@ -""" -This type stub file was generated by pyright. -""" - -from .base import Middleware - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class FloodMiddleware(Middleware): - """ - Simple middleware implementation for avoiding flooding - of connection creation from a certain address. - """ - def __init__(self, owner, conns_per_min=..., whitelist=...) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def on_connection_c(self, owner, connection): # -> None: - ... - - - +import netius as netius +import netius.middleware.base +from _typeshed import Incomplete +from netius.middleware.base import Middleware as Middleware + +__version__: str +__revision__: str +__date__: str + +class FloodMiddleware(netius.middleware.base.Middleware): + def __init__(self, owner, conns_per_min: int = ..., whitelist: Incomplete | None = ...) -> None: ... + def start(self): ... + def stop(self): ... + def on_connection_c(self, owner, connection): ... + def _update_flood(self, host): ... diff --git a/src/typings/netius/middleware/proxy.pyi b/src/typings/netius/middleware/proxy.pyi index 2f86ba06..ed020161 100644 --- a/src/typings/netius/middleware/proxy.pyi +++ b/src/typings/netius/middleware/proxy.pyi @@ -1,48 +1,29 @@ -""" -This type stub file was generated by pyright. -""" - -from .base import Middleware - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class ProxyMiddleware(Middleware): - """ - Middleware that implements the PROXY protocol on creation - of a new connection enabling the passing of information - from the front-end server to a back-end server using a normal - TCP connection. This protocol has been development originally - for the integration of an HAProxy server with back-end servers. - - :see: http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt - """ - MAX_LENGTH = ... - HEADER_LENGTH_V2 = ... - HEADER_MAGIC_V2 = ... - TYPE_LOCAL_V2 = ... - TYPE_PROXY_V2 = ... - AF_UNSPEC_v2 = ... - AF_INET_v2 = ... - AF_INET6_v2 = ... - AF_UNIX_v2 = ... - PROTO_UNSPEC_v2 = ... - PROTO_STREAM_v2 = ... - PROTO_DGRAM_v2 = ... - def __init__(self, owner, version=...) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def on_connection_c(self, owner, connection): # -> None: - ... - - - +import netius as netius +import netius.middleware.base +from netius.middleware.base import Middleware as Middleware +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class ProxyMiddleware(netius.middleware.base.Middleware): + MAX_LENGTH: ClassVar[int] = ... + HEADER_LENGTH_V2: ClassVar[int] = ... + HEADER_MAGIC_V2: ClassVar[bytes] = ... + TYPE_LOCAL_V2: ClassVar[int] = ... + TYPE_PROXY_V2: ClassVar[int] = ... + AF_UNSPEC_v2: ClassVar[int] = ... + AF_INET_v2: ClassVar[int] = ... + AF_INET6_v2: ClassVar[int] = ... + AF_UNIX_v2: ClassVar[int] = ... + PROTO_UNSPEC_v2: ClassVar[int] = ... + PROTO_STREAM_v2: ClassVar[int] = ... + PROTO_DGRAM_v2: ClassVar[int] = ... + def __init__(self, owner, version: int = ...) -> None: ... + def start(self): ... + def stop(self): ... + def on_connection_c(self, owner, connection): ... + def _proxy_handshake_v1(self, connection): ... + def _proxy_handshake_v2(self, connection): ... + def _read_safe(self, connection, buffer, count): ... diff --git a/src/typings/netius/mock/__init__.pyi b/src/typings/netius/mock/__init__.pyi index a899f29c..25cd3c03 100644 --- a/src/typings/netius/mock/__init__.pyi +++ b/src/typings/netius/mock/__init__.pyi @@ -1,11 +1,5 @@ -""" -This type stub file was generated by pyright. -""" - -from . import appier - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import appier as appier + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/mock/appier.pyi b/src/typings/netius/mock/appier.pyi index 1b9aed47..db2c42bd 100644 --- a/src/typings/netius/mock/appier.pyi +++ b/src/typings/netius/mock/appier.pyi @@ -1,17 +1,6 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class APIApp: - ... - - -def route(*args, **kwargs): # -> Callable[..., None]: - ... - +__version__: str +__revision__: str +__date__: str + +class APIApp: ... +def route(*args, **kwargs): ... diff --git a/src/typings/netius/pool/__init__.pyi b/src/typings/netius/pool/__init__.pyi index 6f0cb159..8bc076b6 100644 --- a/src/typings/netius/pool/__init__.pyi +++ b/src/typings/netius/pool/__init__.pyi @@ -1,15 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -from . import common, file, notify, task -from .common import EventFile, EventPool, SocketEventFile, Thread, ThreadPool, UnixEventFile -from .file import FilePool, FileThread -from .notify import NotifyPool -from .task import TaskPool, TaskThread - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import common as common, file as file, notify as notify, task as task +from netius.pool.common import EventFile as EventFile, EventPool as EventPool, SocketEventFile as SocketEventFile, Thread as Thread, ThreadPool as ThreadPool, UnixEventFile as UnixEventFile +from netius.pool.file import FilePool as FilePool, FileThread as FileThread +from netius.pool.notify import NotifyPool as NotifyPool +from netius.pool.task import TaskPool as TaskPool, TaskThread as TaskThread + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/pool/common.pyi b/src/typings/netius/pool/common.pyi index 9292d446..e4b793d0 100644 --- a/src/typings/netius/pool/common.pyi +++ b/src/typings/netius/pool/common.pyi @@ -1,171 +1,77 @@ -""" -This type stub file was generated by pyright. -""" - -import threading - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -CALLABLE_WORK = ... -class Thread(threading.Thread): - def __init__(self, identifier, owner=..., *args, **kwargs) -> None: - ... - - @classmethod - def available(self): # -> Literal[True]: - ... - - def stop(self): # -> None: - ... - - def run(self): # -> None: - ... - - def tick(self): # -> None: - ... - - def execute(self, work): # -> None: - ... - - - -class ThreadPool: - def __init__(self, base=..., count=...) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self, join=...): # -> None: - ... - - def build(self): # -> None: - ... - - def peek(self): # -> None: - ... - - def pop(self, lock=...): - ... - - def push(self, work, lock=...): # -> None: - ... - - def push_callable(self, callable): # -> None: - ... - - - -class EventPool(ThreadPool): - def __init__(self, base=..., count=...) -> None: - ... - - def stop(self, join=...): # -> None: - ... - - def push_event(self, event): # -> None: - ... - - def pop_event(self): - ... - - def pop_all(self, denotify=...): # -> list[Any]: - ... - - def notify(self): # -> None: - ... - - def denotify(self): # -> None: - ... - - def eventfd(self): # -> UnixEventFile | PipeEventFile | SocketEventFile: - ... - - - -class EventFile: - def __init__(self, *args, **kwargs) -> None: - ... - - def close(self): # -> None: - ... - - def fileno(self): # -> None: - ... - - def rfileno(self): # -> None: - ... - - def wfileno(self): # -> None: - ... - - def notify(self): - ... - - def denotify(self): - ... - - - -class UnixEventFile(EventFile): - _LIBC = ... - def __init__(self, *args, **kwargs) -> None: - ... - - @classmethod - def available(cls): # -> bool: - ... - - @classmethod - def libc(cls): # -> CDLL | None: - ... - - def close(self): # -> None: - ... - - def notify(self): # -> None: - ... - - def denotify(self): # -> None: - ... - - - -class PipeEventFile(EventFile): - def __init__(self, *args, **kwargs) -> None: - ... - - @classmethod - def available(cls): # -> bool: - ... - - def close(self): # -> None: - ... - - def notify(self): # -> None: - ... - - def denotify(self): # -> None: - ... - - - -class SocketEventFile(EventFile): - def __init__(self, *args, **kwargs) -> None: - ... - - def close(self): # -> None: - ... - - def notify(self): # -> None: - ... - - def denotify(self): # -> None: - ... - - - +import netius as netius +import threading +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +CALLABLE_WORK: int + +class Thread(threading.Thread): + def __init__(self, identifier, owner: Incomplete | None = ..., *args, **kwargs) -> None: ... + def available(self): ... + def stop(self): ... + def run(self): ... + def tick(self): ... + def execute(self, work): ... + +class ThreadPool: + def __init__(self, base: type[Thread] = ..., count: int = ...) -> None: ... + def start(self): ... + def stop(self, join: bool = ...): ... + def build(self): ... + def peek(self): ... + def pop(self, lock: bool = ...): ... + def push(self, work, lock: bool = ...): ... + def push_callable(self, callable): ... + +class EventPool(ThreadPool): + def __init__(self, base: type[Thread] = ..., count: int = ...) -> None: ... + def stop(self, join: bool = ...): ... + def push_event(self, event): ... + def pop_event(self): ... + def pop_all(self, denotify: bool = ...): ... + def notify(self): ... + def denotify(self): ... + def eventfd(self): ... + +class EventFile: + def __init__(self, *args, **kwargs) -> None: ... + def close(self): ... + def fileno(self): ... + def rfileno(self): ... + def wfileno(self): ... + def notify(self): ... + def denotify(self): ... + +class UnixEventFile(EventFile): + _LIBC: ClassVar[None] = ... + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def available(cls): ... + @classmethod + def libc(cls): ... + def close(self): ... + def notify(self): ... + def denotify(self): ... + def _read(self, length: int = ...): ... + def _write(self, value): ... + +class PipeEventFile(EventFile): + def __init__(self, *args, **kwargs) -> None: ... + @classmethod + def available(cls): ... + def close(self): ... + def notify(self): ... + def denotify(self): ... + def _read(self, length: int = ...): ... + def _write(self, data): ... + +class SocketEventFile(EventFile): + def __init__(self, *args, **kwargs) -> None: ... + def close(self): ... + def notify(self): ... + def denotify(self): ... + def _read(self, length: int = ...): ... + def _write(self, data): ... diff --git a/src/typings/netius/pool/file.pyi b/src/typings/netius/pool/file.pyi index 8d9aa70e..45ca93a9 100644 --- a/src/typings/netius/pool/file.pyi +++ b/src/typings/netius/pool/file.pyi @@ -1,54 +1,29 @@ -""" -This type stub file was generated by pyright. -""" - -from . import common - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -FILE_WORK = ... -ERROR_ACTION = ... -OPEN_ACTION = ... -CLOSE_ACTION = ... -READ_ACTION = ... -WRITE_ACTION = ... -class FileThread(common.Thread): - def execute(self, work): # -> None: - ... - - def open(self, path, mode, data): # -> None: - ... - - def close(self, file, data): # -> None: - ... - - def read(self, file, count, data): # -> None: - ... - - def write(self, file, buffer, data): # -> None: - ... - - - -class FilePool(common.EventPool): - def __init__(self, base=..., count=...) -> None: - ... - - def open(self, path, mode=..., data=...): # -> None: - ... - - def close(self, file, data=...): # -> None: - ... - - def read(self, file, count=..., data=...): # -> None: - ... - - def write(self, file, buffer, data=...): # -> None: - ... - - - +import netius as netius +import netius.pool.common +import netius.pool.common as common +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +FILE_WORK: int +ERROR_ACTION: int +OPEN_ACTION: int +CLOSE_ACTION: int +READ_ACTION: int +WRITE_ACTION: int + +class FileThread(netius.pool.common.Thread): + def execute(self, work): ... + def open(self, path, mode, data): ... + def close(self, file, data): ... + def read(self, file, count, data): ... + def write(self, file, buffer, data): ... + def _execute(self, work): ... + +class FilePool(netius.pool.common.EventPool): + def __init__(self, base: type[FileThread] = ..., count: int = ...) -> None: ... + def open(self, path, mode: str = ..., data: Incomplete | None = ...): ... + def close(self, file, data: Incomplete | None = ...): ... + def read(self, file, count: int = ..., data: Incomplete | None = ...): ... + def write(self, file, buffer, data: Incomplete | None = ...): ... diff --git a/src/typings/netius/pool/notify.pyi b/src/typings/netius/pool/notify.pyi index acb62147..e6b680e4 100644 --- a/src/typings/netius/pool/notify.pyi +++ b/src/typings/netius/pool/notify.pyi @@ -1,18 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -from . import common - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class NotifyPool(common.EventPool): - def __init__(self) -> None: - ... - - - +import netius.pool.common +import netius.pool.common as common + +__version__: str +__revision__: str +__date__: str + +class NotifyPool(netius.pool.common.EventPool): + def __init__(self) -> None: ... diff --git a/src/typings/netius/pool/task.pyi b/src/typings/netius/pool/task.pyi index 5b2867fa..5ffaa981 100644 --- a/src/typings/netius/pool/task.pyi +++ b/src/typings/netius/pool/task.pyi @@ -1,28 +1,16 @@ -""" -This type stub file was generated by pyright. -""" - -from . import common - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -TASK_WORK = ... -class TaskThread(common.Thread): - def execute(self, work): # -> None: - ... - - - -class TaskPool(common.EventPool): - def __init__(self, base=..., count=...) -> None: - ... - - def execute(self, callable, args=..., kwargs=..., callback=...): # -> None: - ... - - - +import netius as netius +import netius.pool.common +import netius.pool.common as common +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +TASK_WORK: int + +class TaskThread(netius.pool.common.Thread): + def execute(self, work): ... + +class TaskPool(netius.pool.common.EventPool): + def __init__(self, base: type[TaskThread] = ..., count: int = ...) -> None: ... + def execute(self, callable, args: list = ..., kwargs: dict = ..., callback: Incomplete | None = ...): ... diff --git a/src/typings/netius/servers/__init__.pyi b/src/typings/netius/servers/__init__.pyi index ab861a62..957aaea1 100644 --- a/src/typings/netius/servers/__init__.pyi +++ b/src/typings/netius/servers/__init__.pyi @@ -1,26 +1,21 @@ -""" -This type stub file was generated by pyright. -""" - -from . import dhcp, echo, echo_ws, ftp, http, http2, mjpg, pop, proxy, smtp, socks, tftp, torrent, ws, wsgi -from .dhcp import DHCPRequest, DHCPServer -from .echo_ws import EchoWSServer -from .echo import EchoServer -from .ftp import FTPConnection, FTPServer -from .http import HTTPConnection, HTTPServer -from .http2 import HTTP2Server -from .mjpg import MJPGServer -from .pop import POPConnection, POPServer -from .proxy import ProxyConnection, ProxyServer -from .smtp import SMTPConnection, SMTPServer, TERMINATION_SIZE -from .socks import SOCKSConnection, SOCKSServer -from .tftp import TFTPRequest, TFTPServer -from .torrent import Pieces, TorrentServer, TorrentTask -from .ws import WSConnection, WSServer -from .wsgi import WSGIServer - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import dhcp as dhcp, echo as echo, echo_ws as echo_ws, ftp as ftp, http as http, http2 as http2, mjpg as mjpg, pop as pop, proxy as proxy, smtp as smtp, socks as socks, tftp as tftp, torrent as torrent, ws as ws, wsgi as wsgi +from netius.servers.dhcp import DHCPRequest as DHCPRequest, DHCPServer as DHCPServer +from netius.servers.echo import EchoServer as EchoServer +from netius.servers.echo_ws import EchoWSServer as EchoWSServer +from netius.servers.ftp import FTPConnection as FTPConnection, FTPServer as FTPServer +from netius.servers.http import HTTPConnection as HTTPConnection, HTTPServer as HTTPServer +from netius.servers.http2 import HTTP2Server as HTTP2Server +from netius.servers.mjpg import MJPGServer as MJPGServer +from netius.servers.pop import POPConnection as POPConnection, POPServer as POPServer +from netius.servers.proxy import ProxyConnection as ProxyConnection, ProxyServer as ProxyServer +from netius.servers.smtp import SMTPConnection as SMTPConnection, SMTPServer as SMTPServer +from netius.servers.socks import SOCKSConnection as SOCKSConnection, SOCKSServer as SOCKSServer +from netius.servers.tftp import TFTPRequest as TFTPRequest, TFTPServer as TFTPServer +from netius.servers.torrent import Pieces as Pieces, TorrentServer as TorrentServer, TorrentTask as TorrentTask +from netius.servers.ws import WSConnection as WSConnection, WSServer as WSServer +from netius.servers.wsgi import WSGIServer as WSGIServer + +__version__: str +__revision__: str +__date__: str +TERMINATION_SIZE: int diff --git a/src/typings/netius/servers/dhcp.pyi b/src/typings/netius/servers/dhcp.pyi index 3fd027bf..adf04634 100644 --- a/src/typings/netius/servers/dhcp.pyi +++ b/src/typings/netius/servers/dhcp.pyi @@ -1,80 +1,73 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class DHCPRequest: - options_m = ... - options_l = ... - def __init__(self, data) -> None: - ... - - @classmethod - def generate(cls): # -> None: - ... - - def get_info(self): # -> str: - ... - - def print_info(self): # -> None: - ... - - def parse(self): # -> None: - ... - - def unpack_options(self): # -> None: - ... - - def get_requested(self): # -> str: - ... - - def get_type(self): # -> int: - ... - - def get_type_s(self): # -> str | None: - ... - - def get_mac(self): # -> LiteralString: - ... - - def response(self, yiaddr, options=...): # -> bytes: - ... - - - -class DHCPServer(netius.DatagramServer): - def serve(self, port=..., type=..., *args, **kwargs): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def on_data_dhcp(self, address, request): # -> None: - ... - - def get_verb(self, type_r): # -> str: - ... - - def send_dhcp(self, data, *args, **kwargs): # -> None: - ... - - def get_type(self, request): - ... - - def get_options(self, request): - ... - - def get_yiaddr(self, request): - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.server +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class DHCPRequest: + options_m: ClassVar[None] = ... + options_l: ClassVar[None] = ... + def __init__(self, data) -> None: ... + @classmethod + def generate(cls): ... + def get_info(self): ... + def print_info(self): ... + def parse(self): ... + def unpack_options(self): ... + def get_requested(self): ... + def get_type(self): ... + def get_type_s(self): ... + def get_mac(self): ... + def response(self, yiaddr, options: dict = ...): ... + @classmethod + def _str(cls, data): ... + @classmethod + def _pack_m(cls, sequence, format): ... + @classmethod + def _option_subnet(cls, subnet: str = ...): ... + @classmethod + def _option_router(cls, routers: list = ...): ... + @classmethod + def _option_dns(cls, servers: list = ...): ... + @classmethod + def _option_name(cls, name: str = ...): ... + @classmethod + def _option_broadcast(cls, broadcast: str = ...): ... + @classmethod + def _option_requested(cls, ip: str = ...): ... + @classmethod + def _option_lease(cls, time: int = ...): ... + @classmethod + def _option_discover(cls): ... + @classmethod + def _option_offer(cls): ... + @classmethod + def _option_request(cls): ... + @classmethod + def _option_decline(cls): ... + @classmethod + def _option_ack(cls): ... + @classmethod + def _option_nak(cls): ... + @classmethod + def _option_identifier(cls, identifier: str = ...): ... + @classmethod + def _option_renewal(cls, time: int = ...): ... + @classmethod + def _option_rebind(cls, time: int = ...): ... + @classmethod + def _option_proxy(cls, url: str = ...): ... + @classmethod + def _option_end(cls): ... + +class DHCPServer(netius.base.server.DatagramServer): + def serve(self, port: int = ..., type: int = ..., *args, **kwargs): ... + def on_data(self, address, data): ... + def on_data_dhcp(self, address, request): ... + def get_verb(self, type_r): ... + def send_dhcp(self, data, *args, **kwargs): ... + def get_type(self, request): ... + def get_options(self, request): ... + def get_yiaddr(self, request): ... diff --git a/src/typings/netius/servers/echo.pyi b/src/typings/netius/servers/echo.pyi index d80e89f8..b3d00dc7 100644 --- a/src/typings/netius/servers/echo.pyi +++ b/src/typings/netius/servers/echo.pyi @@ -1,24 +1,12 @@ -""" -This type stub file was generated by pyright. -""" - -import netius - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class EchoProtocol(netius.StreamProtocol): - ... - - -class EchoServer(netius.ServerAgent): - protocol = EchoProtocol - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.protocol + +__version__: str +__revision__: str +__date__: str + +class EchoProtocol(netius.base.protocol.StreamProtocol): ... + +class EchoServer(netius.base.agent.ServerAgent): + class protocol(netius.base.protocol.StreamProtocol): ... diff --git a/src/typings/netius/servers/echo_ws.pyi b/src/typings/netius/servers/echo_ws.pyi index fca1044f..3fe84799 100644 --- a/src/typings/netius/servers/echo_ws.pyi +++ b/src/typings/netius/servers/echo_ws.pyi @@ -1,22 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -from . import ws - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class EchoWSServer(ws.WSServer): - def on_data_ws(self, connection, data): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius.servers.ws +import netius.servers.ws as ws + +__version__: str +__revision__: str +__date__: str + +class EchoWSServer(netius.servers.ws.WSServer): + def on_data_ws(self, connection, data): ... diff --git a/src/typings/netius/servers/ftp.pyi b/src/typings/netius/servers/ftp.pyi index 2cca3ee3..7f647a74 100644 --- a/src/typings/netius/servers/ftp.pyi +++ b/src/typings/netius/servers/ftp.pyi @@ -1,201 +1,81 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_SIZE = ... -CAPABILITIES = ... -PERMISSIONS = ... -TYPES = ... -class FTPConnection(netius.Connection): - def __init__(self, base_path=..., host=..., mode=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def parse(self, data): # -> int: - ... - - def send_ftp(self, code, message=..., lines=..., simple=..., delay=..., callback=...): # -> int: - ... - - def send_ftp_base(self, code, message=..., delay=..., callback=...): # -> int: - ... - - def send_ftp_lines(self, code, message=..., lines=..., simple=..., delay=..., callback=...): # -> int: - ... - - def ready(self): # -> None: - ... - - def ok(self): # -> None: - ... - - def not_ok(self): # -> None: - ... - - def flush_ftp(self): # -> None: - ... - - def data_ftp(self, data): # -> None: - ... - - def closed_ftp(self): # -> None: - ... - - def flush_list(self): # -> None: - ... - - def flush_retr(self): # -> None: - ... - - def flush_stor(self): # -> None: - ... - - def on_flush_list(self, connection): # -> None: - ... - - def on_flush_retr(self, connection): # -> None: - ... - - def on_line(self, code, message, is_final=...): # -> None: - ... - - def on_user(self, message): # -> None: - ... - - def on_syst(self, message): # -> None: - ... - - def on_feat(self, message): # -> None: - ... - - def on_opts(self, message): # -> None: - ... - - def on_pwd(self, message): # -> None: - ... - - def on_type(self, message): # -> None: - ... - - def on_pasv(self, message): # -> None: - ... - - def on_port(self, message): # -> None: - ... - - def on_dele(self, message): # -> None: - ... - - def on_mkd(self, message): # -> None: - ... - - def on_rmd(self, message): # -> None: - ... - - def on_rnfr(self, message): # -> None: - ... - - def on_rnto(self, message): # -> None: - ... - - def on_cdup(self, message): # -> None: - ... - - def on_cwd(self, message): # -> None: - ... - - def on_size(self, message): # -> None: - ... - - def on_mdtm(self, message): # -> None: - ... - - def on_noop(self, message): # -> None: - ... - - def on_quit(self, message): # -> None: - ... - - def on_list(self, message): # -> None: - ... - - def on_retr(self, message): # -> None: - ... - - def on_stor(self, message): # -> None: - ... - - - -class FTPDataServer(netius.StreamServer): - def __init__(self, connection, container, *args, **kwargs) -> None: - ... - - def on_connection_c(self, connection): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def send_ftp(self, data, delay=..., force=..., callback=...): - ... - - def flush_ftp(self): # -> None: - ... - - def close_ftp(self): # -> None: - ... - - - -class FTPServer(netius.ContainerServer): - """ - Abstract ftp server implementation that handles authentication - and file system based file serving. - - Note that the ftp server does not support multiple user handling - and runs only as the user running the current process. - - :see: http://tools.ietf.org/html/rfc959 - """ - def __init__(self, base_path=..., auth_s=..., *args, **kwargs) -> None: - ... - - def serve(self, host=..., port=..., *args, **kwargs): # -> None: - ... - - def on_connection_c(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> FTPConnection: - ... - - def on_line_ftp(self, connection, code, message): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.conn +import netius.base.container +import netius.base.server +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +BUFFER_SIZE: int +CAPABILITIES: tuple +PERMISSIONS: dict +TYPES: dict + +class FTPConnection(netius.base.conn.BaseConnection): + def __init__(self, base_path: str = ..., host: str = ..., mode: str = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def parse(self, data): ... + def send_ftp(self, code, message: str = ..., lines: tuple = ..., simple: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_ftp_base(self, code, message: str = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_ftp_lines(self, code, message: str = ..., lines: tuple = ..., simple: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def ready(self): ... + def ok(self): ... + def not_ok(self): ... + def flush_ftp(self): ... + def data_ftp(self, data): ... + def closed_ftp(self): ... + def flush_list(self): ... + def flush_retr(self): ... + def flush_stor(self): ... + def on_flush_list(self, connection): ... + def on_flush_retr(self, connection): ... + def on_line(self, code, message, is_final: bool = ...): ... + def on_user(self, message): ... + def on_syst(self, message): ... + def on_feat(self, message): ... + def on_opts(self, message): ... + def on_pwd(self, message): ... + def on_type(self, message): ... + def on_pasv(self, message): ... + def on_port(self, message): ... + def on_dele(self, message): ... + def on_mkd(self, message): ... + def on_rmd(self, message): ... + def on_rnfr(self, message): ... + def on_rnto(self, message): ... + def on_cdup(self, message): ... + def on_cwd(self, message): ... + def on_size(self, message): ... + def on_mdtm(self, message): ... + def on_noop(self, message): ... + def on_quit(self, message): ... + def on_list(self, message): ... + def on_retr(self, message): ... + def on_stor(self, message): ... + def _file_send(self, connection): ... + def _file_finish(self, connection): ... + def _data_open(self): ... + def _data_close(self): ... + def _list(self): ... + def _to_unix(self, mode): ... + def _get_path(self, extra: Incomplete | None = ...): ... + +class FTPDataServer(netius.base.server.StreamServer): + def __init__(self, connection, container, *args, **kwargs) -> None: ... + def on_connection_c(self, connection): ... + def on_connection_d(self, connection): ... + def on_data(self, connection, data): ... + def send_ftp(self, data, delay: bool = ..., force: bool = ..., callback: Incomplete | None = ...): ... + def flush_ftp(self): ... + def close_ftp(self): ... + +class FTPServer(netius.base.container.ContainerServer): + def __init__(self, base_path: str = ..., auth_s: str = ..., *args, **kwargs) -> None: ... + def serve(self, host: str = ..., port: int = ..., *args, **kwargs): ... + def on_connection_c(self, connection): ... + def on_data(self, connection, data): ... + def on_serve(self): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def on_line_ftp(self, connection, code, message): ... diff --git a/src/typings/netius/servers/http.pyi b/src/typings/netius/servers/http.pyi index 0714e55a..938d48a9 100644 --- a/src/typings/netius/servers/http.pyi +++ b/src/typings/netius/servers/http.pyi @@ -1,170 +1,99 @@ -""" -This type stub file was generated by pyright. -""" - -import contextlib - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -Z_PARTIAL_FLUSH = ... -ENCODING_MAP = ... -class HTTPConnection(netius.Connection): - def __init__(self, encoding=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, Any | None]: - ... - - def flush(self, stream=..., callback=...): # -> None: - ... - - def flush_s(self, stream=..., callback=...): # -> None: - ... - - def send_base(self, data, stream=..., final=..., delay=..., callback=...): # -> int | None: - ... - - def send_plain(self, data, stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_chunked(self, data, stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_gzip(self, data, stream=..., final=..., delay=..., callback=..., level=...): # -> int: - ... - - def send_response(self, data=..., headers=..., version=..., code=..., code_s=..., apply=..., stream=..., final=..., flush=..., delay=..., callback=...): - ... - - def send_header(self, headers=..., version=..., code=..., code_s=..., stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_part(self, data, stream=..., final=..., flush=..., delay=..., callback=...): # -> int | None: - ... - - def parse(self, data): # -> int | Any | None: - ... - - def resolve_encoding(self, parser): # -> None: - ... - - def set_encoding(self, encoding): # -> None: - ... - - def set_uncompressed(self): # -> None: - ... - - def set_plain(self): # -> None: - ... - - def set_chunked(self): # -> None: - ... - - def set_gzip(self): # -> None: - ... - - def set_deflate(self): # -> None: - ... - - def is_plain(self): # -> bool: - ... - - def is_chunked(self): # -> bool: - ... - - def is_gzip(self): # -> bool: - ... - - def is_deflate(self): # -> bool: - ... - - def is_compressed(self): # -> bool: - ... - - def is_uncompressed(self): # -> bool: - ... - - def is_flushed(self): # -> bool: - ... - - def is_measurable(self, strict=...): # -> bool: - ... - - def on_data(self): # -> None: - ... - - @contextlib.contextmanager - def ctx_request(self, args=..., kwargs=...): # -> Generator[None, Any, None]: - ... - - @property - def connection_ctx(self): # -> Self: - ... - - @property - def parser_ctx(self): # -> HTTPParser | None: - ... - - - -class HTTPServer(netius.StreamServer): - """ - Base class for serving of the HTTP protocol, should contain - the basic utilities for handling an HTTP request including - headers and read of data. - """ - BASE_HEADERS = ... - def __init__(self, encoding=..., common_log=..., *args, **kwargs) -> None: - ... - - @classmethod - def build_data(cls, text, url=..., trace=..., style=..., style_urls=..., encode=..., encoding=...): # -> LiteralString | bytes | str: - ... - - @classmethod - def build_text(cls, text, trace=..., style=..., style_urls=..., encode=..., encoding=...): # -> str | bytes: - ... - - @classmethod - def build_iframe(cls, text, url, style=..., style_urls=..., encode=..., encoding=...): # -> LiteralString | bytes: - ... - - def cleanup(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> HTTPConnection: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - def on_send_http(self, connection, parser, headers=..., version=..., code=..., code_s=...): # -> None: - ... - - def on_flush_http(self, connection, parser, encoding=...): # -> None: - ... - - def authorize(self, connection, parser, auth=..., **kwargs): # -> bool: - ... - - - +import netius as netius +import netius.base.conn +import netius.base.server +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +PLAIN_ENCODING: int +CHUNKED_ENCODING: int +GZIP_ENCODING: int +DEFLATE_ENCODING: int +Z_PARTIAL_FLUSH: int +ENCODING_MAP: dict + +class HTTPConnection(netius.base.conn.BaseConnection): + def __init__(self, encoding: int = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + def flush(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def flush_s(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def send_base(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_plain(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_chunked(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_gzip(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ..., level: int = ...): ... + def send_response(self, data: Incomplete | None = ..., headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ..., apply: bool = ..., stream: Incomplete | None = ..., final: bool = ..., flush: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_header(self, headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ..., stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_part(self, data, stream: Incomplete | None = ..., final: bool = ..., flush: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def parse(self, data): ... + def resolve_encoding(self, parser): ... + def set_encoding(self, encoding): ... + def set_uncompressed(self): ... + def set_plain(self): ... + def set_chunked(self): ... + def set_gzip(self): ... + def set_deflate(self): ... + def is_plain(self): ... + def is_chunked(self): ... + def is_gzip(self): ... + def is_deflate(self): ... + def is_compressed(self): ... + def is_uncompressed(self): ... + def is_flushed(self): ... + def is_measurable(self, strict: bool = ...): ... + def on_data(self): ... + def ctx_request(self, *args, **kwds): ... + def _flush_plain(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def _flush_chunked(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def _flush_gzip(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def _get_gzip(self, stream, level: int = ..., ensure: bool = ...): ... + def _set_gzip(self, stream, gzip): ... + def _unset_gzip(self, stream): ... + def _close_gzip(self, safe: bool = ...): ... + @property + def connection_ctx(self): ... + @property + def parser_ctx(self): ... + +class HTTPServer(netius.base.server.StreamServer): + BASE_HEADERS: ClassVar[dict] = ... + def __init__(self, encoding: str = ..., common_log: Incomplete | None = ..., *args, **kwargs) -> None: ... + @classmethod + def build_data(cls, text, url: Incomplete | None = ..., trace: bool = ..., style: bool = ..., style_urls: list = ..., encode: bool = ..., encoding: str = ...): ... + @classmethod + def build_text(cls, text, trace: bool = ..., style: bool = ..., style_urls: list = ..., encode: bool = ..., encoding: str = ...): ... + @classmethod + def build_iframe(cls, text, url, style: bool = ..., style_urls: list = ..., encode: bool = ..., encoding: str = ...): ... + @classmethod + def _gen_text(cls, text, trace: bool = ..., style: bool = ..., style_urls: list = ...): ... + @classmethod + def _gen_iframe(cls, text, url, style: bool = ..., style_urls: list = ...): ... + @classmethod + def _gen_header(cls, title, meta: bool = ..., style: bool = ..., style_urls: list = ...): ... + @classmethod + def _gen_footer(cls): ... + @classmethod + def _gen_style(cls): ... + def cleanup(self): ... + def info_dict(self, full: bool = ...): ... + def on_data(self, connection, data): ... + def on_serve(self): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def on_data_http(self, connection, parser): ... + def on_send_http(self, connection, parser, headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ...): ... + def on_flush_http(self, connection, parser, encoding: Incomplete | None = ...): ... + def authorize(self, connection, parser, auth: Incomplete | None = ..., **kwargs): ... + def _apply_all(self, parser, connection, headers, upper: bool = ..., normalize: bool = ..., replace: bool = ...): ... + def _apply_base(self, headers, replace: bool = ...): ... + def _apply_parser(self, parser, headers, replace: bool = ...): ... + def _apply_connection(self, connection, headers, strict: bool = ...): ... + def _headers_upper(self, headers): ... + def _headers_normalize(self, headers): ... + def _authorization(self, parser): ... + def _write_common(self, message, encoding: str = ...): ... + def _log_request(self, connection, parser, *args, **kwargs): ... + def _log_request_basic(self, connection, parser, output: Incomplete | None = ...): ... + def _log_request_common(self, connection, parser, headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ..., size_s: Incomplete | None = ..., username: str = ..., output: Incomplete | None = ...): ... diff --git a/src/typings/netius/servers/http2.pyi b/src/typings/netius/servers/http2.pyi index abe6572f..526e45d2 100644 --- a/src/typings/netius/servers/http2.pyi +++ b/src/typings/netius/servers/http2.pyi @@ -1,323 +1,109 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class HTTP2Connection(http.HTTPConnection): - def __init__(self, legacy=..., window=..., settings=..., settings_r=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, Any | None]: - ... - - def flush_s(self, stream=..., callback=...): # -> int | None: - ... - - def set_h2(self): # -> None: - ... - - def parse(self, data): # -> int | Any | None: - ... - - def parse_preface(self, data): # -> None: - """ - Tries to run the parsing on the preface part of the - connection establishment using the provided data - note that the data is buffered in case the proper size - has not been reached for proper validation. - - This should be the first step when trying to establish - a proper HTTP 2 connection. - - :type data: String - :param data: The data buffer that is going to be used to - try to parse the connection preface. - :rtype: String - :return: The resulting data after the preface has been - parsed, this should be empty or invalid in case no data - is pending to be parsed. - """ - ... - - def send_plain(self, data, stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_chunked(self, data, stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_fragmented(self, data, stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_response(self, data=..., headers=..., version=..., code=..., code_s=..., apply=..., stream=..., final=..., flush=..., delay=..., callback=...): - ... - - def send_header(self, headers=..., version=..., code=..., code_s=..., stream=..., final=..., delay=..., callback=...): # -> int: - ... - - def send_part(self, data, stream=..., final=..., flush=..., delay=..., callback=...): # -> int | None: - ... - - def send_frame(self, type=..., flags=..., payload=..., stream=..., delay=..., callback=...): # -> int: - ... - - def send_data(self, data=..., end_stream=..., stream=..., delay=..., callback=...): # -> int: - ... - - def send_headers(self, headers=..., end_stream=..., end_headers=..., stream=..., delay=..., callback=...): # -> int: - ... - - def send_rst_stream(self, error_code=..., stream=..., delay=..., callback=...): # -> int: - ... - - def send_settings(self, settings=..., ack=..., delay=..., callback=...): # -> int: - ... - - def send_ping(self, opaque=..., ack=..., delay=..., callback=...): # -> int: - ... - - def send_goaway(self, last_stream=..., error_code=..., message=..., close=..., delay=..., callback=...): # -> int: - ... - - def send_window_update(self, increment=..., stream=..., delay=..., callback=...): # -> int: - ... - - def send_delta(self): # -> None: - ... - - def delay_frame(self, *args, **kwargs): # -> Literal[0]: - ... - - def flush_frames(self, all=...): # -> bool: - """ - Runs the flush operation on the delayed/pending frames, meaning - that the window/availability tests are going to be run, checking - if the various streams and connection are ready for sending the - frames. - - In case the all flag is active the complete set of frames are going - to be tested for sending, this operation implies more resource usage. - - This method should be called after a window update frame is - received so that the pending frames may be sent. - - :type all: bool - :param all: If the complete set of frames should be tested, or - if instead at the first testing fail the control flow should be - returned immediately. - :rtype: bool - :return: If all the pending frames have been successfully flushed. - """ - ... - - def flush_available(self): # -> None: - """ - Runs the (became) available flush operation that tries to determine - all the streams that were under the "blocked" state and became - "unblocked", notifying them about that "edge" operation. - - This operation must be performed after any of the blocking constraints - is changed (eg: connection window, stream window, etc.). - """ - ... - - def set_settings(self, settings): # -> None: - ... - - def close_stream(self, stream, final=..., flush=..., reset=...): # -> None: - ... - - def available_stream(self, stream, length, strict=...): # -> bool: - ... - - def fragment_stream(self, stream, data): - ... - - def fragmentable_stream(self, stream, data): - ... - - def open_stream(self, stream): # -> bool: - ... - - def try_available(self, stream, strict=...): # -> None: - """ - Tries to determine if the stream with the provided identifier - has just became available (unblocked from blocked state), this - happens when the required window value (either connection or - stream is increased properly). - - :type stream: int - :param stream: The identifier of the stream that is going to - be tested from proper connection availability. - :type strict: bool - :param strict: If the strict mode should be used in the availability - testing, this implies extra verifications. - """ - ... - - def try_unavailable(self, stream, strict=...): # -> None: - """ - Runs the unavailability test on the stream with the provided identifier - meaning that a series of validation will be performed to try to determine - if for some reason is not possible to send any more data frames to the - stream until some window changes. A stream that is under the unavailable - state is considered "blocked". - - :type stream: int - :param stream: The identifier of the stream that is going to - be tested from proper connection unavailability. - :type strict: bool - :param strict: If the strict mode should be used in the availability - testing, this implies extra verifications. - """ - ... - - def increment_remote(self, stream, increment, all=...): # -> None: - """ - Increments the size of the remove window associated with - the stream passed by argument by the size defined in the - increment field (in bytes). - - If the stream is not provided or invalid the global window - is updated instead of the stream one. - - :type stream: int - :param stream: The identifier of the stream that is going - to have its window incremented, or invalid if the global - connection window is meant to be updated. - :type increment: int - :param increment: The increment in bytes for the window, - this value may be negative for decrement operations. - :type all: bool - :param all: If all the resources (connection and stream) - should be updated by the increment operation. - """ - ... - - def increment_local(self, stream, increment): # -> None: - ... - - def error_connection(self, last_stream=..., error_code=..., message=..., close=..., callback=...): # -> None: - ... - - def error_stream(self, stream, last_stream=..., error_code=..., message=..., close=..., callback=...): # -> None: - ... - - def on_header(self, header): # -> None: - ... - - def on_payload(self): # -> None: - ... - - def on_frame(self): # -> None: - ... - - def on_data_h2(self, stream, contents): # -> None: - ... - - def on_headers_h2(self, stream): # -> None: - ... - - def on_rst_stream(self, stream, error_code): # -> None: - ... - - def on_settings(self, settings, ack): # -> None: - ... - - def on_ping(self, opaque, ack): # -> None: - ... - - def on_goaway(self, last_stream, error_code, extra): # -> None: - ... - - def on_window_update(self, stream, increment): # -> None: - ... - - def on_continuation(self, stream): # -> None: - ... - - def is_throttleable(self): # -> bool: - ... - - @property - def connection_ctx(self): # -> Self: - ... - - @property - def parser_ctx(self): # -> HTTPParser | HTTP2Parser | None: - ... - - - -class HTTP2Server(http.HTTPServer): - def __init__(self, legacy=..., safe=..., settings=..., *args, **kwargs) -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def get_protocols(self): # -> list[Any]: - ... - - def build_connection(self, socket, address, ssl=...): # -> HTTP2Connection: - ... - - def on_exception(self, exception, connection): # -> None: - ... - - def on_ssl(self, connection): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_preface_http2(self, connection, parser): # -> None: - ... - - def on_header_http2(self, connection, parser, header): # -> None: - ... - - def on_payload_http2(self, connection, parser): # -> None: - ... - - def on_frame_http2(self, connection, parser): # -> None: - ... - - def on_data_http2(self, connection, parser, stream, contents): # -> None: - ... - - def on_headers_http2(self, connection, parser, stream): # -> None: - ... - - def on_rst_stream_http2(self, connection, parser, stream, error_code): # -> None: - ... - - def on_settings_http2(self, connection, parser, settings, ack): # -> None: - ... - - def on_ping_http2(self, connection, parser, opaque, ack): # -> None: - ... - - def on_goaway_http2(self, connection, parser, last_stream, error_code, extra): # -> None: - ... - - def on_window_update_http2(self, connection, parser, stream, increment): # -> None: - ... - - def on_continuation_http2(self, connection, parser, stream): # -> None: - ... - - def on_send_http2(self, connection, parser, type, flags, payload, stream): # -> None: - ... - - - +import netius as netius +import netius.servers.http +import netius.servers.http as http +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str + +class HTTP2Connection(netius.servers.http.HTTPConnection): + def __init__(self, legacy: bool = ..., window: int = ..., settings: dict = ..., settings_r: dict = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def info_dict(self, full: bool = ...): ... + def flush_s(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def set_h2(self): ... + def parse(self, data): ... + def parse_preface(self, data): ... + def send_plain(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_chunked(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_fragmented(self, data, stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_response(self, data: Incomplete | None = ..., headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ..., apply: bool = ..., stream: Incomplete | None = ..., final: bool = ..., flush: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_header(self, headers: Incomplete | None = ..., version: Incomplete | None = ..., code: int = ..., code_s: Incomplete | None = ..., stream: Incomplete | None = ..., final: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_part(self, data, stream: Incomplete | None = ..., final: bool = ..., flush: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_frame(self, type: int = ..., flags: int = ..., payload: bytes = ..., stream: int = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_data(self, data: bytes = ..., end_stream: bool = ..., stream: Incomplete | None = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_headers(self, headers: list = ..., end_stream: bool = ..., end_headers: bool = ..., stream: Incomplete | None = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_rst_stream(self, error_code: int = ..., stream: Incomplete | None = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_settings(self, settings: tuple = ..., ack: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_ping(self, opaque: bytes = ..., ack: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_goaway(self, last_stream: int = ..., error_code: int = ..., message: str = ..., close: bool = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_window_update(self, increment: int = ..., stream: Incomplete | None = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_delta(self): ... + def delay_frame(self, *args, **kwargs): ... + def flush_frames(self, all: bool = ...): ... + def flush_available(self): ... + def set_settings(self, settings): ... + def close_stream(self, stream, final: bool = ..., flush: bool = ..., reset: bool = ...): ... + def available_stream(self, stream, length, strict: bool = ...): ... + def fragment_stream(self, stream, data): ... + def fragmentable_stream(self, stream, data): ... + def open_stream(self, stream): ... + def try_available(self, stream, strict: bool = ...): ... + def try_unavailable(self, stream, strict: bool = ...): ... + def increment_remote(self, stream, increment, all: bool = ...): ... + def increment_local(self, stream, increment): ... + def error_connection(self, last_stream: int = ..., error_code: int = ..., message: str = ..., close: bool = ..., callback: Incomplete | None = ...): ... + def error_stream(self, stream, last_stream: int = ..., error_code: int = ..., message: str = ..., close: bool = ..., callback: Incomplete | None = ...): ... + def on_header(self, header): ... + def on_payload(self): ... + def on_frame(self): ... + def on_data_h2(self, stream, contents): ... + def on_headers_h2(self, stream): ... + def on_rst_stream(self, stream, error_code): ... + def on_settings(self, settings, ack): ... + def on_ping(self, opaque, ack): ... + def on_goaway(self, last_stream, error_code, extra): ... + def on_window_update(self, stream, increment): ... + def on_continuation(self, stream): ... + def is_throttleable(self): ... + def _build_c(self, callback, stream, data_l): ... + def _flush_plain(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + def _flush_chunked(self, stream: Incomplete | None = ..., callback: Incomplete | None = ...): ... + @property + def connection_ctx(self): ... + @property + def parser_ctx(self): ... + +class HTTP2Server(netius.servers.http.HTTPServer): + def __init__(self, legacy: bool = ..., safe: bool = ..., settings: dict = ..., *args, **kwargs) -> None: ... + @classmethod + def _has_hpack(cls): ... + @classmethod + def _has_alpn(cls): ... + @classmethod + def _has_npn(cls): ... + def info_dict(self, full: bool = ...): ... + def get_protocols(self): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def on_exception(self, exception, connection): ... + def on_ssl(self, connection): ... + def on_serve(self): ... + def on_preface_http2(self, connection, parser): ... + def on_header_http2(self, connection, parser, header): ... + def on_payload_http2(self, connection, parser): ... + def on_frame_http2(self, connection, parser): ... + def on_data_http2(self, connection, parser, stream, contents): ... + def on_headers_http2(self, connection, parser, stream): ... + def on_rst_stream_http2(self, connection, parser, stream, error_code): ... + def on_settings_http2(self, connection, parser, settings, ack): ... + def on_ping_http2(self, connection, parser, opaque, ack): ... + def on_goaway_http2(self, connection, parser, last_stream, error_code, extra): ... + def on_window_update_http2(self, connection, parser, stream, increment): ... + def on_continuation_http2(self, connection, parser, stream): ... + def on_send_http2(self, connection, parser, type, flags, payload, stream): ... + def _has_h2(self): ... + def _has_all_h2(self): ... + def _handle_exception(self, exception, connection): ... + def _log_frame(self, connection, parser): ... + def _log_error(self, error_code, extra): ... + def _log_send(self, connection, parser, type, flags, payload, stream): ... + def _log_window(self, parser, stream, remote: bool = ...): ... + def _log_frame_details(self, parser, type_s, flags, payload, stream, out): ... + def _log_frame_flags(self, type_s, *args): ... + def _log_frame_data(self, parser, flags, payload, stream, out): ... + def _log_frame_headers(self, parser, flags, payload, stream, out): ... + def _log_frame_rst_stream(self, parser, flags, payload, stream, out): ... + def _log_frame_goaway(self, parser, flags, payload, stream, out): ... + def _log_frame_window_update(self, parser, flags, payload, stream, out): ... + def _flags_l(self, flags, definition): ... diff --git a/src/typings/netius/servers/mjpg.pyi b/src/typings/netius/servers/mjpg.pyi index 5648ba4a..066260d7 100644 --- a/src/typings/netius/servers/mjpg.pyi +++ b/src/typings/netius/servers/mjpg.pyi @@ -1,42 +1,15 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http2 - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BOUNDARY = ... -class MJPGServer(http2.HTTP2Server): - """ - Server class for the creation of an HTTP server for - the providing of a motion JPEG stream (as in spec). - - This class should only be seen as a foundation and - proper implementation should be made from this. - """ - def __init__(self, boundary=..., *args, **kwargs) -> None: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - def on_send_mjpg(self, connection): # -> None: - ... - - def get_delay(self, connection): # -> Literal[1]: - ... - - def get_image(self, connection): # -> bytes: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.http2 +import netius.servers.http2 as http2 + +__version__: str +__revision__: str +__date__: str +BOUNDARY: str + +class MJPGServer(netius.servers.http2.HTTP2Server): + def __init__(self, boundary: str = ..., *args, **kwargs) -> None: ... + def on_data_http(self, connection, parser): ... + def on_send_mjpg(self, connection): ... + def get_delay(self, connection): ... + def get_image(self, connection): ... diff --git a/src/typings/netius/servers/pop.pyi b/src/typings/netius/servers/pop.pyi index cad07bd1..ae76fe71 100644 --- a/src/typings/netius/servers/pop.pyi +++ b/src/typings/netius/servers/pop.pyi @@ -1,159 +1,63 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -INITIAL_STATE = ... -HELO_STATE = ... -AUTH_STATE = ... -SESSION_STATE = ... -CHUNK_SIZE = ... -CAPABILITIES = ... -AUTH_METHODS = ... -class POPConnection(netius.Connection): - def __init__(self, host=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def parse(self, data): # -> int | None: - ... - - def send_pop(self, message=..., lines=..., status=..., delay=..., callback=...): # -> int: - ... - - def ready(self): # -> None: - ... - - def starttls(self): # -> None: - ... - - def capa(self): # -> None: - ... - - def auth(self): # -> None: - ... - - def accept(self): # -> None: - ... - - def stat(self): # -> None: - ... - - def list(self): # -> None: - ... - - def uidl(self): # -> None: - ... - - def retr(self, index): # -> None: - ... - - def dele(self, index): # -> None: - ... - - def bye(self): # -> None: - ... - - def ok(self): # -> None: - ... - - def not_implemented(self): # -> None: - ... - - def on_line(self, code, message): # -> None: - ... - - def on_stls(self, message): # -> None: - ... - - def on_capa(self, message): # -> None: - ... - - def on_auth(self, message): # -> None: - ... - - def on_stat(self, message): # -> None: - ... - - def on_list(self, message): # -> None: - ... - - def on_uidl(self, message): # -> None: - ... - - def on_retr(self, message): # -> None: - ... - - def on_dele(self, message): # -> None: - ... - - def on_quit(self, message): # -> None: - ... - - def on_user(self, token): # -> None: - ... - - def assert_s(self, expected): # -> None: - ... - - - -class POPServer(netius.StreamServer): - def __init__(self, adapter_s=..., auth_s=..., *args, **kwargs) -> None: - ... - - def serve(self, host=..., port=..., *args, **kwargs): # -> None: - ... - - def on_connection_c(self, connection): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> POPConnection: - ... - - def on_line_pop(self, connection, code, message): # -> None: - ... - - def on_auth_pop(self, connection, username, password): # -> None: - ... - - def on_stat_pop(self, connection): # -> None: - ... - - def on_list_pop(self, connection): # -> None: - ... - - def on_uidl_pop(self, connection): # -> None: - ... - - def on_retr_pop(self, connection, index): # -> None: - ... - - def on_dele_pop(self, connection, index): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.conn +import netius.base.server +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +INITIAL_STATE: int +HELO_STATE: int +AUTH_STATE: int +SESSION_STATE: int +CHUNK_SIZE: int +CAPABILITIES: tuple +AUTH_METHODS: tuple + +class POPConnection(netius.base.conn.BaseConnection): + def __init__(self, host: str = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def parse(self, data): ... + def send_pop(self, message: str = ..., lines: tuple = ..., status: str = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def ready(self): ... + def starttls(self): ... + def capa(self): ... + def auth(self): ... + def accept(self): ... + def stat(self): ... + def list(self): ... + def uidl(self): ... + def retr(self, index): ... + def dele(self, index): ... + def bye(self): ... + def ok(self): ... + def not_implemented(self): ... + def on_line(self, code, message): ... + def on_stls(self, message): ... + def on_capa(self, message): ... + def on_auth(self, message): ... + def on_stat(self, message): ... + def on_list(self, message): ... + def on_uidl(self, message): ... + def on_retr(self, message): ... + def on_dele(self, message): ... + def on_quit(self, message): ... + def on_user(self, token): ... + def assert_s(self, expected): ... + +class POPServer(netius.base.server.StreamServer): + def __init__(self, adapter_s: str = ..., auth_s: str = ..., *args, **kwargs) -> None: ... + def serve(self, host: str = ..., port: int = ..., *args, **kwargs): ... + def on_connection_c(self, connection): ... + def on_connection_d(self, connection): ... + def on_data(self, connection, data): ... + def on_serve(self): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def on_line_pop(self, connection, code, message): ... + def on_auth_pop(self, connection, username, password): ... + def on_stat_pop(self, connection): ... + def on_list_pop(self, connection): ... + def on_uidl_pop(self, connection): ... + def on_retr_pop(self, connection, index): ... + def on_dele_pop(self, connection, index): ... diff --git a/src/typings/netius/servers/proxy.pyi b/src/typings/netius/servers/proxy.pyi index 7074ab10..aa7f4e98 100644 --- a/src/typings/netius/servers/proxy.pyi +++ b/src/typings/netius/servers/proxy.pyi @@ -1,93 +1,56 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http2 - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -BUFFER_RATIO = ... -MIN_RATIO = ... -MAX_PENDING = ... -class ProxyConnection(http2.HTTP2Connection): - def open(self, *args, **kwargs): # -> None: - ... - - def resolve_encoding(self, parser): # -> None: - ... - - def set_h2(self): # -> None: - ... - - def on_headers(self): # -> None: - ... - - def on_partial(self, data): # -> None: - ... - - def on_available(self): # -> None: - ... - - def on_unavailable(self): # -> None: - ... - - - -class ProxyServer(http2.HTTP2Server): - def __init__(self, dynamic=..., throttle=..., trust_origin=..., max_pending=..., *args, **kwargs) -> None: - ... - - def start(self): # -> None: - ... - - def stop(self): # -> None: - ... - - def cleanup(self): # -> None: - ... - - def info_dict(self, full=...): # -> dict[str, str | Any]: - ... - - def connections_dict(self, full=..., parent=...): # -> list[Any] | dict[Any, Any]: - ... - - def connection_dict(self, id, full=...): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_stream_d(self, stream): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - def on_headers(self, connection, parser): # -> None: - ... - - def on_partial(self, connection, parser, data): # -> None: - ... - - def on_available(self, connection, parser): # -> None: - ... - - def on_unavailable(self, connection, parser): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> ProxyConnection: - ... - - - +import netius as netius +import netius.servers.http as http +import netius.servers.http2 +import netius.servers.http2 as http2 + +__version__: str +__revision__: str +__date__: str +BUFFER_RATIO: float +MIN_RATIO: float +MAX_PENDING: int + +class ProxyConnection(netius.servers.http2.HTTP2Connection): + def open(self, *args, **kwargs): ... + def resolve_encoding(self, parser): ... + def set_h2(self): ... + def on_headers(self): ... + def on_partial(self, data): ... + def on_available(self): ... + def on_unavailable(self): ... + +class ProxyServer(netius.servers.http2.HTTP2Server): + def __init__(self, dynamic: bool = ..., throttle: bool = ..., trust_origin: bool = ..., max_pending: int = ..., *args, **kwargs) -> None: ... + def start(self): ... + def stop(self): ... + def cleanup(self): ... + def info_dict(self, full: bool = ...): ... + def connections_dict(self, full: bool = ..., parent: bool = ...): ... + def connection_dict(self, id, full: bool = ...): ... + def on_data(self, connection, data): ... + def on_connection_d(self, connection): ... + def on_stream_d(self, stream): ... + def on_serve(self): ... + def on_data_http(self, connection, parser): ... + def on_headers(self, connection, parser): ... + def on_partial(self, connection, parser, data): ... + def on_available(self, connection, parser): ... + def on_unavailable(self, connection, parser): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def _throttle(self, _connection): ... + def _prx_close(self, connection): ... + def _prx_keep(self, connection): ... + def _prx_throttle(self, connection): ... + def _raw_throttle(self, connection): ... + def _on_prx_headers(self, client, parser, headers): ... + def _on_prx_message(self, client, parser, message): ... + def _on_prx_partial(self, client, parser, data): ... + def _on_prx_connect(self, client, _connection): ... + def _on_prx_acquire(self, client, _connection): ... + def _on_prx_close(self, client, _connection): ... + def _on_prx_error(self, client, _connection, error): ... + def _on_raw_connect(self, client, _connection): ... + def _on_raw_data(self, client, _connection, data): ... + def _on_raw_close(self, client, _connection): ... + def _apply_headers(self, parser, connection, parser_prx, headers, upper: bool = ...): ... + def _apply_via(self, parser_prx, headers): ... diff --git a/src/typings/netius/servers/smtp.pyi b/src/typings/netius/servers/smtp.pyi index dcce0c1e..b3aea996 100644 --- a/src/typings/netius/servers/smtp.pyi +++ b/src/typings/netius/servers/smtp.pyi @@ -1,163 +1,70 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -INITIAL_STATE = ... -HELO_STATE = ... -HEADER_STATE = ... -DATA_STATE = ... -USERNAME_STATE = ... -PASSWORD_STATE = ... -TERMINATION_SIZE = ... -CAPABILITIES = ... -class SMTPConnection(netius.Connection): - def __init__(self, host=..., *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def parse(self, data): # -> int | None: - ... - - def send_smtp(self, code, message=..., lines=..., delay=..., callback=...): # -> int: - ... - - def send_smtp_base(self, code, message=..., delay=..., callback=...): # -> int: - ... - - def send_smtp_lines(self, code, message=..., lines=..., delay=..., callback=...): # -> int: - ... - - def ready(self): # -> None: - ... - - def helo(self, host): # -> None: - ... - - def ehlo(self, host): # -> None: - ... - - def starttls(self): # -> None: - ... - - def auth(self, method, data): # -> None: - ... - - def auth_plain(self, data): # -> None: - ... - - def auth_login(self, data): # -> None: - ... - - def data(self): # -> None: - ... - - def queued(self, index=...): # -> None: - ... - - def bye(self): # -> None: - ... - - def ok(self): # -> None: - ... - - def not_implemented(self): # -> None: - ... - - def on_username(self, data): # -> None: - ... - - def on_password(self, data): # -> None: - ... - - def on_raw_data(self, data): # -> None: - ... - - def on_line(self, code, message, is_final=...): # -> None: - ... - - def on_helo(self, message): # -> None: - ... - - def on_ehlo(self, message): # -> None: - ... - - def on_starttls(self, message): # -> None: - ... - - def on_auth(self, message): # -> None: - ... - - def on_mail(self, message): # -> None: - ... - - def on_rcpt(self, message): # -> None: - ... - - def on_data(self, message): # -> None: - ... - - def on_quit(self, message): # -> None: - ... - - def assert_s(self, expected): # -> None: - ... - - def to_s(self): # -> LiteralString: - ... - - def received_s(self, for_s=...): # -> str: - ... - - - -class SMTPServer(netius.StreamServer): - def __init__(self, adapter_s=..., auth_s=..., locals=..., *args, **kwargs) -> None: - ... - - def serve(self, host=..., port=..., *args, **kwargs): # -> None: - ... - - def on_connection_c(self, connection): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> SMTPConnection: - ... - - def on_line_smtp(self, connection, code, message): # -> None: - ... - - def on_auth_smtp(self, connection, username, password): # -> None: - ... - - def on_header_smtp(self, connection, from_l, to_l): # -> None: - ... - - def on_data_smtp(self, connection, data): # -> None: - ... - - def on_message_smtp(self, connection): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.conn +import netius.base.server +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +INITIAL_STATE: int +HELO_STATE: int +HEADER_STATE: int +DATA_STATE: int +USERNAME_STATE: int +PASSWORD_STATE: int +TERMINATION_SIZE: int +CAPABILITIES: tuple + +class SMTPConnection(netius.base.conn.BaseConnection): + def __init__(self, host: str = ..., *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def parse(self, data): ... + def send_smtp(self, code, message: str = ..., lines: tuple = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_smtp_base(self, code, message: str = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def send_smtp_lines(self, code, message: str = ..., lines: tuple = ..., delay: bool = ..., callback: Incomplete | None = ...): ... + def ready(self): ... + def helo(self, host): ... + def ehlo(self, host): ... + def starttls(self): ... + def auth(self, method, data): ... + def auth_plain(self, data): ... + def auth_login(self, data): ... + def data(self): ... + def queued(self, index: int = ...): ... + def bye(self): ... + def ok(self): ... + def not_implemented(self): ... + def on_username(self, data): ... + def on_password(self, data): ... + def on_raw_data(self, data): ... + def on_line(self, code, message, is_final: bool = ...): ... + def on_helo(self, message): ... + def on_ehlo(self, message): ... + def on_starttls(self, message): ... + def on_auth(self, message): ... + def on_mail(self, message): ... + def on_rcpt(self, message): ... + def on_data(self, message): ... + def on_quit(self, message): ... + def assert_s(self, expected): ... + def to_s(self): ... + def received_s(self, for_s: bool = ...): ... + +class SMTPServer(netius.base.server.StreamServer): + def __init__(self, adapter_s: str = ..., auth_s: str = ..., locals: tuple = ..., *args, **kwargs) -> None: ... + def serve(self, host: str = ..., port: int = ..., *args, **kwargs): ... + def on_connection_c(self, connection): ... + def on_data(self, connection, data): ... + def on_serve(self): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def on_line_smtp(self, connection, code, message): ... + def on_auth_smtp(self, connection, username, password): ... + def on_header_smtp(self, connection, from_l, to_l): ... + def on_data_smtp(self, connection, data): ... + def on_message_smtp(self, connection): ... + def _locals(self, sequence, prefix: str = ...): ... + def _remotes(self, sequence, prefix: str = ...): ... + def _emails(self, sequence, prefix: str = ...): ... + def _users(self, emails): ... + def _is_local(self, email): ... diff --git a/src/typings/netius/servers/socks.pyi b/src/typings/netius/servers/socks.pyi index 43fc4367..ecf14946 100644 --- a/src/typings/netius/servers/socks.pyi +++ b/src/typings/netius/servers/socks.pyi @@ -1,86 +1,42 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -GRANTED = ... -REJECTED = ... -FAILED_CLIENT = ... -FAILED_AUTH = ... -GRANTED_EXTRA = ... -BUFFER_RATIO = ... -MIN_RATIO = ... -MAX_PENDING = ... -class SOCKSConnection(netius.Connection): - def __init__(self, *args, **kwargs) -> None: - ... - - def open(self, *args, **kwargs): # -> None: - ... - - def close(self, *args, **kwargs): # -> None: - ... - - def send_response(self, status=...): # -> int: - ... - - def send_response_extra(self, status=...): # -> int: - ... - - def send_auth(self, version=..., method=...): # -> int: - ... - - def get_version(self): # -> Any | None: - ... - - def parse(self, data): # -> int | Any: - ... - - def on_data(self): # -> None: - ... - - def on_auth(self): # -> None: - ... - - - -class SOCKSServer(netius.ServerAgent): - """ - SOCKS base server class to be used as an implementation of the - RFC 1928 or SOCKSv5 and the SOCKSv4 protocols. - - There are some aspects of the implementation that may not be - performant driven for readability purposes. - """ - def __init__(self, rules=..., throttle=..., max_pending=..., *args, **kwargs) -> None: - ... - - def cleanup(self): # -> None: - ... - - def on_data(self, connection, data): # -> None: - ... - - def on_data_socks(self, connection, parser): # -> None: - ... - - def on_auth_socks(self, connection, parser): # -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> SOCKSConnection: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.agent +import netius.base.conn +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +GRANTED: int +REJECTED: int +FAILED_CLIENT: int +FAILED_AUTH: int +GRANTED_EXTRA: int +BUFFER_RATIO: float +MIN_RATIO: float +MAX_PENDING: int + +class SOCKSConnection(netius.base.conn.BaseConnection): + def __init__(self, *args, **kwargs) -> None: ... + def open(self, *args, **kwargs): ... + def close(self, *args, **kwargs): ... + def send_response(self, status: int = ...): ... + def send_response_extra(self, status: int = ...): ... + def send_auth(self, version: Incomplete | None = ..., method: int = ...): ... + def get_version(self): ... + def parse(self, data): ... + def on_data(self): ... + def on_auth(self): ... + +class SOCKSServer(netius.base.agent.ServerAgent): + def __init__(self, rules: dict = ..., throttle: bool = ..., max_pending: int = ..., *args, **kwargs) -> None: ... + def cleanup(self): ... + def on_data(self, connection, data): ... + def on_data_socks(self, connection, parser): ... + def on_auth_socks(self, connection, parser): ... + def on_connection_d(self, connection): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def _throttle(self, _connection): ... + def _raw_throttle(self, connection): ... + def _on_raw_connect(self, client, _connection): ... + def _on_raw_data(self, client, _connection, data): ... + def _on_raw_close(self, client, _connection): ... diff --git a/src/typings/netius/servers/tftp.pyi b/src/typings/netius/servers/tftp.pyi index 803e10e8..23b5a58f 100644 --- a/src/typings/netius/servers/tftp.pyi +++ b/src/typings/netius/servers/tftp.pyi @@ -1,99 +1,53 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class TFTPSession: - def __init__(self, owner, name=..., mode=...) -> None: - ... - - def close(self): # -> None: - ... - - def reset(self): # -> None: - ... - - def next(self, size=..., increment=...): # -> bytes | None: - ... - - def ack(self, size=..., increment=...): # -> bytes | None: - ... - - def increment(self): # -> None: - ... - - def get_info(self): # -> str: - ... - - def print_info(self): # -> None: - ... - - - -class TFTPRequest: - parsers_m = ... - parsers_l = ... - def __init__(self, data, session) -> None: - ... - - @classmethod - def generate(cls): # -> None: - ... - - def get_info(self): # -> str: - ... - - def print_info(self): # -> None: - ... - - def parse(self): # -> None: - ... - - def get_type(self): # -> Any: - ... - - def get_type_s(self): # -> str | None: - ... - - def response(self, options=...): - ... - - - -class TFTPServer(netius.DatagramServer): - """ - Abstract trivial ftp server implementation that handles simple - file system based file serving. - - :see: http://tools.ietf.org/html/rfc1350 - """ - ALLOWED_OPERATIONS = ... - def __init__(self, base_path=..., *args, **kwargs) -> None: - ... - - def serve(self, port=..., *args, **kwargs): # -> None: - ... - - def on_data(self, address, data): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_data_tftp(self, address, request): # -> None: - ... - - def on_error_tftp(self, address, exception): # -> None: - ... - - - -if __name__ == "__main__": - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.server +from _typeshed import Incomplete +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class TFTPSession: + def __init__(self, owner, name: Incomplete | None = ..., mode: Incomplete | None = ...) -> None: ... + def close(self): ... + def reset(self): ... + def next(self, size: int = ..., increment: bool = ...): ... + def ack(self, size: int = ..., increment: bool = ...): ... + def increment(self): ... + def get_info(self): ... + def print_info(self): ... + def _get_file(self, allow_absolute: bool = ...): ... + +class TFTPRequest: + parsers_m: ClassVar[None] = ... + parsers_l: ClassVar[None] = ... + def __init__(self, data, session) -> None: ... + @classmethod + def generate(cls): ... + def get_info(self): ... + def print_info(self): ... + def parse(self): ... + def get_type(self): ... + def get_type_s(self): ... + def response(self, options: dict = ...): ... + @classmethod + def _parse_rrq(cls, self): ... + @classmethod + def _parse_wrq(cls, self): ... + @classmethod + def _parse_data(cls, self): ... + @classmethod + def _parse_ack(cls, self): ... + @classmethod + def _parse_error(cls, self): ... + @classmethod + def _str(cls, data): ... + +class TFTPServer(netius.base.server.DatagramServer): + ALLOWED_OPERATIONS: ClassVar[tuple] = ... + def __init__(self, base_path: str = ..., *args, **kwargs) -> None: ... + def serve(self, port: int = ..., *args, **kwargs): ... + def on_data(self, address, data): ... + def on_serve(self): ... + def on_data_tftp(self, address, request): ... + def on_error_tftp(self, address, exception): ... diff --git a/src/typings/netius/servers/torrent.pyi b/src/typings/netius/servers/torrent.pyi index 1effb57d..7843fb32 100644 --- a/src/typings/netius/servers/torrent.pyi +++ b/src/typings/netius/servers/torrent.pyi @@ -1,316 +1,98 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -REFRESH_TIME = ... -ID_STRING = ... -BLOCK_SIZE = ... -THRESHOLD_END = ... -MAX_MISSING = ... -PEER_PATHS = ... -class Pieces(netius.Observable): - """ - Class that represents the logical structure of a file that is - divided into pieces and blocks as a hierarchy, this class is - responsible for the management of the data structures of such - data storage model. - - A piece is considered to be the basic unit of a torrent file - and each piece is composed by multiple blocks, note that the - number of blocks is fixed for all the pieces of a file. - """ - def __init__(self, length, number_pieces, number_blocks) -> None: - ... - - def piece(self, index): - ... - - def piece_blocks(self, index): # -> Any | int: - ... - - def piece_size(self, index): - ... - - def block(self, index, begin): - ... - - def block_size(self, index, begin): # -> Literal[16384]: - ... - - def pop_block(self, bitfield, mark=...): # -> tuple[int, int | Any, Any | Literal[16384]] | None: - ... - - def push_block(self, index, begin): # -> None: - ... - - def mark_piece(self, index, value=...): # -> None: - ... - - def mark_block(self, index, begin, value=...): # -> None: - ... - - def update_block(self, index, mark=...): # -> int: - ... - - def update_piece(self, index): # -> None: - ... - - @property - def total_pieces(self): # -> Any: - ... - - @property - def marked_pieces(self): # -> int: - ... - - @property - def missing_pieces(self, max_missing=...): # -> list[Any]: - ... - - @property - def total_blocks(self): - ... - - @property - def marked_blocks(self): # -> int: - ... - - @property - def missing_blocks(self, max_missing=...): # -> list[Any]: - ... - - - -class TorrentTask(netius.Observable): - """ - Describes a task (operation) that is going to be performed - using the peer to peer mesh network of the torrent protocol. - - Each of the download operations should be able to be described - by this task object (for latter reference). - - This should be considered the main interface to interact from - a developer point of view, as such the methods should represent - a proper easily described interface. - """ - def __init__(self, owner, target_path, torrent_path=..., info_hash=...) -> None: - ... - - def load(self): # -> None: - ... - - def unload(self): # -> None: - ... - - def on_close(self, connection): # -> None: - ... - - def ticks(self): # -> None: - ... - - def refresh(self): # -> None: - ... - - def on_choked(self, connection): # -> None: - ... - - def on_unchoked(self, connection): # -> None: - ... - - def on_block(self, pieces, index, begin): # -> None: - ... - - def on_piece(self, pieces, index): # -> None: - ... - - def on_complete(self, pieces): # -> None: - ... - - def on_dht(self, response): # -> None: - ... - - def on_tracker(self, client, parser, result): # -> None: - ... - - def load_info(self, torrent_path): # -> dict[Any, Any] | list[Any] | int | LiteralString: - ... - - def load_file(self): # -> None: - ... - - def load_single(self): # -> None: - ... - - def load_multiple(self): # -> None: - ... - - def unload_file(self): # -> None: - ... - - def load_pieces(self): # -> None: - ... - - def unload_pieces(self): # -> None: - ... - - def pieces_tracker(self): # -> None: - ... - - def set_data(self, data, index, begin): # -> None: - ... - - def write_data(self, data, offset): # -> None: - ... - - def set_dht(self, peer_t, port): # -> None: - ... - - def peers_dht(self): # -> None: - ... - - def peers_tracker(self): # -> None: - """ - Tries to retrieve as much information as possible about the - peers from the currently loaded tracker information. - - It's possible that no tracker information exits for the current - task and for such situations no state change will occur. - """ - ... - - def peers_file(self): # -> None: - ... - - def connect_peers(self): # -> None: - ... - - def disconnect_peers(self): # -> None: - ... - - def connect_peer(self, peer): # -> None: - ... - - def info_string(self): - ... - - def left(self): - ... - - def speed(self): # -> float: - """ - Retrieves a float number representing the global speed - of the task in bytes per second, this value is computed - using the original creation time of the task and so it - may not represent the most accurate speedup. - - :rtype: float - :return: The current speed of download, defined as bytes - per second from the original task creation time. - """ - ... - - def speed_s(self): - ... - - def percent(self): # -> float: - ... - - def pop_block(self, bitfield): # -> tuple[int, int | Any, Any | Literal[16384]] | None: - ... - - def push_block(self, index, begin): # -> None: - ... - - def verify_piece(self, index): # -> None: - ... - - def confirm_piece(self, index): # -> None: - ... - - def refute_piece(self, index): # -> None: - ... - - def extend_peers(self, peers): # -> None: - ... - - def add_peer(self, peer): # -> None: - ... - - def remove_peer(self, peer): # -> None: - ... - - - -class TorrentServer(netius.ContainerServer): - def __init__(self, *args, **kwargs) -> None: - ... - - def cleanup(self): # -> None: - ... - - def ticks(self): # -> None: - ... - - def download(self, target_path, torrent_path=..., info_hash=..., close=...): # -> TorrentTask: - """ - Starts the "downloading" process of a torrent associated file - using the defined peer to peer torrent strategy using either - the provided torrent path as reference or just the info hash - of the file that is going to be downloaded. - - Note that if only the info hash is provided a DHT based strategy - is going to be used to retrieve the peers list. - - The returned value is the task entity representing the newly created - task for the downloading of the requested file, this object may be - used for the operations and listening of events. - - :type target_path: String - :param target_path: The path to the directory that will be used to store - the binary information resulting from the download, this directory may also - be used to store some temporary information on state of download. - :type torrent_path: String - :param torrent_path: The path to the file that contains the torrent - information that is going to be used for file processing. - :type info_hash: String - :param info_hash: The info hash value of the file that is going - to be downloaded, may be used for magnet torrents (DHT). - :type close: bool - :param close: If the server infra-structure should be close (process ends) - at the end of the download, this is not the default behavior (multiple download). - :rtype: TorrentTask - :return: The torrent task object that represents the task that has been - created for downloading of the requested file. - """ - ... - - def add_task(self, task): # -> None: - ... - - def remove_task(self, task): # -> None: - ... - - def cleanup_tasks(self): # -> None: - ... - - - -if __name__ == "__main__": - def on_start(server): # -> None: - ... - - def on_piece(task, index): # -> None: - ... - - def on_complete(task): # -> None: - ... - - server = ... -else: - __path__ = ... +import netius as netius +import netius.base.container +import netius.base.observer +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +REFRESH_TIME: float +ID_STRING: str +BLOCK_SIZE: int +THRESHOLD_END: int +MAX_MISSING: int +PEER_PATHS: tuple + +class Pieces(netius.base.observer.Observable): + def __init__(self, length, number_pieces, number_blocks) -> None: ... + def piece(self, index): ... + def piece_blocks(self, index): ... + def piece_size(self, index): ... + def block(self, index, begin): ... + def block_size(self, index, begin): ... + def pop_block(self, bitfield, mark: bool = ...): ... + def push_block(self, index, begin): ... + def mark_piece(self, index, value: bool = ...): ... + def mark_block(self, index, begin, value: bool = ...): ... + def update_block(self, index, mark: bool = ...): ... + def update_piece(self, index): ... + def _and(self, first, second): ... + @property + def total_pieces(self): ... + @property + def marked_pieces(self): ... + @property + def missing_pieces(self): ... + @property + def total_blocks(self): ... + @property + def marked_blocks(self): ... + @property + def missing_blocks(self): ... + +class TorrentTask(netius.base.observer.Observable): + def __init__(self, owner, target_path, torrent_path: Incomplete | None = ..., info_hash: Incomplete | None = ...) -> None: ... + def load(self): ... + def unload(self): ... + def on_close(self, connection): ... + def ticks(self): ... + def refresh(self): ... + def on_choked(self, connection): ... + def on_unchoked(self, connection): ... + def on_block(self, pieces, index, begin): ... + def on_piece(self, pieces, index): ... + def on_complete(self, pieces): ... + def on_dht(self, response): ... + def on_tracker(self, client, parser, result): ... + def load_info(self, torrent_path): ... + def load_file(self): ... + def load_single(self): ... + def load_multiple(self): ... + def unload_file(self): ... + def load_pieces(self): ... + def unload_pieces(self): ... + def pieces_tracker(self): ... + def set_data(self, data, index, begin): ... + def write_data(self, data, offset): ... + def set_dht(self, peer_t, port): ... + def peers_dht(self): ... + def peers_tracker(self): ... + def peers_file(self): ... + def connect_peers(self): ... + def disconnect_peers(self): ... + def connect_peer(self, peer): ... + def info_string(self): ... + def left(self): ... + def speed(self): ... + def speed_s(self): ... + def percent(self): ... + def pop_block(self, bitfield): ... + def push_block(self, index, begin): ... + def verify_piece(self, index): ... + def confirm_piece(self, index): ... + def refute_piece(self, index): ... + def extend_peers(self, peers): ... + def add_peer(self, peer): ... + def remove_peer(self, peer): ... + def _is_single(self): ... + def _verify_piece(self, index, file): ... + +class TorrentServer(netius.base.container.ContainerServer): + def __init__(self, *args, **kwargs) -> None: ... + def cleanup(self): ... + def ticks(self): ... + def download(self, target_path, torrent_path: Incomplete | None = ..., info_hash: Incomplete | None = ..., close: bool = ...): ... + def add_task(self, task): ... + def remove_task(self, task): ... + def cleanup_tasks(self): ... + def _generate_id(self): ... diff --git a/src/typings/netius/servers/ws.pyi b/src/typings/netius/servers/ws.pyi index 4590e535..f897974f 100644 --- a/src/typings/netius/servers/ws.pyi +++ b/src/typings/netius/servers/ws.pyi @@ -1,67 +1,26 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -class WSConnection(netius.Connection): - """ - Connection based class for the websockets connection, - should be able to implement the required encoding - and decoding techniques in compliance with the websockets - level 13 specification. - - :see: http://tools.ietf.org/html/rfc6455 - """ - def __init__(self, *args, **kwargs) -> None: - ... - - def send_ws(self, data): # -> int: - ... - - def recv_ws(self, size=...): # -> tuple[Any | bytes, Literal[b""]] | tuple[bytes, Any | bytes]: - ... - - def add_buffer(self, data): # -> None: - ... - - def get_buffer(self, delete=...): # -> bytes: - ... - - def do_handshake(self): # -> None: - ... - - def accept_key(self): # -> bytes | str: - ... - - - -class WSServer(netius.StreamServer): - """ - Base class for the creation of websocket server, should - handle both the upgrading/handshaking of the connection - and together with the associated connection class the - encoding and decoding of the frames. - """ - MAGIC_VALUE = ... - def on_data(self, connection, data): # -> None: - ... - - def build_connection(self, socket, address, ssl=...): # -> WSConnection: - ... - - def send_ws(self, connection, data): - ... - - def on_data_ws(self, connection, data): # -> None: - ... - - def on_handshake(self, connection): # -> None: - ... - - - +import netius as netius +import netius.base.conn +import netius.base.server +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class WSConnection(netius.base.conn.BaseConnection): + def __init__(self, *args, **kwargs) -> None: ... + def send_ws(self, data): ... + def recv_ws(self, size: int = ...): ... + def add_buffer(self, data): ... + def get_buffer(self, delete: bool = ...): ... + def do_handshake(self): ... + def accept_key(self): ... + +class WSServer(netius.base.server.StreamServer): + MAGIC_VALUE: ClassVar[str] = ... + def on_data(self, connection, data): ... + def build_connection(self, socket, address, ssl: bool = ...): ... + def send_ws(self, connection, data): ... + def on_data_ws(self, connection, data): ... + def on_handshake(self, connection): ... + def _handshake_response(self, accept_key): ... diff --git a/src/typings/netius/servers/wsgi.pyi b/src/typings/netius/servers/wsgi.pyi index 89295353..198583fd 100644 --- a/src/typings/netius/servers/wsgi.pyi +++ b/src/typings/netius/servers/wsgi.pyi @@ -1,44 +1,29 @@ -""" -This type stub file was generated by pyright. -""" - -from . import http2 - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -SERVER_SOFTWARE = ... -COMPRESSED_LIMIT = ... -class WSGIServer(http2.HTTP2Server): - """ - Base class for the creation of a wsgi compliant server - the server should be initialized with the "target" app - object as reference and a mount point. - """ - def __init__(self, app, mount=..., decode=..., compressed_limit=..., *args, **kwargs) -> None: - ... - - def on_connection_d(self, connection): # -> None: - ... - - def on_serve(self): # -> None: - ... - - def on_data_http(self, connection, parser): # -> None: - ... - - def on_environ(self, connection, environ): # -> None: - ... - - - -if __name__ == "__main__": - def app(environ, start_response): # -> Generator[Literal['Hello World'], Any, None]: - ... - - server = ... -else: - __path__ = ... +import netius as netius +import netius.servers.http as http +import netius.servers.http2 +import netius.servers.http2 as http2 + +__version__: str +__revision__: str +__date__: str +SERVER_SOFTWARE: str +COMPRESSED_LIMIT: int + +class WSGIServer(netius.servers.http2.HTTP2Server): + def __init__(self, app, mount: str = ..., decode: bool = ..., compressed_limit: int = ..., *args, **kwargs) -> None: ... + def on_connection_d(self, connection): ... + def on_serve(self): ... + def on_data_http(self, connection, parser): ... + def on_environ(self, connection, environ): ... + def _next_queue(self, connection): ... + def _start_response(self, connection, status, headers): ... + def _send_part(self, connection): ... + def _final(self, connection): ... + def _close(self, connection): ... + def _release(self, connection): ... + def _release_future(self, connection): ... + def _release_iterator(self, connection): ... + def _release_environ(self, connection): ... + def _release_parser(self, connection): ... + def _release_queue(self, connection): ... + def _decode(self, value): ... diff --git a/src/typings/netius/sh/__init__.pyi b/src/typings/netius/sh/__init__.pyi index 827d1e1e..f90e5c3f 100644 --- a/src/typings/netius/sh/__init__.pyi +++ b/src/typings/netius/sh/__init__.pyi @@ -1,11 +1,5 @@ -""" -This type stub file was generated by pyright. -""" - -from . import base, dkim, rsa, smtp - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +from . import base as base, dkim as dkim, rsa as rsa, smtp as smtp + +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/sh/auth.pyi b/src/typings/netius/sh/auth.pyi new file mode 100644 index 00000000..888cc519 --- /dev/null +++ b/src/typings/netius/sh/auth.pyi @@ -0,0 +1,7 @@ +import netius as netius +import netius.sh.base as base + +__version__: str +__revision__: str +__date__: str +def generate(password, type: str = ..., salt: str = ...): ... diff --git a/src/typings/netius/sh/base.pyi b/src/typings/netius/sh/base.pyi index 4b58e911..0891437d 100644 --- a/src/typings/netius/sh/base.pyi +++ b/src/typings/netius/sh/base.pyi @@ -1,13 +1,4 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def sh_call(globals=..., locals=...): # -> None: - ... - +__version__: str +__revision__: str +__date__: str +def sh_call(globals: dict = ..., locals: dict = ...): ... diff --git a/src/typings/netius/sh/dkim.pyi b/src/typings/netius/sh/dkim.pyi index 15ba6931..fc75eed5 100644 --- a/src/typings/netius/sh/dkim.pyi +++ b/src/typings/netius/sh/dkim.pyi @@ -1,20 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def generate(domain, suffix=..., number_bits=...): # -> None: - ... - -def sign(email_path, key_path, selector, domain): # -> None: - ... - -if __name__ == "__main__": - ... -else: - __path__ = ... +import netius as netius +import netius.sh.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +def generate(domain, suffix: Incomplete | None = ..., number_bits: int = ...): ... +def sign(email_path, key_path, selector, domain): ... diff --git a/src/typings/netius/sh/rsa.pyi b/src/typings/netius/sh/rsa.pyi index 7d62e53b..5dc51846 100644 --- a/src/typings/netius/sh/rsa.pyi +++ b/src/typings/netius/sh/rsa.pyi @@ -1,23 +1,9 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def read_private(path): # -> None: - ... - -def read_public(path): # -> None: - ... - -def private_to_public(private_path, public_path): # -> None: - ... - -if __name__ == "__main__": - ... -else: - __path__ = ... +import netius as netius +import netius.sh.base as base + +__version__: str +__revision__: str +__date__: str +def read_private(path): ... +def read_public(path): ... +def private_to_public(private_path, public_path): ... diff --git a/src/typings/netius/sh/smtp.pyi b/src/typings/netius/sh/smtp.pyi index 95cc9a08..fcfac97e 100644 --- a/src/typings/netius/sh/smtp.pyi +++ b/src/typings/netius/sh/smtp.pyi @@ -1,17 +1,8 @@ -""" -This type stub file was generated by pyright. -""" - -__author__ = ... -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... -def send(path, sender, receiver, host=..., port=..., username=..., password=..., stls=...): # -> None: - ... - -if __name__ == "__main__": - ... -else: - __path__ = ... +import netius as netius +import netius.sh.base as base +from _typeshed import Incomplete + +__version__: str +__revision__: str +__date__: str +def send(path, sender, receiver, host: Incomplete | None = ..., port: int = ..., username: Incomplete | None = ..., password: Incomplete | None = ..., stls: bool = ...): ... diff --git a/src/typings/netius/test/__init__.pyi b/src/typings/netius/test/__init__.pyi index be361b31..5b8c9724 100644 --- a/src/typings/netius/test/__init__.pyi +++ b/src/typings/netius/test/__init__.pyi @@ -1,9 +1,3 @@ -""" -This type stub file was generated by pyright. -""" - -__version__ = ... -__revision__ = ... -__date__ = ... -__copyright__ = ... -__license__ = ... +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/auth/__init__.pyi b/src/typings/netius/test/auth/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/auth/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/auth/allow.pyi b/src/typings/netius/test/auth/allow.pyi new file mode 100644 index 00000000..9459e51f --- /dev/null +++ b/src/typings/netius/test/auth/allow.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class AllowAuthTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_simple(self): ... diff --git a/src/typings/netius/test/auth/deny.pyi b/src/typings/netius/test/auth/deny.pyi new file mode 100644 index 00000000..8ba2b1f6 --- /dev/null +++ b/src/typings/netius/test/auth/deny.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class DenyAuthTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_simple(self): ... diff --git a/src/typings/netius/test/auth/simple.pyi b/src/typings/netius/test/auth/simple.pyi new file mode 100644 index 00000000..73a37f8b --- /dev/null +++ b/src/typings/netius/test/auth/simple.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class SimpleAuthTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_simple(self): ... diff --git a/src/typings/netius/test/base/__init__.pyi b/src/typings/netius/test/base/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/base/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/base/asynchronous.pyi b/src/typings/netius/test/base/asynchronous.pyi new file mode 100644 index 00000000..95845844 --- /dev/null +++ b/src/typings/netius/test/base/asynchronous.pyi @@ -0,0 +1,13 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class AsynchronousTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_basic(self): ... + def test_sleep(self, *args, **kwargs): ... diff --git a/src/typings/netius/test/base/common.pyi b/src/typings/netius/test/base/common.pyi new file mode 100644 index 00000000..5e9e1fa8 --- /dev/null +++ b/src/typings/netius/test/base/common.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class BaseTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_resolve_hostname(self): ... diff --git a/src/typings/netius/test/base/config.pyi b/src/typings/netius/test/base/config.pyi new file mode 100644 index 00000000..39d3aa90 --- /dev/null +++ b/src/typings/netius/test/base/config.pyi @@ -0,0 +1,13 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class ConfigTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_basic(self): ... + def test_none(self): ... diff --git a/src/typings/netius/test/base/tls.pyi b/src/typings/netius/test/base/tls.pyi new file mode 100644 index 00000000..aca0bddb --- /dev/null +++ b/src/typings/netius/test/base/tls.pyi @@ -0,0 +1,14 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class TLSTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_fingerprint(self): ... + def test_match_hostname(self): ... + def test_dnsname_match(self): ... diff --git a/src/typings/netius/test/base/transport.pyi b/src/typings/netius/test/base/transport.pyi new file mode 100644 index 00000000..7224e4bd --- /dev/null +++ b/src/typings/netius/test/base/transport.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class TransportTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_write_closing(self): ... diff --git a/src/typings/netius/test/clients/__init__.pyi b/src/typings/netius/test/clients/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/clients/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/clients/http.pyi b/src/typings/netius/test/clients/http.pyi new file mode 100644 index 00000000..bafa6b2f --- /dev/null +++ b/src/typings/netius/test/clients/http.pyi @@ -0,0 +1,16 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class HTTPClientTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def setUp(self): ... + def test_simple(self): ... + def test_timeout(self): ... + def test_compression(self): ... + def test_headers(self): ... diff --git a/src/typings/netius/test/common/__init__.pyi b/src/typings/netius/test/common/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/common/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/common/calc.pyi b/src/typings/netius/test/common/calc.pyi new file mode 100644 index 00000000..d4bc0cbb --- /dev/null +++ b/src/typings/netius/test/common/calc.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class CalcTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_jacobi_witness(self): ... diff --git a/src/typings/netius/test/common/dkim.pyi b/src/typings/netius/test/common/dkim.pyi new file mode 100644 index 00000000..91fa41b9 --- /dev/null +++ b/src/typings/netius/test/common/dkim.pyi @@ -0,0 +1,17 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +PRIVATE_KEY: bytes +PUBLIC_KEY: bytes +DNS_LABEL: bytes +MESSAGE: bytes +RESULT: bytes + +class DKIMTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_simple(self): ... diff --git a/src/typings/netius/test/common/http.pyi b/src/typings/netius/test/common/http.pyi new file mode 100644 index 00000000..43f7312b --- /dev/null +++ b/src/typings/netius/test/common/http.pyi @@ -0,0 +1,26 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +SIMPLE_REQUEST: bytes +CHUNKED_REQUEST: bytes +EXTRA_SPACES_REQUEST: bytes +INVALID_HEADERS_REQUEST: bytes +INVALID_HEADERS_TAB_REQUEST: bytes +INVALID_HEADERS_NEWLINE_REQUEST: bytes +INVALID_CHUNKED_REQUEST: bytes +INVALID_TRANSFER_ENCODING_REQUEST: bytes +INVALID_STATUS_REQUEST: bytes + +class HTTPParserTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_simple(self): ... + def test_chunked(self): ... + def test_malformed(self): ... + def test_file(self): ... + def test_no_store(self): ... + def test_clear(self): ... diff --git a/src/typings/netius/test/common/mime.pyi b/src/typings/netius/test/common/mime.pyi new file mode 100644 index 00000000..d0ddd533 --- /dev/null +++ b/src/typings/netius/test/common/mime.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class MimeTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_headers(self): ... diff --git a/src/typings/netius/test/common/rsa.pyi b/src/typings/netius/test/common/rsa.pyi new file mode 100644 index 00000000..e2be1fb3 --- /dev/null +++ b/src/typings/netius/test/common/rsa.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class RSATest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_rsa_crypt(self): ... diff --git a/src/typings/netius/test/common/setup.pyi b/src/typings/netius/test/common/setup.pyi new file mode 100644 index 00000000..a7191693 --- /dev/null +++ b/src/typings/netius/test/common/setup.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class CommonTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test__download_ca(self): ... diff --git a/src/typings/netius/test/common/util.pyi b/src/typings/netius/test/common/util.pyi new file mode 100644 index 00000000..0d252624 --- /dev/null +++ b/src/typings/netius/test/common/util.pyi @@ -0,0 +1,25 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class UtilTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_is_ip4(self): ... + def test_is_ip6(self): ... + def test_assert_ip4(self): ... + def test_in_subnet_ip4(self): ... + def test_addr_to_ip4(self): ... + def test_addr_to_ip6(self): ... + def test_bytes_to_integer(self): ... + def test_integer_to_bytes(self): ... + def test_size_round_unit(self): ... + def test_verify(self): ... + def test_verify_equal(self): ... + def test_verify_not_equal(self): ... + def test_verify_type(self): ... + def test_verify_many(self): ... diff --git a/src/typings/netius/test/extra/__init__.pyi b/src/typings/netius/test/extra/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/extra/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/extra/proxy_r.pyi b/src/typings/netius/test/extra/proxy_r.pyi new file mode 100644 index 00000000..bc2a1d50 --- /dev/null +++ b/src/typings/netius/test/extra/proxy_r.pyi @@ -0,0 +1,14 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class ReverseProxyServerTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def setUp(self): ... + def tearDown(self): ... + def test_alias(self): ... diff --git a/src/typings/netius/test/extra/smtp_r.pyi b/src/typings/netius/test/extra/smtp_r.pyi new file mode 100644 index 00000000..9b82ecc9 --- /dev/null +++ b/src/typings/netius/test/extra/smtp_r.pyi @@ -0,0 +1,18 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str +PRIVATE_KEY: bytes +MESSAGE: bytes +RESULT: bytes +REGISTRY: dict + +class RelaySMTPServerTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def setUp(self): ... + def tearDown(self): ... + def test_dkim(self): ... diff --git a/src/typings/netius/test/middleware/__init__.pyi b/src/typings/netius/test/middleware/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/middleware/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/middleware/proxy.pyi b/src/typings/netius/test/middleware/proxy.pyi new file mode 100644 index 00000000..8a650c9b --- /dev/null +++ b/src/typings/netius/test/middleware/proxy.pyi @@ -0,0 +1,17 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class ProxyMiddlewareTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def setUp(self): ... + def tearDown(self): ... + def test_ipv4_v1(self): ... + def test_ipv6_v1(self): ... + def test_starter_v1(self): ... + def test_starter_v2(self): ... diff --git a/src/typings/netius/test/pool/__init__.pyi b/src/typings/netius/test/pool/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/pool/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/pool/common.pyi b/src/typings/netius/test/pool/common.pyi new file mode 100644 index 00000000..7c3fdb85 --- /dev/null +++ b/src/typings/netius/test/pool/common.pyi @@ -0,0 +1,12 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class EventPoolTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test_event(self): ... diff --git a/src/typings/netius/test/servers/__init__.pyi b/src/typings/netius/test/servers/__init__.pyi new file mode 100644 index 00000000..5b8c9724 --- /dev/null +++ b/src/typings/netius/test/servers/__init__.pyi @@ -0,0 +1,3 @@ +__version__: str +__revision__: str +__date__: str diff --git a/src/typings/netius/test/servers/http.pyi b/src/typings/netius/test/servers/http.pyi new file mode 100644 index 00000000..b0fd4cd4 --- /dev/null +++ b/src/typings/netius/test/servers/http.pyi @@ -0,0 +1,13 @@ +import netius as netius +import unittest.case +from typing import ClassVar + +__version__: str +__revision__: str +__date__: str + +class HTTPServerTest(unittest.case.TestCase): + _classSetupFailed: ClassVar[bool] = ... + _class_cleanups: ClassVar[list] = ... + def test__headers_upper(self): ... + def test__headers_normalize(self): ... From ab27423bc276ee291786e3aa5b7a872134dfec96 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:00:56 +0000 Subject: [PATCH 03/20] feat: remove tests --- src/typings/netius/test/__init__.pyi | 3 --- src/typings/netius/test/auth/__init__.pyi | 3 --- src/typings/netius/test/auth/allow.pyi | 12 --------- src/typings/netius/test/auth/deny.pyi | 12 --------- src/typings/netius/test/auth/simple.pyi | 12 --------- src/typings/netius/test/base/__init__.pyi | 3 --- src/typings/netius/test/base/asynchronous.pyi | 13 ---------- src/typings/netius/test/base/common.pyi | 12 --------- src/typings/netius/test/base/config.pyi | 13 ---------- src/typings/netius/test/base/tls.pyi | 14 ---------- src/typings/netius/test/base/transport.pyi | 12 --------- src/typings/netius/test/clients/__init__.pyi | 3 --- src/typings/netius/test/clients/http.pyi | 16 ------------ src/typings/netius/test/common/__init__.pyi | 3 --- src/typings/netius/test/common/calc.pyi | 12 --------- src/typings/netius/test/common/dkim.pyi | 17 ------------ src/typings/netius/test/common/http.pyi | 26 ------------------- src/typings/netius/test/common/mime.pyi | 12 --------- src/typings/netius/test/common/rsa.pyi | 12 --------- src/typings/netius/test/common/setup.pyi | 12 --------- src/typings/netius/test/common/util.pyi | 25 ------------------ src/typings/netius/test/extra/__init__.pyi | 3 --- src/typings/netius/test/extra/proxy_r.pyi | 14 ---------- src/typings/netius/test/extra/smtp_r.pyi | 18 ------------- .../netius/test/middleware/__init__.pyi | 3 --- src/typings/netius/test/middleware/proxy.pyi | 17 ------------ src/typings/netius/test/pool/__init__.pyi | 3 --- src/typings/netius/test/pool/common.pyi | 12 --------- src/typings/netius/test/servers/__init__.pyi | 3 --- src/typings/netius/test/servers/http.pyi | 13 ---------- 30 files changed, 333 deletions(-) delete mode 100644 src/typings/netius/test/__init__.pyi delete mode 100644 src/typings/netius/test/auth/__init__.pyi delete mode 100644 src/typings/netius/test/auth/allow.pyi delete mode 100644 src/typings/netius/test/auth/deny.pyi delete mode 100644 src/typings/netius/test/auth/simple.pyi delete mode 100644 src/typings/netius/test/base/__init__.pyi delete mode 100644 src/typings/netius/test/base/asynchronous.pyi delete mode 100644 src/typings/netius/test/base/common.pyi delete mode 100644 src/typings/netius/test/base/config.pyi delete mode 100644 src/typings/netius/test/base/tls.pyi delete mode 100644 src/typings/netius/test/base/transport.pyi delete mode 100644 src/typings/netius/test/clients/__init__.pyi delete mode 100644 src/typings/netius/test/clients/http.pyi delete mode 100644 src/typings/netius/test/common/__init__.pyi delete mode 100644 src/typings/netius/test/common/calc.pyi delete mode 100644 src/typings/netius/test/common/dkim.pyi delete mode 100644 src/typings/netius/test/common/http.pyi delete mode 100644 src/typings/netius/test/common/mime.pyi delete mode 100644 src/typings/netius/test/common/rsa.pyi delete mode 100644 src/typings/netius/test/common/setup.pyi delete mode 100644 src/typings/netius/test/common/util.pyi delete mode 100644 src/typings/netius/test/extra/__init__.pyi delete mode 100644 src/typings/netius/test/extra/proxy_r.pyi delete mode 100644 src/typings/netius/test/extra/smtp_r.pyi delete mode 100644 src/typings/netius/test/middleware/__init__.pyi delete mode 100644 src/typings/netius/test/middleware/proxy.pyi delete mode 100644 src/typings/netius/test/pool/__init__.pyi delete mode 100644 src/typings/netius/test/pool/common.pyi delete mode 100644 src/typings/netius/test/servers/__init__.pyi delete mode 100644 src/typings/netius/test/servers/http.pyi diff --git a/src/typings/netius/test/__init__.pyi b/src/typings/netius/test/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/auth/__init__.pyi b/src/typings/netius/test/auth/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/auth/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/auth/allow.pyi b/src/typings/netius/test/auth/allow.pyi deleted file mode 100644 index 9459e51f..00000000 --- a/src/typings/netius/test/auth/allow.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class AllowAuthTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_simple(self): ... diff --git a/src/typings/netius/test/auth/deny.pyi b/src/typings/netius/test/auth/deny.pyi deleted file mode 100644 index 8ba2b1f6..00000000 --- a/src/typings/netius/test/auth/deny.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class DenyAuthTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_simple(self): ... diff --git a/src/typings/netius/test/auth/simple.pyi b/src/typings/netius/test/auth/simple.pyi deleted file mode 100644 index 73a37f8b..00000000 --- a/src/typings/netius/test/auth/simple.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class SimpleAuthTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_simple(self): ... diff --git a/src/typings/netius/test/base/__init__.pyi b/src/typings/netius/test/base/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/base/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/base/asynchronous.pyi b/src/typings/netius/test/base/asynchronous.pyi deleted file mode 100644 index 95845844..00000000 --- a/src/typings/netius/test/base/asynchronous.pyi +++ /dev/null @@ -1,13 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class AsynchronousTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_basic(self): ... - def test_sleep(self, *args, **kwargs): ... diff --git a/src/typings/netius/test/base/common.pyi b/src/typings/netius/test/base/common.pyi deleted file mode 100644 index 5e9e1fa8..00000000 --- a/src/typings/netius/test/base/common.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class BaseTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_resolve_hostname(self): ... diff --git a/src/typings/netius/test/base/config.pyi b/src/typings/netius/test/base/config.pyi deleted file mode 100644 index 39d3aa90..00000000 --- a/src/typings/netius/test/base/config.pyi +++ /dev/null @@ -1,13 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class ConfigTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_basic(self): ... - def test_none(self): ... diff --git a/src/typings/netius/test/base/tls.pyi b/src/typings/netius/test/base/tls.pyi deleted file mode 100644 index aca0bddb..00000000 --- a/src/typings/netius/test/base/tls.pyi +++ /dev/null @@ -1,14 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class TLSTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_fingerprint(self): ... - def test_match_hostname(self): ... - def test_dnsname_match(self): ... diff --git a/src/typings/netius/test/base/transport.pyi b/src/typings/netius/test/base/transport.pyi deleted file mode 100644 index 7224e4bd..00000000 --- a/src/typings/netius/test/base/transport.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class TransportTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_write_closing(self): ... diff --git a/src/typings/netius/test/clients/__init__.pyi b/src/typings/netius/test/clients/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/clients/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/clients/http.pyi b/src/typings/netius/test/clients/http.pyi deleted file mode 100644 index bafa6b2f..00000000 --- a/src/typings/netius/test/clients/http.pyi +++ /dev/null @@ -1,16 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class HTTPClientTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def setUp(self): ... - def test_simple(self): ... - def test_timeout(self): ... - def test_compression(self): ... - def test_headers(self): ... diff --git a/src/typings/netius/test/common/__init__.pyi b/src/typings/netius/test/common/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/common/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/common/calc.pyi b/src/typings/netius/test/common/calc.pyi deleted file mode 100644 index d4bc0cbb..00000000 --- a/src/typings/netius/test/common/calc.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class CalcTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_jacobi_witness(self): ... diff --git a/src/typings/netius/test/common/dkim.pyi b/src/typings/netius/test/common/dkim.pyi deleted file mode 100644 index 91fa41b9..00000000 --- a/src/typings/netius/test/common/dkim.pyi +++ /dev/null @@ -1,17 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str -PRIVATE_KEY: bytes -PUBLIC_KEY: bytes -DNS_LABEL: bytes -MESSAGE: bytes -RESULT: bytes - -class DKIMTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_simple(self): ... diff --git a/src/typings/netius/test/common/http.pyi b/src/typings/netius/test/common/http.pyi deleted file mode 100644 index 43f7312b..00000000 --- a/src/typings/netius/test/common/http.pyi +++ /dev/null @@ -1,26 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str -SIMPLE_REQUEST: bytes -CHUNKED_REQUEST: bytes -EXTRA_SPACES_REQUEST: bytes -INVALID_HEADERS_REQUEST: bytes -INVALID_HEADERS_TAB_REQUEST: bytes -INVALID_HEADERS_NEWLINE_REQUEST: bytes -INVALID_CHUNKED_REQUEST: bytes -INVALID_TRANSFER_ENCODING_REQUEST: bytes -INVALID_STATUS_REQUEST: bytes - -class HTTPParserTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_simple(self): ... - def test_chunked(self): ... - def test_malformed(self): ... - def test_file(self): ... - def test_no_store(self): ... - def test_clear(self): ... diff --git a/src/typings/netius/test/common/mime.pyi b/src/typings/netius/test/common/mime.pyi deleted file mode 100644 index d0ddd533..00000000 --- a/src/typings/netius/test/common/mime.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class MimeTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_headers(self): ... diff --git a/src/typings/netius/test/common/rsa.pyi b/src/typings/netius/test/common/rsa.pyi deleted file mode 100644 index e2be1fb3..00000000 --- a/src/typings/netius/test/common/rsa.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class RSATest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_rsa_crypt(self): ... diff --git a/src/typings/netius/test/common/setup.pyi b/src/typings/netius/test/common/setup.pyi deleted file mode 100644 index a7191693..00000000 --- a/src/typings/netius/test/common/setup.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class CommonTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test__download_ca(self): ... diff --git a/src/typings/netius/test/common/util.pyi b/src/typings/netius/test/common/util.pyi deleted file mode 100644 index 0d252624..00000000 --- a/src/typings/netius/test/common/util.pyi +++ /dev/null @@ -1,25 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class UtilTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_is_ip4(self): ... - def test_is_ip6(self): ... - def test_assert_ip4(self): ... - def test_in_subnet_ip4(self): ... - def test_addr_to_ip4(self): ... - def test_addr_to_ip6(self): ... - def test_bytes_to_integer(self): ... - def test_integer_to_bytes(self): ... - def test_size_round_unit(self): ... - def test_verify(self): ... - def test_verify_equal(self): ... - def test_verify_not_equal(self): ... - def test_verify_type(self): ... - def test_verify_many(self): ... diff --git a/src/typings/netius/test/extra/__init__.pyi b/src/typings/netius/test/extra/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/extra/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/extra/proxy_r.pyi b/src/typings/netius/test/extra/proxy_r.pyi deleted file mode 100644 index bc2a1d50..00000000 --- a/src/typings/netius/test/extra/proxy_r.pyi +++ /dev/null @@ -1,14 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class ReverseProxyServerTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def setUp(self): ... - def tearDown(self): ... - def test_alias(self): ... diff --git a/src/typings/netius/test/extra/smtp_r.pyi b/src/typings/netius/test/extra/smtp_r.pyi deleted file mode 100644 index 9b82ecc9..00000000 --- a/src/typings/netius/test/extra/smtp_r.pyi +++ /dev/null @@ -1,18 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str -PRIVATE_KEY: bytes -MESSAGE: bytes -RESULT: bytes -REGISTRY: dict - -class RelaySMTPServerTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def setUp(self): ... - def tearDown(self): ... - def test_dkim(self): ... diff --git a/src/typings/netius/test/middleware/__init__.pyi b/src/typings/netius/test/middleware/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/middleware/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/middleware/proxy.pyi b/src/typings/netius/test/middleware/proxy.pyi deleted file mode 100644 index 8a650c9b..00000000 --- a/src/typings/netius/test/middleware/proxy.pyi +++ /dev/null @@ -1,17 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class ProxyMiddlewareTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def setUp(self): ... - def tearDown(self): ... - def test_ipv4_v1(self): ... - def test_ipv6_v1(self): ... - def test_starter_v1(self): ... - def test_starter_v2(self): ... diff --git a/src/typings/netius/test/pool/__init__.pyi b/src/typings/netius/test/pool/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/pool/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/pool/common.pyi b/src/typings/netius/test/pool/common.pyi deleted file mode 100644 index 7c3fdb85..00000000 --- a/src/typings/netius/test/pool/common.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class EventPoolTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test_event(self): ... diff --git a/src/typings/netius/test/servers/__init__.pyi b/src/typings/netius/test/servers/__init__.pyi deleted file mode 100644 index 5b8c9724..00000000 --- a/src/typings/netius/test/servers/__init__.pyi +++ /dev/null @@ -1,3 +0,0 @@ -__version__: str -__revision__: str -__date__: str diff --git a/src/typings/netius/test/servers/http.pyi b/src/typings/netius/test/servers/http.pyi deleted file mode 100644 index b0fd4cd4..00000000 --- a/src/typings/netius/test/servers/http.pyi +++ /dev/null @@ -1,13 +0,0 @@ -import netius as netius -import unittest.case -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str - -class HTTPServerTest(unittest.case.TestCase): - _classSetupFailed: ClassVar[bool] = ... - _class_cleanups: ClassVar[list] = ... - def test__headers_upper(self): ... - def test__headers_normalize(self): ... From 0ccbf1d7b9dd2cccbb1bd0020d7f17623cbb0cfa Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:02:44 +0000 Subject: [PATCH 04/20] review src/typings/netius/adapters/__init__.pyi --- src/typings/netius/adapters/__init__.pyi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/typings/netius/adapters/__init__.pyi b/src/typings/netius/adapters/__init__.pyi index 2ccebdee..a115a1d6 100644 --- a/src/typings/netius/adapters/__init__.pyi +++ b/src/typings/netius/adapters/__init__.pyi @@ -4,7 +4,3 @@ from netius.adapters.fs import FsAdapter as FsAdapter from netius.adapters.memory import MemoryAdapter as MemoryAdapter from netius.adapters.mongo import MongoAdapter as MongoAdapter from netius.adapters.null import NullAdapter as NullAdapter - -__version__: str -__revision__: str -__date__: str From 754641543ac30246dd00bde22a7c8e5ded8a0585 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:02:53 +0000 Subject: [PATCH 05/20] review src/typings/netius/adapters/base.pyi --- src/typings/netius/adapters/base.pyi | 32 ++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/typings/netius/adapters/base.pyi b/src/typings/netius/adapters/base.pyi index 314eb392..15ce5038 100644 --- a/src/typings/netius/adapters/base.pyi +++ b/src/typings/netius/adapters/base.pyi @@ -1,21 +1,17 @@ import netius as netius -from _typeshed import Incomplete - -__version__: str -__revision__: str -__date__: str +from typing import Any class BaseAdapter: - def set(self, value, owner: str = ...): ... - def get(self, key): ... - def get_file(self, key, mode: str = ...): ... - def delete(self, key, owner: str = ...): ... - def append(self, key, value): ... - def truncate(self, key, count): ... - def size(self, key): ... - def sizes(self, owner: Incomplete | None = ...): ... - def total(self, owner: Incomplete | None = ...): ... - def reserve(self, owner: str = ...): ... - def count(self, owner: Incomplete | None = ...): ... - def list(self, owner: Incomplete | None = ...): ... - def generate(self): ... + def set(self, value: 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 = ...): ... + def append(self, key:str , value: Any) -> None: ... + 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: ... From 1e0b15a875d60c69d4ef11af94ce8203c763e772 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:03:10 +0000 Subject: [PATCH 06/20] review src/typings/netius/adapters/fs.pyi --- src/typings/netius/adapters/fs.pyi | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/typings/netius/adapters/fs.pyi b/src/typings/netius/adapters/fs.pyi index b3d62e5a..dc8e04e1 100644 --- a/src/typings/netius/adapters/fs.pyi +++ b/src/typings/netius/adapters/fs.pyi @@ -1,20 +1,17 @@ import netius as netius import netius.adapters.base import netius.adapters.base as base -from _typeshed import Incomplete - -__version__: str -__revision__: str -__date__: str +from typing import StrOrBytesPath +from typing import Any class FsAdapter(netius.adapters.base.BaseAdapter): - def __init__(self, base_path: Incomplete | None = ...) -> None: ... - def set(self, value, owner: str = ...): ... - def get_file(self, key, mode: str = ...): ... - def delete(self, key, owner: str = ...): ... - def size(self, key): ... - def count(self, owner: Incomplete | None = ...): ... - def list(self, owner: Incomplete | None = ...): ... - def _path(self, owner: Incomplete | None = ...): ... - def _ensure(self, owner): ... - def _symlink(self, source, target): ... + def __init__(self, base_path: str | None = ...) -> None: ... + def set(self, value: 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: StrOrBytesPath, target: StrOrBytesPath) -> None: ... From 7e425b13fde1dcaf24ade02cbac4c0b4a7b5c741 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:03:25 +0000 Subject: [PATCH 07/20] review src/typings/netius/adapters/memory.pyi --- src/typings/netius/adapters/memory.pyi | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/typings/netius/adapters/memory.pyi b/src/typings/netius/adapters/memory.pyi index 6beded63..45d03412 100644 --- a/src/typings/netius/adapters/memory.pyi +++ b/src/typings/netius/adapters/memory.pyi @@ -1,21 +1,17 @@ import netius as netius import netius.adapters.base import netius.adapters.base as base -from _typeshed import Incomplete - -__version__: str -__revision__: str -__date__: str +from typing import Any class MemoryAdapter(netius.adapters.base.BaseAdapter): def __init__(self) -> None: ... - def set(self, value, owner: str = ...): ... - def get_file(self, key, mode: str = ...): ... - def delete(self, key, owner: str = ...): ... - def append(self, key, value): ... - def truncate(self, key, count): ... - def size(self, key): ... - def count(self, owner: Incomplete | None = ...): ... - def list(self, owner: Incomplete | None = ...): ... - def _ensure(self, owner): ... - def _build_close(self, file, key): ... + 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: 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: ... From 5873ca1cb7bdfce349cac7ba38734af5ba75054b Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:03:42 +0000 Subject: [PATCH 08/20] review src/typings/netius/adapters/mongo.pyi --- src/typings/netius/adapters/mongo.pyi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/typings/netius/adapters/mongo.pyi b/src/typings/netius/adapters/mongo.pyi index e4971ed8..872a8e3a 100644 --- a/src/typings/netius/adapters/mongo.pyi +++ b/src/typings/netius/adapters/mongo.pyi @@ -1,10 +1,6 @@ import netius.adapters.base import netius.adapters.base as base -__version__: str -__revision__: str -__date__: str - class MongoAdapter(netius.adapters.base.BaseAdapter): def set(self, value, owner: str = ...): ... def get(self, key): ... From 1ed3e7bf3d6be9de5208ef8aebab6abceac63945 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:03:52 +0000 Subject: [PATCH 09/20] review src/typings/netius/adapters/null.pyi --- src/typings/netius/adapters/null.pyi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/typings/netius/adapters/null.pyi b/src/typings/netius/adapters/null.pyi index d699c1a3..694650d5 100644 --- a/src/typings/netius/adapters/null.pyi +++ b/src/typings/netius/adapters/null.pyi @@ -1,8 +1,4 @@ import netius.adapters.base import netius.adapters.base as base -__version__: str -__revision__: str -__date__: str - class NullAdapter(netius.adapters.base.BaseAdapter): ... From d4a57cd4688ec069c051f8b29001ca1a41eac0ad Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:05:11 +0000 Subject: [PATCH 10/20] review src/typings/netius/auth/address.pyi --- src/typings/netius/auth/address.pyi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/typings/netius/auth/address.pyi b/src/typings/netius/auth/address.pyi index 20b5682b..c63bc74d 100644 --- a/src/typings/netius/auth/address.pyi +++ b/src/typings/netius/auth/address.pyi @@ -1,14 +1,11 @@ import netius.auth.base import netius.auth.base as base - -__version__: str -__revision__: str -__date__: str +from typing import Literal class AddressAuth(netius.auth.base.Auth): def __init__(self, allowed: list = ..., *args, **kwargs) -> None: ... @classmethod - def auth(cls, allowed: list = ..., *args, **kwargs): ... + def auth(cls, allowed: list = ..., *args, **kwargs) -> bool: ... @classmethod - def is_simple(cls): ... + def is_simple(cls) -> Literal[True]: ... def auth_i(self, *args, **kwargs): ... From 3b3eb989c9f904106f28eada6dcc12c702bbd03b Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:05:20 +0000 Subject: [PATCH 11/20] review src/typings/netius/auth/allow.pyi --- src/typings/netius/auth/allow.pyi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/typings/netius/auth/allow.pyi b/src/typings/netius/auth/allow.pyi index 4ce75a16..99bfebfb 100644 --- a/src/typings/netius/auth/allow.pyi +++ b/src/typings/netius/auth/allow.pyi @@ -1,12 +1,9 @@ import netius.auth.base import netius.auth.base as base - -__version__: str -__revision__: str -__date__: str +from typing import Literal class AllowAuth(netius.auth.base.Auth): @classmethod - def auth(cls, *args, **kwargs): ... + def auth(cls, *args, **kwargs) -> Literal[True]: ... @classmethod - def is_simple(cls): ... + def is_simple(cls) -> Literal[True]: ... From b6aa2db88e885ca92d061f58375cc5dd970e6af4 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:05:30 +0000 Subject: [PATCH 12/20] review src/typings/netius/auth/base.pyi --- src/typings/netius/auth/base.pyi | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/typings/netius/auth/base.pyi b/src/typings/netius/auth/base.pyi index a609d35f..a3415788 100644 --- a/src/typings/netius/auth/base.pyi +++ b/src/typings/netius/auth/base.pyi @@ -1,28 +1,24 @@ import netius as netius -from _typeshed import Incomplete - -__version__: str -__revision__: str -__date__: str +from typing import NoReturn, Any, Unbound, Literal, PathLike class Auth: def __init__(self, *args, **kwargs) -> None: ... @classmethod - def auth(cls, *args, **kwargs): ... + def auth(cls, *args, **kwargs) -> NoReturn: ... @classmethod - def meta(cls, *args, **kwargs): ... + def meta(cls, *args, **kwargs) -> dict: ... @classmethod - def auth_assert(cls, *args, **kwargs): ... + def auth_assert(cls, *args, **kwargs) -> None: ... @classmethod - def verify(cls, encoded, decoded): ... + def verify(cls, encoded: str, decoded: str) -> bool: ... @classmethod - def generate(cls, password, type: str = ..., salt: str = ...): ... + def generate(cls, password: str, type: str = ..., salt: str = ...) -> str: ... @classmethod - def unpack(cls, password): ... + def unpack(cls, password) -> tuple[Any | Literal["plain"], bytes | Any | str | None, Any | None, Unbound | Any | None]: ... @classmethod - def get_file(cls, path, cache: bool = ..., encoding: Incomplete | None = ...): ... + def get_file(cls, path: PathLike[str], cache: bool = ..., encoding: str | None = ...) -> (Any | str | bytes): ... @classmethod - def is_simple(cls): ... - def auth_i(self, *args, **kwargs): ... - def auth_assert_i(self, *args, **kwargs): ... - def is_simple_i(self): ... + def is_simple(cls) -> Literal[False]: ... + def auth_i(self, *args, **kwargs) -> NoReturn: ... + def auth_assert_i(self, *args, **kwargs) -> None: ... + def is_simple_i(self) -> Literal[False]: ... From 308ff899e4932c3f36ca060d9cc0f8e9e89da40c Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:05:39 +0000 Subject: [PATCH 13/20] review src/typings/netius/auth/deny.pyi --- src/typings/netius/auth/deny.pyi | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/typings/netius/auth/deny.pyi b/src/typings/netius/auth/deny.pyi index bc0bb1d9..daf93966 100644 --- a/src/typings/netius/auth/deny.pyi +++ b/src/typings/netius/auth/deny.pyi @@ -1,12 +1,10 @@ import netius.auth.base import netius.auth.base as base -__version__: str -__revision__: str -__date__: str +from typing import Literal class DenyAuth(netius.auth.base.Auth): @classmethod - def auth(cls, *args, **kwargs): ... + def auth(cls, *args, **kwargs) -> Literal[False]: ... @classmethod - def is_simple(cls): ... + def is_simple(cls) -> Literal[True]: ... From 3fa5c9197746043eaf650b4a9048d6c8cc617197 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:05:54 +0000 Subject: [PATCH 14/20] review src/typings/netius/auth/dummy.pyi --- src/typings/netius/auth/dummy.pyi | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/typings/netius/auth/dummy.pyi b/src/typings/netius/auth/dummy.pyi index f0a43e1d..c83d61c7 100644 --- a/src/typings/netius/auth/dummy.pyi +++ b/src/typings/netius/auth/dummy.pyi @@ -1,9 +1,6 @@ import netius.auth.base import netius.auth.base as base - -__version__: str -__revision__: str -__date__: str +from typing import Literal class DummyAuth(netius.auth.base.Auth): def __init__(self, value: bool = ..., *args, **kwargs) -> None: ... From 60a1fd5c156039be8e2c74645a69b1089e830c7c Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:06:04 +0000 Subject: [PATCH 15/20] review src/typings/netius/auth/dummy.pyi --- src/typings/netius/auth/dummy.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typings/netius/auth/dummy.pyi b/src/typings/netius/auth/dummy.pyi index c83d61c7..80d2b12f 100644 --- a/src/typings/netius/auth/dummy.pyi +++ b/src/typings/netius/auth/dummy.pyi @@ -7,5 +7,5 @@ class DummyAuth(netius.auth.base.Auth): @classmethod def auth(cls, value: bool = ..., *args, **kwargs): ... @classmethod - def is_simple(cls): ... - def auth_i(self, *args, **kwargs): ... + def is_simple(cls) -> Literal[True]: ... + def auth_i(self, *args, **kwargs) -> bool: ... From a187f60d71c7747db66e0212b5f29bbf6be5faed Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:06:11 +0000 Subject: [PATCH 16/20] review src/typings/netius/auth/memory.pyi --- src/typings/netius/auth/memory.pyi | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/typings/netius/auth/memory.pyi b/src/typings/netius/auth/memory.pyi index 5f93ba66..a7cd5a23 100644 --- a/src/typings/netius/auth/memory.pyi +++ b/src/typings/netius/auth/memory.pyi @@ -1,20 +1,19 @@ import netius as netius import netius.auth.base import netius.auth.base as base -from _typeshed import Incomplete -__version__: str -__revision__: str -__date__: str +from typing import Dict class MemoryAuth(netius.auth.base.Auth): - def __init__(self, registry: Incomplete | None = ..., *args, **kwargs) -> None: ... + def __init__(self, registry: Dict | None = ..., *args, **kwargs) -> None: ... @classmethod - def auth(cls, username, password, registry: Incomplete | None = ..., *args, **kwargs): ... + def auth( + cls, username: str, password: str, registry: dict | None = ..., *args, **kwargs + ): ... @classmethod - def meta(cls, username, registry: Incomplete | None = ..., *args, **kwargs): ... + def meta(cls, username: str, registry: Dict | None = ..., *args, **kwargs) -> Dict: ... @classmethod def get_registry(cls): ... @classmethod def load_registry(cls): ... - def auth_i(self, username, password, *args, **kwargs): ... + def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ... From efca86e86b8f58be888e49e83c7d247f512fff34 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:06:18 +0000 Subject: [PATCH 17/20] review src/typings/netius/auth/passwd.pyi --- src/typings/netius/auth/passwd.pyi | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/typings/netius/auth/passwd.pyi b/src/typings/netius/auth/passwd.pyi index 5ac7bf12..a87f15e5 100644 --- a/src/typings/netius/auth/passwd.pyi +++ b/src/typings/netius/auth/passwd.pyi @@ -1,15 +1,12 @@ import netius.auth.base import netius.auth.base as base -from _typeshed import Incomplete -__version__: str -__revision__: str -__date__: str +from typing import PathLike, Any, Dict class PasswdAuth(netius.auth.base.Auth): - def __init__(self, path: Incomplete | None = ..., *args, **kwargs) -> None: ... + def __init__(self, path: PathLike[str] | None = ..., *args, **kwargs) -> None: ... @classmethod - def auth(cls, username, password, path: str = ..., *args, **kwargs): ... + def auth(cls, username: str, password: str, path: str = ..., *args, **kwargs) -> bool: ... @classmethod - def get_passwd(cls, path, cache: bool = ...): ... - def auth_i(self, username, password, *args, **kwargs): ... + def get_passwd(cls, path: PathLike[str], cache: bool = ...) -> (Any | Dict): ... + def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ... From 7848ab5dab36c08cfb10910863da348d08b1e9b2 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:07:25 +0000 Subject: [PATCH 18/20] review src/typings/netius/auth/simple.pyi --- src/typings/netius/auth/simple.pyi | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/typings/netius/auth/simple.pyi b/src/typings/netius/auth/simple.pyi index 747d719c..a7f4a0a6 100644 --- a/src/typings/netius/auth/simple.pyi +++ b/src/typings/netius/auth/simple.pyi @@ -1,13 +1,9 @@ import netius.auth.base import netius.auth.base as base -from _typeshed import Incomplete - -__version__: str -__revision__: str -__date__: str +from typing import Tuple class SimpleAuth(netius.auth.base.Auth): - def __init__(self, username: Incomplete | None = ..., password: Incomplete | None = ..., *args, **kwargs) -> None: ... + def __init__(self, username: str | None = ..., password: str | None = ..., *args, **kwargs) -> None: ... @classmethod - def auth(cls, username, password, target: Incomplete | None = ..., *args, **kwargs): ... - def auth_i(self, username, password, *args, **kwargs): ... + def auth(cls, username: str, password: str, target: Tuple[str:str] | None = ..., *args, **kwargs) -> bool: ... + def auth_i(self, username:str , password: str, *args, **kwargs) -> bool: ... From 9f96e6033d00931aa454fe293cb7b55215cefcc8 Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:07:42 +0000 Subject: [PATCH 19/20] review src/typings/netius/base/agent.pyi --- src/typings/netius/base/agent.pyi | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/typings/netius/base/agent.pyi b/src/typings/netius/base/agent.pyi index d4814c28..2f52cd36 100644 --- a/src/typings/netius/base/agent.pyi +++ b/src/typings/netius/base/agent.pyi @@ -1,23 +1,20 @@ import netius.base.legacy as legacy import netius.base.observer import netius.base.observer as observer -from typing import ClassVar +from typing import ClassVar, Any, Self -__version__: str -__revision__: str -__date__: str class Agent(netius.base.observer.Observable): @classmethod - def cleanup_s(cls): ... - def cleanup(self, destroy: bool = ...): ... - def destroy(self): ... + def cleanup_s(cls) -> None: ... + def cleanup(self, destroy: bool = ...) -> None: ... + def destroy(self) -> None: ... class ClientAgent(Agent): _clients: ClassVar[dict] = ... @classmethod - def cleanup_s(cls): ... + def cleanup_s(cls) -> None: ... @classmethod - def get_client_s(cls, *args, **kwargs): ... + def get_client_s(cls, *args, **kwargs)-> Self@ClientAgent: ... class ServerAgent(Agent): ... From 58012d565577d7bfcff089ac46f3e32839f3b82a Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Thu, 14 Dec 2023 19:08:18 +0000 Subject: [PATCH 20/20] review src/typings/netius/base/async_neo.pyi --- src/typings/netius/base/async_neo.pyi | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/typings/netius/base/async_neo.pyi b/src/typings/netius/base/async_neo.pyi index 0ab9b3e4..858af754 100644 --- a/src/typings/netius/base/async_neo.pyi +++ b/src/typings/netius/base/async_neo.pyi @@ -2,44 +2,44 @@ import netius.base.async_old import netius.base.async_old as async_old import netius.base.errors as errors import netius.base.legacy as legacy -from _typeshed import Incomplete -from typing import ClassVar - -__version__: str -__revision__: str -__date__: str +from typing import ClassVar, Any, Generator, Tuple, Union, Callable, Optional, Type, ModuleType class Future(netius.base.async_old.Future): - def __iter__(self): ... - def __await__(self): ... + def __iter__(self) -> Future: ... + def __await__(self) -> Generator[None, None, Any]: ... + +class Future: + def __iter__(self) -> Future: ... + def __await__(self) -> Generator[None, None, Any]: ... class AwaitWrapper: _is_generator: ClassVar[bool] = ... - def __init__(self, generator, generate: bool = ...) -> None: ... - def __await__(self): ... - def __iter__(self): ... - def __next__(self): ... - def next(self): ... - def generate(self, value): ... - def _await_generator(self): ... - def _await_basic(self): ... + def __init__(self, generator: Generator, generate: bool = ...) -> None: ... + def __await__(self)-> (Generator[Any, Any, Any | None] | Generator[None, Any, Generator[Any, Any, None] | Any]): ... + def __iter__(self) -> AwaitWrapper: ... + def __next__(self) -> Any: ... + def next(self) -> Any: ... + def generate(self, value: Any) -> Generator[Any, Any, None]: ... + def _await_generator(self) -> Generator[Any, Any, Any | None]: ... + def _await_basic(self) -> Generator[None, Any, Generator[Any, Any, None] | Any]: ... class CoroutineWrapper: - def __init__(self, coroutine) -> None: ... - def __iter__(self): ... - def __next__(self): ... - def next(self): ... - def restore(self, value): ... -def coroutine(function): ... -def ensure_generator(value): ... -def get_asyncio(): ... -def is_coroutine(callable): ... -def is_coroutine_object(generator): ... -def is_coroutine_native(generator): ... -def is_future(future): ... -def _sleep(timeout, compat: bool = ...): ... -def _wait(event, timeout: Incomplete | None = ..., future: Incomplete | None = ...): ... -def sleep(*args, **kwargs): ... -def wait(*args, **kwargs): ... -def coroutine_return(coroutine): ... -def _coroutine_return(coroutine): ... + def __init__(self, coroutine: Generator) -> None: ... + def __iter__(self) -> CoroutineWrapper: ... + def __next__(self) -> Any: ... + def next(self) -> Any: ... + def restore(self, value: Any) -> None: ... + +def coroutine(function: Callable) -> Callable: ... +def ensure_generator(value: Any) -> Tuple[bool, Union[Generator, CoroutineWrapper, Any]]: ... +def get_asyncio() -> Optional[Type[ModuleType]]: ... +def is_coroutine(callable: Callable) -> bool: ... +def is_coroutine_object(generator: Any) -> bool: ... +def is_coroutine_native(generator: Any) -> bool: ... +def is_future(future: Any) -> bool: ... +def _sleep(timeout: float, compat: bool = ...) -> Generator: ... +def _wait(event: Any, timeout: Optional[float] = ..., future: Any = ...) -> AwaitWrapper: ... +def sleep(*args, **kwargs) -> AwaitWrapper: ... +def wait(*args, **kwargs) -> AwaitWrapper: ... +def coroutine_return(coroutine: CoroutineWrapper) -> AwaitWrapper: ... +def _coroutine_return(coroutine: CoroutineWrapper) -> Generator[Any, None, Any]: ...