-
Couldn't load subscription status.
- Fork 5
Add base module type stubs #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joamag
wants to merge
3
commits into
master
Choose a base branch
from
codex/handle-task-from-github-issue-#36
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+414
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from typing import Any | ||
|
|
||
| from .observer import Observable | ||
| from .client import Client | ||
|
|
||
| class Agent(Observable): | ||
| @classmethod | ||
| def cleanup_s(cls) -> None: ... | ||
| def cleanup(self, destroy: bool = ...) -> None: ... | ||
| def destroy(self) -> None: ... | ||
|
|
||
| class ClientAgent(Agent): | ||
| _clients: dict[int, Client] | ||
|
|
||
| @classmethod | ||
| def cleanup_s(cls) -> None: ... | ||
| @classmethod | ||
| def get_client_s(cls, *args, **kwargs) -> Client: ... | ||
|
|
||
| class ServerAgent(Agent): | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| from typing import Any | ||
|
|
||
| from .common import Base, BaseThread | ||
|
|
||
| class Client(Base): | ||
| _client: "Client | None" = None | ||
|
|
||
| def __init__(self, thread: bool = ..., daemon: bool = ..., *args, **kwargs): ... | ||
| @classmethod | ||
| def get_client_s(cls, *args, **kwargs) -> "Client": ... | ||
| @classmethod | ||
| def cleanup_s(cls) -> None: ... | ||
| def ensure_loop(self, env: bool = ...) -> None: ... | ||
| def join(self, timeout: float | None = ...) -> None: ... | ||
| def connect( | ||
| self, | ||
| host: str, | ||
| port: int, | ||
| ssl: bool = ..., | ||
| key_file: str | None = ..., | ||
| cer_file: str | None = ..., | ||
| ca_file: str | None = ..., | ||
| ca_root: bool = ..., | ||
| ssl_verify: bool = ..., | ||
| family: int = ..., | ||
| type: int = ..., | ||
| ensure_loop: bool = ..., | ||
| env: bool = ..., | ||
| ) -> bool: ... | ||
|
|
||
| class DatagramClient(Client): | ||
| def __init__(self, *args, **kwargs): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| from typing import Any, Callable, Iterable | ||
| import threading | ||
|
|
||
| class BaseThread(threading.Thread): | ||
| def __init__( | ||
| self, owner: Any | None = ..., daemon: bool = ..., *args, **kwargs | ||
| ): ... | ||
| def run(self) -> None: ... | ||
|
|
||
| def new_loop_main( | ||
| factory: type | None = ..., env: bool = ..., _compat: bool | None = ..., **kwargs | ||
| ) -> Any: ... | ||
| def new_loop_asyncio(**kwargs) -> Any | None: ... | ||
| def new_loop( | ||
| factory: type | None = ..., | ||
| _compat: bool | None = ..., | ||
| asyncio: bool | None = ..., | ||
| **kwargs | ||
| ) -> Any: ... | ||
| def ensure_main(factory: type | None = ..., env: bool = ..., **kwargs) -> None: ... | ||
| def ensure_asyncio(**kwargs) -> Any | None: ... | ||
| def ensure_loop( | ||
| factory: type | None = ..., asyncio: bool | None = ..., **kwargs | ||
| ) -> None: ... | ||
| def get_main(factory: type | None = ..., ensure: bool = ..., **kwargs) -> Any: ... | ||
| def get_loop( | ||
| factory: type | None = ..., | ||
| ensure: bool = ..., | ||
| _compat: bool | None = ..., | ||
| asyncio: bool | None = ..., | ||
| **kwargs | ||
| ) -> Any: ... | ||
| def get_event_loop(*args, **kwargs) -> Any: ... | ||
| def stop_loop(compat: bool = ..., asyncio: bool = ...) -> None: ... | ||
| def compat_loop(loop: Any) -> Any: ... | ||
| def get_poll() -> Any: ... | ||
| def build_future(compat: bool = ..., asyncio: bool = ...) -> Any: ... | ||
| def ensure( | ||
| coroutine: Callable[..., Any], | ||
| args: Iterable[Any] | None = ..., | ||
| kwargs: dict | None = ..., | ||
| thread: bool | None = ..., | ||
| ) -> Any: ... | ||
| def ensure_pool( | ||
| coroutine: Callable[..., Any], | ||
| args: Iterable[Any] | None = ..., | ||
| kwargs: dict | None = ..., | ||
| ) -> Any: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| from typing import Any | ||
|
|
||
| from .common import Base | ||
| from .server import StreamServer | ||
|
|
||
| class Container(Base): | ||
| owner: Base | None | ||
| bases: list[Base] | ||
|
|
||
| def __init__(self, *args, **kwargs): ... | ||
| def start(self, owner: Base) -> None: ... | ||
| def cleanup(self) -> None: ... | ||
| def loop(self) -> None: ... | ||
| def ticks(self) -> None: ... | ||
| def connections_dict(self, full: bool = ...) -> dict[str, Any]: ... | ||
| def connection_dict(self, id: str, full: bool = ...) -> dict[str, Any] | None: ... | ||
| def on_start(self) -> None: ... | ||
| def on_stop(self) -> None: ... | ||
| def add_base(self, base: Base) -> None: ... | ||
| def remove_base(self, base: Base) -> None: ... | ||
| def start_base(self, base: Base) -> None: ... | ||
| def start_all(self) -> None: ... | ||
| def apply_all(self) -> None: ... | ||
| def apply_base(self, base: Base) -> None: ... | ||
| def call_all(self, name: str, *args, **kwargs) -> None: ... | ||
| def trigger_all(self, name: str, *args, **kwargs) -> None: ... | ||
|
|
||
| class ContainerServer(StreamServer): | ||
| container: Container | ||
|
|
||
| def __init__(self, *args, **kwargs): ... | ||
| def start(self) -> None: ... | ||
| def stop(self) -> None: ... | ||
| def cleanup(self) -> None: ... | ||
| def add_base(self, base: Base) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| from typing import Any, Callable | ||
|
|
||
| class Observable: | ||
| events: dict[str, list[Callable[..., Any]]] | ||
|
|
||
| def __init__(self, *args, **kwargs): ... | ||
| def build(self) -> None: ... | ||
| def destroy(self) -> None: ... | ||
| def bind( | ||
| self, name: str, method: Callable[..., Any], oneshot: bool = ... | ||
| ) -> None: ... | ||
| def unbind(self, name: str, method: Callable[..., Any] | None = ...) -> None: ... | ||
| def unbind_all(self) -> None: ... | ||
| def trigger(self, name: str, *args, **kwargs) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| from typing import Any | ||
|
|
||
| class Poll: | ||
| timeout: float | ||
|
|
||
| def __init__(self): ... | ||
| @classmethod | ||
| def name(cls) -> str: ... | ||
| @classmethod | ||
| def test(cls) -> bool: ... | ||
| def open(self, timeout: float = ...) -> None: ... | ||
| def close(self) -> None: ... | ||
| def poll(self) -> tuple[list[Any], list[Any], list[Any]]: ... | ||
| def poll_owner(self) -> dict[Any, tuple[list[Any], list[Any], list[Any]]]: ... | ||
| def is_open(self) -> bool: ... | ||
| def is_edge(self) -> bool: ... | ||
| def is_empty(self) -> bool: ... | ||
| def sub_all(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_all(self, socket: Any) -> None: ... | ||
| def is_sub_read(self, socket: Any) -> bool: ... | ||
| def is_sub_write(self, socket: Any) -> bool: ... | ||
| def is_sub_error(self, socket: Any) -> bool: ... | ||
| def sub_read(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_write(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_error(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_read(self, socket: Any) -> None: ... | ||
| def unsub_write(self, socket: Any) -> None: ... | ||
| def unsub_error(self, socket: Any) -> None: ... | ||
|
|
||
| class EpollPoll(Poll): | ||
| def __init__(self, *args, **kwargs): ... | ||
| @classmethod | ||
| def test(cls) -> bool: ... | ||
| def open(self, timeout: float = ...) -> None: ... | ||
| def close(self) -> None: ... | ||
| def poll(self) -> tuple[list[Any], list[Any], list[Any]]: ... | ||
| def is_edge(self) -> bool: ... | ||
| def sub_read(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_write(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_error(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_read(self, socket: Any) -> None: ... | ||
| def unsub_write(self, socket: Any) -> None: ... | ||
| def unsub_error(self, socket: Any) -> None: ... | ||
|
|
||
| class KqueuePoll(Poll): | ||
| def __init__(self, *args, **kwargs): ... | ||
| @classmethod | ||
| def test(cls) -> bool: ... | ||
| def open(self, timeout: float = ...) -> None: ... | ||
| def close(self) -> None: ... | ||
| def poll(self) -> tuple[list[Any], list[Any], list[Any]]: ... | ||
| def is_edge(self) -> bool: ... | ||
| def sub_read(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_write(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_error(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_read(self, socket: Any) -> None: ... | ||
| def unsub_write(self, socket: Any) -> None: ... | ||
| def unsub_error(self, socket: Any) -> None: ... | ||
|
|
||
| class PollPoll(Poll): | ||
| def __init__(self, *args, **kwargs): ... | ||
| @classmethod | ||
| def test(cls) -> bool: ... | ||
| def open(self, timeout: float = ...) -> None: ... | ||
| def close(self) -> None: ... | ||
| def poll(self) -> tuple[list[Any], list[Any], list[Any]]: ... | ||
| def is_edge(self) -> bool: ... | ||
| def sub_read(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_write(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_error(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_read(self, socket: Any) -> None: ... | ||
| def unsub_write(self, socket: Any) -> None: ... | ||
| def unsub_error(self, socket: Any) -> None: ... | ||
|
|
||
| class SelectPoll(Poll): | ||
| def __init__(self, *args, **kwargs): ... | ||
| def open(self, timeout: float = ...) -> None: ... | ||
| def close(self) -> None: ... | ||
| def poll(self) -> tuple[list[Any], list[Any], list[Any]]: ... | ||
| def is_edge(self) -> bool: ... | ||
| def sub_read(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_write(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def sub_error(self, socket: Any, owner: Any | None = ...) -> None: ... | ||
| def unsub_read(self, socket: Any) -> None: ... | ||
| def unsub_write(self, socket: Any) -> None: ... | ||
| def unsub_error(self, socket: Any) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| from typing import Any, Mapping | ||
|
|
||
| from .common import Base | ||
|
|
||
| class Server(Base): | ||
| socket: Any | ||
| host: str | None | ||
| port: int | str | None | ||
| type: int | None | ||
| ssl: bool | ||
| key_file: str | None | ||
| cer_file: str | None | ||
| ca_file: str | None | ||
| env: bool | ||
|
|
||
| def __init__(self, *args, **kwargs): ... | ||
| def welcome(self) -> None: ... | ||
| def cleanup(self) -> None: ... | ||
| def info_dict(self, full: bool = ...) -> Mapping[str, Any]: ... | ||
| def serve( | ||
| self, | ||
| host: str | None = ..., | ||
| port: int | str | None = ..., | ||
| type: int = ..., | ||
| ipv6: bool = ..., | ||
| ssl: bool = ..., | ||
| key_file: str | None = ..., | ||
| cer_file: str | None = ..., | ||
| ca_file: str | None = ..., | ||
| ca_root: bool = ..., | ||
| ssl_verify: bool = ..., | ||
| ssl_host: str | None = ..., | ||
| ssl_fingerprint: str | None = ..., | ||
| ssl_dump: bool = ..., | ||
| setuid: int | None = ..., | ||
| backlog: int = ..., | ||
| load: bool = ..., | ||
| start: bool = ..., | ||
| env: bool = ..., | ||
| ) -> None: ... | ||
|
|
||
| class DatagramServer(Server): | ||
| def __init__(self, *args, **kwargs): ... | ||
| def reads(self, reads: list[Any], state: bool = ...) -> None: ... | ||
| def writes(self, writes: list[Any], state: bool = ...) -> None: ... | ||
| def errors(self, errors: list[Any], state: bool = ...) -> None: ... | ||
| def serve(self, type: int = ..., *args, **kwargs) -> None: ... | ||
| def on_read(self, _socket: Any) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| from typing import Any | ||
|
|
||
| from .observer import Observable | ||
| from .transport import Transport | ||
|
|
||
| class Service(Observable): | ||
| owner: Any | None | ||
| transport: Transport | None | ||
| socket: Any | None | ||
| host: str | None | ||
| port: Any | None | ||
| ssl: bool | ||
| receive_buffer_s: int | None | ||
| send_buffer_s: int | None | ||
| receive_buffer_c: int | None | ||
| send_buffer_c: int | None | ||
|
|
||
| def __init__( | ||
| self, | ||
| owner: Any | None = ..., | ||
| transport: Transport | None = ..., | ||
| socket: Any | None = ..., | ||
| host: str | None = ..., | ||
| port: Any | None = ..., | ||
| ssl: bool = ..., | ||
| receive_buffer_s: int | None = ..., | ||
| send_buffer_s: int | None = ..., | ||
| receive_buffer_c: int | None = ..., | ||
| send_buffer_c: int | None = ..., | ||
| ): ... | ||
| def on_socket_c(self, socket_c: Any, address: Any) -> None: ... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from typing import Any | ||
|
|
||
| from .observer import Observable | ||
|
|
||
| OPEN: int | ||
| CLOSED: int | ||
| PENDING: int | ||
|
|
||
| class Stream(Observable): | ||
| status: int | ||
| owner: Any | None | ||
| connection: Any | None | ||
|
|
||
| def __init__(self, owner: Any | None = ...): ... | ||
| def reset(self) -> None: ... | ||
| def open(self) -> None: ... | ||
| def close(self) -> None: ... | ||
| def info_dict(self, full: bool = ...) -> dict[str, Any]: ... | ||
| def is_open(self) -> bool: ... | ||
| def is_closed(self) -> bool: ... | ||
| def is_pending(self) -> bool: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| def camel_to_underscore(camel: str, separator: str = ...) -> str: ... | ||
| def verify( | ||
| condition: bool, message: str | None = ..., exception: type | None = ... | ||
| ) -> None: ... |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing stub for
transport.You import
Transportfrom.transportbut notransport.pyiis included in this PR. Please confirm that a stub exists for this module or add it here.🤖 Prompt for AI Agents