diff options
-rw-r--r-- | poetry.lock | 28 | ||||
-rw-r--r-- | pyproject.toml | 4 | ||||
-rw-r--r-- | slack/commands.py | 2 | ||||
-rw-r--r-- | slack/config.py | 7 | ||||
-rw-r--r-- | slack/slack_buffer.py | 3 | ||||
-rw-r--r-- | tests/test_unfurl.py | 6 | ||||
-rw-r--r-- | typings/websocket.pyi | 5 | ||||
-rw-r--r-- | wee_slack.py | 2 |
8 files changed, 43 insertions, 14 deletions
diff --git a/poetry.lock b/poetry.lock index 1a1aec0..a74cfbd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -343,6 +343,32 @@ pytest = ">=4.6" testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] [[package]] +name = "ruff" +version = "0.1.7" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7f80496854fdc65b6659c271d2c26e90d4d401e6a4a31908e7e334fab4645aac"}, + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:1ea109bdb23c2a4413f397ebd8ac32cb498bee234d4191ae1a310af760e5d287"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b0c2de9dd9daf5e07624c24add25c3a490dbf74b0e9bca4145c632457b3b42a"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:69a4bed13bc1d5dabf3902522b5a2aadfebe28226c6269694283c3b0cecb45fd"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:de02ca331f2143195a712983a57137c5ec0f10acc4aa81f7c1f86519e52b92a1"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:45b38c3f8788a65e6a2cab02e0f7adfa88872696839d9882c13b7e2f35d64c5f"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c64cb67b2025b1ac6d58e5ffca8f7b3f7fd921f35e78198411237e4f0db8e73"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9dcc6bb2f4df59cb5b4b40ff14be7d57012179d69c6565c1da0d1f013d29951b"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2bb4bb6bbe921f6b4f5b6fdd8d8468c940731cb9406f274ae8c5ed7a78c478"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:276a89bcb149b3d8c1b11d91aa81898fe698900ed553a08129b38d9d6570e717"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:90c958fe950735041f1c80d21b42184f1072cc3975d05e736e8d66fc377119ea"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6b05e3b123f93bb4146a761b7a7d57af8cb7384ccb2502d29d736eaade0db519"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:290ecab680dce94affebefe0bbca2322a6277e83d4f29234627e0f8f6b4fa9ce"}, + {file = "ruff-0.1.7-py3-none-win32.whl", hash = "sha256:416dfd0bd45d1a2baa3b1b07b1b9758e7d993c256d3e51dc6e03a5e7901c7d80"}, + {file = "ruff-0.1.7-py3-none-win_amd64.whl", hash = "sha256:4af95fd1d3b001fc41325064336db36e3d27d2004cdb6d21fd617d45a172dd96"}, + {file = "ruff-0.1.7-py3-none-win_arm64.whl", hash = "sha256:0683b7bfbb95e6df3c7c04fe9d78f631f8e8ba4868dfc932d43d690698057e2e"}, + {file = "ruff-0.1.7.tar.gz", hash = "sha256:dffd699d07abf54833e5f6cc50b85a6ff043715da8788c4a79bcd4ab4734d306"}, +] + +[[package]] name = "setuptools" version = "68.0.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" @@ -464,4 +490,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "95d6635618af43e14f5b06cd5ec9c0cd26398e4df0d5cef37824a2268a561620" +content-hash = "8bcd09a256d95f9341b624cb152a5d172f536e4b84b355c814c58e839026344a" diff --git a/pyproject.toml b/pyproject.toml index 9b232fb..5a8e1d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,9 @@ [tool.black] extend-exclude = '^/typings/weechat.pyi' +[tool.ruff] +extend-exclude = ['typings/weechat.pyi'] + [tool.isort] profile = "black" @@ -26,6 +29,7 @@ pytest-cov = "^4.0.0" isort = "^5.10.1" typing-extensions = "^4.4.0" pyright = "^1.1.323" +ruff = "^0.1.7" [tool.pylint.main] ignored-modules = ["weechat"] diff --git a/slack/commands.py b/slack/commands.py index 2d7cb09..9dc277d 100644 --- a/slack/commands.py +++ b/slack/commands.py @@ -68,7 +68,7 @@ def weechat_command( Callable[[str, str], None], ]: def decorator( - f: Callable[[str, List[str], Dict[str, Optional[str]]], None] + f: Callable[[str, List[str], Dict[str, Optional[str]]], None], ) -> Callable[[str, str], None]: cmd = removeprefix(f.__name__, "command_").replace("_", " ") top_level = " " not in cmd diff --git a/slack/config.py b/slack/config.py index 10cc0a6..7defa99 100644 --- a/slack/config.py +++ b/slack/config.py @@ -367,11 +367,8 @@ def config_section_workspace_write_for_old_weechat_cb( for workspace in shared.workspaces.values(): for option in vars(workspace.config).values(): if isinstance(option, WeeChatOption): - if ( - option.weechat_type != "string" - or not weechat.config_option_is_null( - option._pointer # pyright: ignore [reportPrivateUsage] - ) + if option.weechat_type != "string" or not weechat.config_option_is_null( + option._pointer # pyright: ignore [reportPrivateUsage] ): if not weechat.config_write_option( config_file, diff --git a/slack/slack_buffer.py b/slack/slack_buffer.py index 2739bf1..63aa07c 100644 --- a/slack/slack_buffer.py +++ b/slack/slack_buffer.py @@ -421,7 +421,8 @@ class SlackBuffer(ABC): escaped_text = ( htmlescape(text) # Replace some WeeChat formatting chars with Slack formatting chars - .replace("\x02", "*").replace("\x1D", "_") + .replace("\x02", "*") + .replace("\x1D", "_") ) users = await gather(*self.workspace.users.values(), return_exceptions=True) diff --git a/tests/test_unfurl.py b/tests/test_unfurl.py index 94948d9..aeb5e5a 100644 --- a/tests/test_unfurl.py +++ b/tests/test_unfurl.py @@ -52,10 +52,8 @@ cases: List[Case] = [ @pytest.mark.parametrize("case", cases) def test_unfurl_refs(case: Case, message1_in_channel_public: SlackMessage): - parsed = ( - message1_in_channel_public._unfurl_refs( # pyright: ignore [reportPrivateUsage] - case["input"] - ) + parsed = message1_in_channel_public._unfurl_refs( # pyright: ignore [reportPrivateUsage] + case["input"] ) resolved = "".join(resolve_pending_message_item(item) for item in parsed) assert resolved == case["output"] diff --git a/typings/websocket.pyi b/typings/websocket.pyi index 3e5d683..0f58718 100644 --- a/typings/websocket.pyi +++ b/typings/websocket.pyi @@ -55,7 +55,10 @@ 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: ... diff --git a/wee_slack.py b/wee_slack.py index a3d5ea4..420c4f4 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1595,7 +1595,7 @@ class SlackTeam(object): users, bots, channels, - **kwargs + **kwargs, ): self.slack_api_translator = copy.deepcopy(SLACK_API_TRANSLATOR) self.identifier = team_info["id"] |