aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-07-14 12:39:55 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit1b2f7742c9893a86bc150dcaec1b76b899f042be (patch)
treeba3db2bfff6970d429bd8b48d53c02b446532028
parent9457fb1de585458db6330e0b52805131300584c6 (diff)
downloadwee-slack-1b2f7742c9893a86bc150dcaec1b76b899f042be.tar.gz
Fix typings for create_connection
-rw-r--r--poetry.lock8
-rw-r--r--pyproject.toml2
-rw-r--r--slack/slack_workspace.py13
-rw-r--r--typings/websocket.pyi30
4 files changed, 37 insertions, 16 deletions
diff --git a/poetry.lock b/poetry.lock
index 6573b91..ee67f91 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -293,13 +293,13 @@ testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "pyright"
-version = "1.1.292"
+version = "1.1.317"
description = "Command line wrapper for pyright"
optional = false
python-versions = ">=3.7"
files = [
- {file = "pyright-1.1.292-py3-none-any.whl", hash = "sha256:23d1f14b15afe38bb7a7117b9861ad0546aff078da312d294e60a727445c23ff"},
- {file = "pyright-1.1.292.tar.gz", hash = "sha256:035ea1af6fabfdcc80c0afb545f677bd377114157d69779cce2a642ff894e51c"},
+ {file = "pyright-1.1.317-py3-none-any.whl", hash = "sha256:9cf24f83fe8f2cf00773068e06ce771f03331590c7d5e771546f81d7f60efaba"},
+ {file = "pyright-1.1.317.tar.gz", hash = "sha256:74da4d3e2dcfe66a2d1d1001e16431ec17aac0ad35b03c0410f7379c2cb5c7f0"},
]
[package.dependencies]
@@ -457,4 +457,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
[metadata]
lock-version = "2.0"
python-versions = "^3.7"
-content-hash = "2a4a604c27d9462caca2a80ec4cb98da113f5e08de0ac3dffcc8e15e840293de"
+content-hash = "45a10a7a4ad40815e48cdb08d73af58bd07d414eb49f9cf00cf1d3490392f114"
diff --git a/pyproject.toml b/pyproject.toml
index 0a6c406..b633e7f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,7 +25,7 @@ pytest = "^7.1.3"
pytest-cov = "^4.0.0"
isort = "^5.10.1"
typing-extensions = "^4.4.0"
-pyright = "^1.1.292"
+pyright = "^1.1.317"
[tool.pylint.main]
ignored-modules = ["weechat"]
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index 51e4a89..d28083e 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -215,18 +215,15 @@ class SlackWorkspace:
async def _connect_ws(self, url: str):
proxy = Proxy()
- proxy_options = {
- "proxy_type": proxy.type,
- "http_proxy_host": proxy.address,
- "http_proxy_port": proxy.port,
- "http_proxy_auth": (proxy.username, proxy.password),
- "http_proxy_timeout": self.config.network_timeout.value,
- }
# TODO: Handle errors
self._ws = create_connection(
url,
self.config.network_timeout.value,
- **proxy_options,
+ proxy_type=proxy.type,
+ http_proxy_host=proxy.address,
+ http_proxy_port=proxy.port,
+ http_proxy_auth=(proxy.username, proxy.password),
+ http_proxy_timeout=self.config.network_timeout.value,
)
self._hook_ws_fd = weechat.hook_fd(
diff --git a/typings/websocket.pyi b/typings/websocket.pyi
index 0eaeda7..0b9b769 100644
--- a/typings/websocket.pyi
+++ b/typings/websocket.pyi
@@ -1,5 +1,7 @@
from socket import socket
-from typing import Any, Dict, Optional, Tuple
+from typing import Any
+
+from _typeshed import ReadableBuffer
STATUS_NORMAL = 1000
@@ -52,11 +54,33 @@ class WebSocket:
def ping(self, payload: str = ...) -> None: ...
def recv_data(
self, control_frame: bool
- ) -> Tuple[int, Any,]: ...
+ ) -> tuple[int, Any,]: ...
def close(
self, status: int = STATUS_NORMAL, reason: bytes = b"", timeout: int = 3
) -> None: ...
def create_connection(
- url: str, timeout: Optional[int] = ..., **options: Dict[str, Any]
+ url: str,
+ timeout: int | float | None = ...,
+ class_: type[Any] = WebSocket,
+ header: list[str] | dict[str, str] | None = ...,
+ cookie: str | None = ...,
+ origin: str | None = ...,
+ suppress_origin: bool | None = ...,
+ host: str | None = ...,
+ proxy_type: str | None = ...,
+ http_proxy_host: str | None = ...,
+ http_proxy_port: str | int | None = ...,
+ http_no_proxy: list[str] | None = ...,
+ http_proxy_auth: tuple[str, str] | None = ...,
+ http_proxy_timeout: int | float | None = ...,
+ enable_multithread: bool | None = ...,
+ redirect_limit: int | None = ...,
+ sockopt: tuple[int, int, int | ReadableBuffer]
+ | tuple[int, int, None, int]
+ | None = ...,
+ sslopt: dict[str, Any] | None = ...,
+ subprotocols: list[str] | None = ...,
+ skip_utf8_validation: bool | None = ...,
+ socket: socket | None = ...,
) -> WebSocket: ...