From e16afcb30caf2c9f194b01269d809693f414aad1 Mon Sep 17 00:00:00 2001 From: Daan Debie Date: Fri, 22 Nov 2024 15:50:21 +0100 Subject: [PATCH] chore: update ruff, update minimum version for ruff to Python 3.9 and fix linting errors --- .github/workflows/ci.yml | 4 +-- .pre-commit-config.yaml | 2 +- machine/clients/slack.py | 5 ++-- machine/core.py | 5 ++-- machine/handlers/command_handler.py | 3 +- machine/handlers/event_handler.py | 3 +- machine/handlers/interactive_handler.py | 3 +- machine/handlers/message_handler.py | 3 +- machine/models/channel.py | 4 +-- machine/models/core.py | 3 +- machine/models/interactive.py | 37 +++++++++++------------ machine/plugins/base.py | 3 +- machine/plugins/block_action.py | 3 +- machine/plugins/command.py | 3 +- machine/plugins/decorators.py | 3 +- machine/plugins/message.py | 3 +- machine/plugins/modals.py | 3 +- machine/settings.py | 3 +- machine/storage/backends/base.py | 3 +- machine/storage/backends/dynamodb.py | 3 +- machine/storage/backends/memory.py | 3 +- machine/storage/backends/redis.py | 3 +- machine/storage/backends/sqlite.py | 3 +- machine/utils/collections.py | 3 +- machine/utils/logging.py | 3 +- machine/utils/module_loading.py | 3 +- machine/utils/redis.py | 3 +- poetry.lock | 40 ++++++++++++------------- pyproject.toml | 3 +- tests/clients/test_slack_client.py | 2 +- tests/utils/test_datetime.py | 6 +--- 31 files changed, 93 insertions(+), 78 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4879f783..5a52ce7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.13" - - uses: chartboost/ruff-action@v1 - - uses: chartboost/ruff-action@v1 + - uses: astral-sh/ruff-action@v1 + - uses: astral-sh/ruff-action@v1 with: args: "format --check" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 884ce6bd..6abdd23c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.7.4 + rev: v0.8.0 hooks: # Run the linter. - id: ruff diff --git a/machine/clients/slack.py b/machine/clients/slack.py index c4563bb3..9e1220a7 100644 --- a/machine/clients/slack.py +++ b/machine/clients/slack.py @@ -1,8 +1,10 @@ from __future__ import annotations import asyncio +from collections.abc import AsyncGenerator, Awaitable from datetime import datetime -from typing import Any, AsyncGenerator, Awaitable, Callable +from typing import Any, Callable +from zoneinfo import ZoneInfo from slack_sdk.errors import SlackApiError from slack_sdk.models.views import View @@ -13,7 +15,6 @@ from slack_sdk.web.async_client import AsyncWebClient from slack_sdk.web.async_slack_response import AsyncSlackResponse from structlog.stdlib import get_logger -from zoneinfo import ZoneInfo from machine.models import Channel, User from machine.utils.datetime import calculate_epoch diff --git a/machine/core.py b/machine/core.py index eb36f688..c9da1493 100644 --- a/machine/core.py +++ b/machine/core.py @@ -4,15 +4,16 @@ import inspect import os import sys +from collections.abc import Awaitable from inspect import Signature -from typing import Awaitable, Callable, Literal, cast +from typing import Callable, Literal, cast +from zoneinfo import ZoneInfo import dill from apscheduler.schedulers.asyncio import AsyncIOScheduler from slack_sdk.socket_mode.aiohttp import SocketModeClient from slack_sdk.web.async_client import AsyncWebClient from structlog.stdlib import get_logger -from zoneinfo import ZoneInfo from machine.clients.slack import SlackClient from machine.handlers import ( diff --git a/machine/handlers/command_handler.py b/machine/handlers/command_handler.py index f6ca86a9..8e7a10d7 100644 --- a/machine/handlers/command_handler.py +++ b/machine/handlers/command_handler.py @@ -1,7 +1,8 @@ from __future__ import annotations import contextlib -from typing import Any, AsyncGenerator, Awaitable, Callable, Union, cast +from collections.abc import AsyncGenerator, Awaitable +from typing import Any, Callable, Union, cast from slack_sdk.models import JsonObject from slack_sdk.socket_mode.async_client import AsyncBaseSocketModeClient diff --git a/machine/handlers/event_handler.py b/machine/handlers/event_handler.py index 1f125670..b3015ff4 100644 --- a/machine/handlers/event_handler.py +++ b/machine/handlers/event_handler.py @@ -1,7 +1,8 @@ from __future__ import annotations import asyncio -from typing import Any, Awaitable, Callable +from collections.abc import Awaitable +from typing import Any, Callable from slack_sdk.socket_mode.async_client import AsyncBaseSocketModeClient from slack_sdk.socket_mode.request import SocketModeRequest diff --git a/machine/handlers/interactive_handler.py b/machine/handlers/interactive_handler.py index 7d2a1c10..26c1b26a 100644 --- a/machine/handlers/interactive_handler.py +++ b/machine/handlers/interactive_handler.py @@ -3,7 +3,8 @@ import asyncio import contextlib import re -from typing import AsyncGenerator, Awaitable, Callable, Union, cast +from collections.abc import AsyncGenerator, Awaitable +from typing import Callable, Union, cast from slack_sdk.models.views import View from slack_sdk.socket_mode.async_client import AsyncBaseSocketModeClient diff --git a/machine/handlers/message_handler.py b/machine/handlers/message_handler.py index de1535ae..f5e6aff7 100644 --- a/machine/handlers/message_handler.py +++ b/machine/handlers/message_handler.py @@ -2,7 +2,8 @@ import asyncio import re -from typing import Any, Awaitable, Callable, Mapping +from collections.abc import Awaitable, Mapping +from typing import Any, Callable from slack_sdk.socket_mode.async_client import AsyncBaseSocketModeClient from slack_sdk.socket_mode.request import SocketModeRequest diff --git a/machine/models/channel.py b/machine/models/channel.py index 57f5b697..87207c68 100644 --- a/machine/models/channel.py +++ b/machine/models/channel.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional from pydantic import BaseModel, ConfigDict @@ -36,7 +36,7 @@ class Channel(BaseModel): user: Optional[str] = None topic: Optional[PurposeTopic] = None purpose: Optional[PurposeTopic] = None - previous_names: Optional[List[str]] = None + previous_names: Optional[list[str]] = None @property def identifier(self) -> str: diff --git a/machine/models/core.py b/machine/models/core.py index ee141821..4b59ad35 100644 --- a/machine/models/core.py +++ b/machine/models/core.py @@ -1,9 +1,10 @@ from __future__ import annotations import re +from collections.abc import AsyncGenerator, Awaitable from dataclasses import dataclass, field from inspect import Signature -from typing import Any, AsyncGenerator, Awaitable, Callable, Union +from typing import Any, Callable, Union from slack_sdk.models import JsonObject diff --git a/machine/models/interactive.py b/machine/models/interactive.py index d8934c8e..52b121fb 100644 --- a/machine/models/interactive.py +++ b/machine/models/interactive.py @@ -1,13 +1,12 @@ from __future__ import annotations from datetime import date, time -from typing import Any, Dict, List, Literal, Optional, Union +from typing import Annotated, Any, Literal, Optional, Union from pydantic import BaseModel, Field, TypeAdapter from pydantic.functional_validators import PlainValidator, model_validator from pydantic_core.core_schema import ValidationInfo from slack_sdk.models.blocks import Block as SlackSDKBlock -from typing_extensions import Annotated class TypedModel(BaseModel): @@ -77,7 +76,7 @@ class Option(BaseModel): class CheckboxValues(TypedModel): type: Literal["checkboxes"] - selected_options: List[Option] + selected_options: list[Option] class DatepickerValue(TypedModel): @@ -117,27 +116,27 @@ class ExternalSelectValue(TypedModel): class MultiStaticSelectValues(TypedModel): type: Literal["multi_static_select"] - selected_options: List[Option] + selected_options: list[Option] class MultiChannelSelectValues(TypedModel): type: Literal["multi_channels_select"] - selected_channels: List[str] + selected_channels: list[str] class MultiConversationSelectValues(TypedModel): type: Literal["multi_conversations_select"] - selected_conversations: List[str] + selected_conversations: list[str] class MultiUserSelectValues(TypedModel): type: Literal["multi_users_select"] - selected_users: List[str] + selected_users: list[str] class MultiExternalSelectValues(TypedModel): type: Literal["multi_external_select"] - selected_options: List[str] + selected_options: list[str] class NumberValue(TypedModel): @@ -197,7 +196,7 @@ class UrlValue(TypedModel): class State(BaseModel): - values: Dict[str, Dict[str, Values]] + values: dict[str, dict[str, Values]] class BaseAction(TypedModel): @@ -221,7 +220,7 @@ class ButtonAction(BaseAction): class CheckboxAction(BaseAction): type: Literal["checkboxes"] - selected_options: List[Option] + selected_options: list[Option] class DatepickerAction(BaseAction): @@ -256,27 +255,27 @@ class ExternalSelectAction(BaseAction): class MultiStaticSelectAction(BaseAction): type: Literal["multi_static_select"] - selected_options: List[Option] + selected_options: list[Option] class MultiChannelSelectAction(BaseAction): type: Literal["multi_channels_select"] - selected_channels: List[str] + selected_channels: list[str] class MultiConversationSelectAction(BaseAction): type: Literal["multi_conversations_select"] - selected_conversations: List[str] + selected_conversations: list[str] class MultiUserSelectAction(BaseAction): type: Literal["multi_users_select"] - selected_users: List[str] + selected_users: list[str] class MultiExternalSelectAction(BaseAction): type: Literal["multi_external_select"] - selected_options: List[str] + selected_options: list[str] class TimepickerAction(BaseAction): @@ -348,14 +347,14 @@ class Message(BaseModel): app_id: str text: str team: str - blocks: List[Block] + blocks: list[Block] class View(BaseModel): id: str team_id: str type: Literal["modal", "home"] - blocks: List[Block] + blocks: list[Block] private_metadata: str callback_id: str state: State @@ -395,7 +394,7 @@ class BlockActionsPayload(TypedModel): view: Optional[View] = None state: Optional[State] = None response_url: Optional[str] = None - actions: List[Action] + actions: list[Action] @model_validator(mode="after") def validate_view_or_message(self) -> BlockActionsPayload: @@ -420,7 +419,7 @@ class ViewSubmissionPayload(TypedModel): api_app_id: str token: str trigger_id: str - response_urls: List[ResponseUrlForView] + response_urls: list[ResponseUrlForView] is_enterprise_install: bool diff --git a/machine/plugins/base.py b/machine/plugins/base.py index d46bea38..e338545e 100644 --- a/machine/plugins/base.py +++ b/machine/plugins/base.py @@ -1,7 +1,8 @@ from __future__ import annotations +from collections.abc import Sequence from datetime import datetime -from typing import Any, Sequence +from typing import Any from slack_sdk.models.attachments import Attachment from slack_sdk.models.blocks import Block diff --git a/machine/plugins/block_action.py b/machine/plugins/block_action.py index eab4bdec..680e8a1d 100644 --- a/machine/plugins/block_action.py +++ b/machine/plugins/block_action.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import Any, Optional, Sequence, Union +from collections.abc import Sequence +from typing import Any, Optional, Union from slack_sdk.models.attachments import Attachment from slack_sdk.models.blocks import Block diff --git a/machine/plugins/command.py b/machine/plugins/command.py index 55be366b..4e426f10 100644 --- a/machine/plugins/command.py +++ b/machine/plugins/command.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import Any, Sequence +from collections.abc import Sequence +from typing import Any from slack_sdk.models.attachments import Attachment from slack_sdk.models.blocks import Block diff --git a/machine/plugins/decorators.py b/machine/plugins/decorators.py index 4545fc42..b8a07efa 100644 --- a/machine/plugins/decorators.py +++ b/machine/plugins/decorators.py @@ -2,8 +2,9 @@ import inspect import re +from collections.abc import Awaitable from datetime import datetime, tzinfo -from typing import Any, Awaitable, Callable, Protocol, TypeVar, Union, cast +from typing import Any, Callable, Protocol, TypeVar, Union, cast from structlog.stdlib import get_logger from typing_extensions import ParamSpec diff --git a/machine/plugins/message.py b/machine/plugins/message.py index c1159b6f..0f03cebb 100644 --- a/machine/plugins/message.py +++ b/machine/plugins/message.py @@ -1,7 +1,8 @@ from __future__ import annotations +from collections.abc import Sequence from datetime import datetime -from typing import Any, Sequence, cast +from typing import Any, cast from slack_sdk.models.attachments import Attachment from slack_sdk.models.blocks import Block diff --git a/machine/plugins/modals.py b/machine/plugins/modals.py index 4985a098..8b88d33c 100644 --- a/machine/plugins/modals.py +++ b/machine/plugins/modals.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import Any, Sequence +from collections.abc import Sequence +from typing import Any from slack_sdk.models.attachments import Attachment from slack_sdk.models.blocks import Block diff --git a/machine/settings.py b/machine/settings.py index efd6fcb3..8082a185 100644 --- a/machine/settings.py +++ b/machine/settings.py @@ -1,6 +1,5 @@ import os from importlib import import_module -from typing import Tuple from structlog.stdlib import get_logger @@ -9,7 +8,7 @@ logger = get_logger(__name__) -def import_settings(settings_module: str = "local_settings") -> Tuple[CaseInsensitiveDict, bool]: +def import_settings(settings_module: str = "local_settings") -> tuple[CaseInsensitiveDict, bool]: default_settings = { "PLUGINS": [ "machine.plugins.builtin.general.PingPongPlugin", diff --git a/machine/storage/backends/base.py b/machine/storage/backends/base.py index 466f6dd2..4ff72ecc 100644 --- a/machine/storage/backends/base.py +++ b/machine/storage/backends/base.py @@ -1,7 +1,8 @@ from __future__ import annotations from abc import ABC, abstractmethod -from typing import Any, Mapping +from collections.abc import Mapping +from typing import Any class MachineBaseStorage(ABC): diff --git a/machine/storage/backends/dynamodb.py b/machine/storage/backends/dynamodb.py index 3fb3e05a..7b135519 100644 --- a/machine/storage/backends/dynamodb.py +++ b/machine/storage/backends/dynamodb.py @@ -4,8 +4,9 @@ import calendar import datetime import typing +from collections.abc import Mapping from contextlib import AsyncExitStack -from typing import Any, Mapping, cast +from typing import Any, cast import aioboto3 from botocore.exceptions import ClientError diff --git a/machine/storage/backends/memory.py b/machine/storage/backends/memory.py index 0ef3ae45..ee208ea0 100644 --- a/machine/storage/backends/memory.py +++ b/machine/storage/backends/memory.py @@ -1,8 +1,9 @@ from __future__ import annotations import sys +from collections.abc import Mapping from datetime import datetime, timedelta -from typing import Any, Mapping +from typing import Any from machine.storage.backends.base import MachineBaseStorage diff --git a/machine/storage/backends/redis.py b/machine/storage/backends/redis.py index b0634917..9da44fc6 100644 --- a/machine/storage/backends/redis.py +++ b/machine/storage/backends/redis.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import Any, Mapping +from collections.abc import Mapping +from typing import Any from redis.asyncio import Redis diff --git a/machine/storage/backends/sqlite.py b/machine/storage/backends/sqlite.py index 5f95c82a..3b0fa685 100644 --- a/machine/storage/backends/sqlite.py +++ b/machine/storage/backends/sqlite.py @@ -1,7 +1,8 @@ from __future__ import annotations import time -from typing import Any, Mapping +from collections.abc import Mapping +from typing import Any import aiosqlite diff --git a/machine/utils/collections.py b/machine/utils/collections.py index 564886cf..40ca226c 100644 --- a/machine/utils/collections.py +++ b/machine/utils/collections.py @@ -1,6 +1,7 @@ from __future__ import annotations -from typing import Iterable, Iterator, Mapping, MutableMapping, TypeVar, cast +from collections.abc import Iterable, Iterator, Mapping, MutableMapping +from typing import TypeVar, cast KT = TypeVar("KT", bound=str) VT = TypeVar("VT") diff --git a/machine/utils/logging.py b/machine/utils/logging.py index 64b02343..609e31e1 100644 --- a/machine/utils/logging.py +++ b/machine/utils/logging.py @@ -2,7 +2,8 @@ import logging import sys -from typing import Any, Mapping +from collections.abc import Mapping +from typing import Any import structlog from structlog.processors import CallsiteParameter diff --git a/machine/utils/module_loading.py b/machine/utils/module_loading.py index 8adcff46..c84aa893 100644 --- a/machine/utils/module_loading.py +++ b/machine/utils/module_loading.py @@ -1,9 +1,8 @@ import inspect from importlib import import_module -from typing import List, Tuple, Type -def import_string(dotted_path: str) -> List[Tuple[str, Type]]: +def import_string(dotted_path: str) -> list[tuple[str, type]]: """ Import all Classes from the module specified by the dotted_path. If dotted_path is not a module, try diff --git a/machine/utils/redis.py b/machine/utils/redis.py index 79dc34d3..7d11449d 100644 --- a/machine/utils/redis.py +++ b/machine/utils/redis.py @@ -1,4 +1,5 @@ -from typing import Any, Mapping +from collections.abc import Mapping +from typing import Any from urllib.parse import urlparse diff --git a/poetry.lock b/poetry.lock index d0d470ef..53cee4ac 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2359,29 +2359,29 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "ruff" -version = "0.7.4" +version = "0.8.0" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.7.4-py3-none-linux_armv6l.whl", hash = "sha256:a4919925e7684a3f18e18243cd6bea7cfb8e968a6eaa8437971f681b7ec51478"}, - {file = "ruff-0.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfb365c135b830778dda8c04fb7d4280ed0b984e1aec27f574445231e20d6c63"}, - {file = "ruff-0.7.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:63a569b36bc66fbadec5beaa539dd81e0527cb258b94e29e0531ce41bacc1f20"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d06218747d361d06fd2fdac734e7fa92df36df93035db3dc2ad7aa9852cb109"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e0cea28d0944f74ebc33e9f934238f15c758841f9f5edd180b5315c203293452"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:80094ecd4793c68b2571b128f91754d60f692d64bc0d7272ec9197fdd09bf9ea"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:997512325c6620d1c4c2b15db49ef59543ef9cd0f4aa8065ec2ae5103cedc7e7"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00b4cf3a6b5fad6d1a66e7574d78956bbd09abfd6c8a997798f01f5da3d46a05"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7dbdc7d8274e1422722933d1edddfdc65b4336abf0b16dfcb9dedd6e6a517d06"}, - {file = "ruff-0.7.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e92dfb5f00eaedb1501b2f906ccabfd67b2355bdf117fea9719fc99ac2145bc"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3bd726099f277d735dc38900b6a8d6cf070f80828877941983a57bca1cd92172"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2e32829c429dd081ee5ba39aef436603e5b22335c3d3fff013cd585806a6486a"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:662a63b4971807623f6f90c1fb664613f67cc182dc4d991471c23c541fee62dd"}, - {file = "ruff-0.7.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:876f5e09eaae3eb76814c1d3b68879891d6fde4824c015d48e7a7da4cf066a3a"}, - {file = "ruff-0.7.4-py3-none-win32.whl", hash = "sha256:75c53f54904be42dd52a548728a5b572344b50d9b2873d13a3f8c5e3b91f5cac"}, - {file = "ruff-0.7.4-py3-none-win_amd64.whl", hash = "sha256:745775c7b39f914238ed1f1b0bebed0b9155a17cd8bc0b08d3c87e4703b990d6"}, - {file = "ruff-0.7.4-py3-none-win_arm64.whl", hash = "sha256:11bff065102c3ae9d3ea4dc9ecdfe5a5171349cdd0787c1fc64761212fc9cf1f"}, - {file = "ruff-0.7.4.tar.gz", hash = "sha256:cd12e35031f5af6b9b93715d8c4f40360070b2041f81273d0527683d5708fce2"}, + {file = "ruff-0.8.0-py3-none-linux_armv6l.whl", hash = "sha256:fcb1bf2cc6706adae9d79c8d86478677e3bbd4ced796ccad106fd4776d395fea"}, + {file = "ruff-0.8.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:295bb4c02d58ff2ef4378a1870c20af30723013f441c9d1637a008baaf928c8b"}, + {file = "ruff-0.8.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7b1f1c76b47c18fa92ee78b60d2d20d7e866c55ee603e7d19c1e991fad933a9a"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eb0d4f250a7711b67ad513fde67e8870109e5ce590a801c3722580fe98c33a99"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e55cce9aa93c5d0d4e3937e47b169035c7e91c8655b0974e61bb79cf398d49c"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f4cd64916d8e732ce6b87f3f5296a8942d285bbbc161acee7fe561134af64f9"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c5c1466be2a2ebdf7c5450dd5d980cc87c8ba6976fb82582fea18823da6fa362"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2dabfd05b96b7b8f2da00d53c514eea842bff83e41e1cceb08ae1966254a51df"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:facebdfe5a5af6b1588a1d26d170635ead6892d0e314477e80256ef4a8470cf3"}, + {file = "ruff-0.8.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87a8e86bae0dbd749c815211ca11e3a7bd559b9710746c559ed63106d382bd9c"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:85e654f0ded7befe2d61eeaf3d3b1e4ef3894469cd664ffa85006c7720f1e4a2"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:83a55679c4cb449fa527b8497cadf54f076603cc36779b2170b24f704171ce70"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:812e2052121634cf13cd6fddf0c1871d0ead1aad40a1a258753c04c18bb71bbd"}, + {file = "ruff-0.8.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:780d5d8523c04202184405e60c98d7595bdb498c3c6abba3b6d4cdf2ca2af426"}, + {file = "ruff-0.8.0-py3-none-win32.whl", hash = "sha256:5fdb6efecc3eb60bba5819679466471fd7d13c53487df7248d6e27146e985468"}, + {file = "ruff-0.8.0-py3-none-win_amd64.whl", hash = "sha256:582891c57b96228d146725975fbb942e1f30a0c4ba19722e692ca3eb25cc9b4f"}, + {file = "ruff-0.8.0-py3-none-win_arm64.whl", hash = "sha256:ba93e6294e9a737cd726b74b09a6972e36bb511f9a102f1d9a7e1ce94dd206a6"}, + {file = "ruff-0.8.0.tar.gz", hash = "sha256:a7ccfe6331bf8c8dad715753e157457faf7351c2b69f62f32c165c2dbcbacd44"}, ] [[package]] @@ -3426,4 +3426,4 @@ sqlite = ["aiosqlite"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "e2db14016c676808832b37056ffe1f96fe66d0f2fc6c5f358d4163b5d9ece7c6" +content-hash = "347abcd547496740cfd26a6c7ed6bd181b341f2d24d943100efdf60fcd552472" diff --git a/pyproject.toml b/pyproject.toml index 4361b3c3..a8b98f77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ types-redis = "^4.3.21" aioboto3 = ">=10,<14" types-aiobotocore = {extras = ["essential"], version = "^2.4.0"} aiosqlite = ">=0.18,<0.21" -ruff = ">=0.4.3,<0.8.0" +ruff = ">=0.8.0,<0.9.0" [tool.poetry.group.docs] optional = true @@ -88,6 +88,7 @@ slack-machine = 'machine.bin.run:main' [tool.ruff] line-length = 120 +target-version = "py39" [tool.ruff.lint] exclude = [ diff --git a/tests/clients/test_slack_client.py b/tests/clients/test_slack_client.py index 03f3cf30..8353f1aa 100644 --- a/tests/clients/test_slack_client.py +++ b/tests/clients/test_slack_client.py @@ -1,12 +1,12 @@ from __future__ import annotations from typing import Any +from zoneinfo import ZoneInfo import pytest from slack_sdk.socket_mode.aiohttp import SocketModeClient from slack_sdk.socket_mode.request import SocketModeRequest from slack_sdk.web.async_client import AsyncWebClient -from zoneinfo import ZoneInfo from machine.clients.slack import SlackClient, id_for_channel, id_for_user from machine.models.channel import Channel diff --git a/tests/utils/test_datetime.py b/tests/utils/test_datetime.py index 133426b1..a420ea9a 100644 --- a/tests/utils/test_datetime.py +++ b/tests/utils/test_datetime.py @@ -1,10 +1,6 @@ -import sys from datetime import datetime +from zoneinfo import ZoneInfo -if sys.version_info >= (3, 9): - from zoneinfo import ZoneInfo -else: - from backports.zoneinfo import ZoneInfo from machine.utils.datetime import calculate_epoch