From 3bc6a7df595c771e3ea4b99b7df56181de396171 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Mon, 25 Nov 2024 13:10:35 -0800 Subject: [PATCH] Update pre-commit dependencies Update pre-commit dependencies, apply fixes from Ruff 0.8.0, and adjust the shared Ruff configuration file for some renamings of diagnostic codes. Add a positional-only parameter separator in one place detected by Ruff. --- .pre-commit-config.yaml | 4 ++-- ruff-shared.toml | 6 ++--- safir-arq/src/safir/arq/__init__.py | 12 +++++----- safir-arq/src/safir/arq/_exceptions.py | 2 +- safir-arq/src/safir/arq/_queue.py | 2 +- safir-arq/src/safir/arq/uws.py | 4 ++-- safir-logging/src/safir/logging/__init__.py | 2 +- safir/src/safir/database/__init__.py | 2 +- safir/src/safir/database/_pagination.py | 2 +- safir/src/safir/database/_retry.py | 4 ++-- safir/src/safir/dependencies/metrics.py | 2 +- safir/src/safir/github/models.py | 26 ++++++++++----------- safir/src/safir/github/webhooks.py | 14 +++++------ safir/src/safir/kafka/__init__.py | 10 ++++---- safir/src/safir/kafka/_manager.py | 2 +- safir/src/safir/metrics/__init__.py | 2 +- safir/src/safir/metrics/_exceptions.py | 2 +- safir/src/safir/redis/_storage.py | 4 ++-- safir/src/safir/uws/__init__.py | 2 +- safir/src/safir/uws/_constants.py | 2 +- safir/src/safir/uws/_exceptions.py | 2 +- 21 files changed, 54 insertions(+), 54 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bf64ecf8..86804527 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,14 +8,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.8.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/asottile/blacken-docs - rev: 1.19.0 + rev: 1.19.1 hooks: - id: blacken-docs additional_dependencies: [black==24.4.2] diff --git a/ruff-shared.toml b/ruff-shared.toml index 0702eaf1..6450f603 100644 --- a/ruff-shared.toml +++ b/ruff-shared.toml @@ -58,9 +58,9 @@ ignore = [ "S607", # using PATH is not a security vulnerability "SIM102", # sometimes the formatting of nested if statements is clearer "SIM117", # sometimes nested with contexts are clearer - "TCH001", # we decided to not maintain separate TYPE_CHECKING blocks - "TCH002", # we decided to not maintain separate TYPE_CHECKING blocks - "TCH003", # we decided to not maintain separate TYPE_CHECKING blocks + "TC001", # we decided to not maintain separate TYPE_CHECKING blocks + "TC002", # we decided to not maintain separate TYPE_CHECKING blocks + "TC003", # we decided to not maintain separate TYPE_CHECKING blocks "TD003", # we don't require issues be created for TODOs "TID252", # if we're going to use relative imports, use them always "TRY003", # good general advice but lint is way too aggressive diff --git a/safir-arq/src/safir/arq/__init__.py b/safir-arq/src/safir/arq/__init__.py index 75564737..d394d51c 100644 --- a/safir-arq/src/safir/arq/__init__.py +++ b/safir-arq/src/safir/arq/__init__.py @@ -12,15 +12,15 @@ __all__ = [ "ArqJobError", - "JobNotQueued", - "JobNotFound", - "JobResultUnavailable", "ArqMode", + "ArqQueue", "JobMetadata", + "JobNotFound", + "JobNotQueued", "JobResult", - "ArqQueue", - "RedisArqQueue", + "JobResultUnavailable", "MockArqQueue", - "build_arq_redis_settings", + "RedisArqQueue", "WorkerSettings", + "build_arq_redis_settings", ] diff --git a/safir-arq/src/safir/arq/_exceptions.py b/safir-arq/src/safir/arq/_exceptions.py index c792ea74..4c690d20 100644 --- a/safir-arq/src/safir/arq/_exceptions.py +++ b/safir-arq/src/safir/arq/_exceptions.py @@ -4,8 +4,8 @@ __all__ = [ "ArqJobError", - "JobNotQueued", "JobNotFound", + "JobNotQueued", "JobResultUnavailable", ] diff --git a/safir-arq/src/safir/arq/_queue.py b/safir-arq/src/safir/arq/_queue.py index 246ff589..bdac4fa1 100644 --- a/safir-arq/src/safir/arq/_queue.py +++ b/safir-arq/src/safir/arq/_queue.py @@ -18,8 +18,8 @@ __all__ = [ "ArqQueue", - "RedisArqQueue", "MockArqQueue", + "RedisArqQueue", ] diff --git a/safir-arq/src/safir/arq/uws.py b/safir-arq/src/safir/arq/uws.py index b476a874..daf59443 100644 --- a/safir-arq/src/safir/arq/uws.py +++ b/safir-arq/src/safir/arq/uws.py @@ -29,6 +29,8 @@ """Name of the arq queue for internal UWS messages.""" __all__ = [ + "UWS_QUEUE_NAME", + "T", "WorkerConfig", "WorkerError", "WorkerErrorType", @@ -38,8 +40,6 @@ "WorkerTimeoutError", "WorkerTransientError", "WorkerUsageError", - "T", - "UWS_QUEUE_NAME", "build_worker", ] diff --git a/safir-logging/src/safir/logging/__init__.py b/safir-logging/src/safir/logging/__init__.py index 91fb0baa..a9c9fbbd 100644 --- a/safir-logging/src/safir/logging/__init__.py +++ b/safir-logging/src/safir/logging/__init__.py @@ -9,7 +9,7 @@ "LogLevel", "Profile", "add_log_severity", - "configure_logging", "configure_alembic_logging", + "configure_logging", "configure_uvicorn_logging", ] diff --git a/safir/src/safir/database/__init__.py b/safir/src/safir/database/__init__.py index 7a95b7f6..3262b510 100644 --- a/safir/src/safir/database/__init__.py +++ b/safir/src/safir/database/__init__.py @@ -29,10 +29,10 @@ "AlembicConfigError", "DatabaseInitializationError", "DatetimeIdCursor", - "PaginationCursor", "PaginatedLinkData", "PaginatedList", "PaginatedQueryRunner", + "PaginationCursor", "create_async_session", "create_database_engine", "datetime_from_db", diff --git a/safir/src/safir/database/_pagination.py b/safir/src/safir/database/_pagination.py index 687b6880..c86a9e8d 100644 --- a/safir/src/safir/database/_pagination.py +++ b/safir/src/safir/database/_pagination.py @@ -32,10 +32,10 @@ __all__ = [ "DatetimeIdCursor", - "PaginationCursor", "PaginatedLinkData", "PaginatedList", "PaginatedQueryRunner", + "PaginationCursor", ] diff --git a/safir/src/safir/database/_retry.py b/safir/src/safir/database/_retry.py index c0472d64..c0a4e58e 100644 --- a/safir/src/safir/database/_retry.py +++ b/safir/src/safir/database/_retry.py @@ -28,7 +28,7 @@ @overload -def retry_async_transaction(__func: RetryF) -> RetryF: ... +def retry_async_transaction(__func: RetryF, /) -> RetryF: ... @overload @@ -38,7 +38,7 @@ def retry_async_transaction( def retry_async_transaction( - __func: RetryF | None = None, *, delay: float = 0.5, max_tries: int = 3 + __func: RetryF | None = None, /, *, delay: float = 0.5, max_tries: int = 3 ) -> RetryF | Callable[[RetryF], RetryF]: """Retry if a transaction failed. diff --git a/safir/src/safir/dependencies/metrics.py b/safir/src/safir/dependencies/metrics.py index 4628a5dd..dad41652 100644 --- a/safir/src/safir/dependencies/metrics.py +++ b/safir/src/safir/dependencies/metrics.py @@ -7,7 +7,7 @@ from safir.metrics import EventManager -__all__ = ["EventDependency", "EventMaker", "E"] +__all__ = ["E", "EventDependency", "EventMaker"] E = TypeVar("E", bound="EventMaker") """Generic event maker type.""" diff --git a/safir/src/safir/github/models.py b/safir/src/safir/github/models.py index e2098b22..54a43014 100644 --- a/safir/src/safir/github/models.py +++ b/safir/src/safir/github/models.py @@ -8,24 +8,24 @@ from pydantic import BaseModel, Field, HttpUrl __all__ = [ - "GitHubRepoOwnerModel", - "GitHubUserModel", - "GitHubRepositoryModel", - "GitHubPullState", - "GitHubPullRequestModel", + "GitHubBlobModel", "GitHubBranchCommitModel", "GitHubBranchModel", - "GitHubBlobModel", - "GitHubCheckSuiteStatus", - "GitHubCheckSuiteConclusion", - "GitHubCheckSuiteModel", - "GitHubCheckRunStatus", - "GitHubCheckRunConclusion", "GitHubCheckRunAnnotationLevel", - "GitHubCheckSuiteId", + "GitHubCheckRunConclusion", + "GitHubCheckRunModel", "GitHubCheckRunOutput", "GitHubCheckRunPrInfoModel", - "GitHubCheckRunModel", + "GitHubCheckRunStatus", + "GitHubCheckSuiteConclusion", + "GitHubCheckSuiteId", + "GitHubCheckSuiteModel", + "GitHubCheckSuiteStatus", + "GitHubPullRequestModel", + "GitHubPullState", + "GitHubRepoOwnerModel", + "GitHubRepositoryModel", + "GitHubUserModel", ] diff --git a/safir/src/safir/github/webhooks.py b/safir/src/safir/github/webhooks.py index d17c77cf..261892e5 100644 --- a/safir/src/safir/github/webhooks.py +++ b/safir/src/safir/github/webhooks.py @@ -14,19 +14,19 @@ ) __all__ = [ - "GitHubAppInstallationModel", - "GitHubPushEventModel", - "GitHubAppInstallationEventRepoModel", "GitHubAppInstallationEventAction", "GitHubAppInstallationEventModel", + "GitHubAppInstallationEventRepoModel", + "GitHubAppInstallationModel", "GitHubAppInstallationRepositoriesEventAction", "GitHubAppInstallationRepositoriesEventModel", - "GitHubPullRequestEventAction", - "GitHubPullRequestEventModel", - "GitHubCheckSuiteEventAction", - "GitHubCheckSuiteEventModel", "GitHubCheckRunEventAction", "GitHubCheckRunEventModel", + "GitHubCheckSuiteEventAction", + "GitHubCheckSuiteEventModel", + "GitHubPullRequestEventAction", + "GitHubPullRequestEventModel", + "GitHubPushEventModel", ] diff --git a/safir/src/safir/kafka/__init__.py b/safir/src/safir/kafka/__init__.py index 093bd84b..a3eebb28 100644 --- a/safir/src/safir/kafka/__init__.py +++ b/safir/src/safir/kafka/__init__.py @@ -24,6 +24,7 @@ __all__ = [ "AIOKafkaParams", + "Compatibility", "FastStreamBrokerParams", "IncompatibleSchemaError", "InvalidAvroNameError", @@ -31,19 +32,18 @@ "KafkaConnectionSettings", "PlaintextSettings", "PlaintextSettings", + "PydanticSchemaManager", "SaslMechanism", "SaslPlaintextSettings", "SaslSslSettings", - "SecurityProtocol", - "SslSettings", - "SslSettings", - "PydanticSchemaManager", "SchemaInfo", "SchemaManagerSettings", "SchemaManagerSettings", "SchemaRegistryClientParams", "SchemaRegistryClientParams", - "Compatibility", + "SecurityProtocol", + "SslSettings", + "SslSettings", "UnknownDeserializeError", "UnknownSchemaError", ] diff --git a/safir/src/safir/kafka/_manager.py b/safir/src/safir/kafka/_manager.py index 98a8c09a..46927ad6 100644 --- a/safir/src/safir/kafka/_manager.py +++ b/safir/src/safir/kafka/_manager.py @@ -29,9 +29,9 @@ ) __all__ = [ + "Compatibility", "PydanticSchemaManager", "SchemaInfo", - "Compatibility", ] P = TypeVar("P", bound=AvroBaseModel) diff --git a/safir/src/safir/metrics/__init__.py b/safir/src/safir/metrics/__init__.py index fc7a369c..fe690b15 100644 --- a/safir/src/safir/metrics/__init__.py +++ b/safir/src/safir/metrics/__init__.py @@ -25,12 +25,12 @@ "BaseMetricsConfiguration", "DisabledMetricsConfiguration", "DuplicateEventError", - "EventsConfiguration", "EventManager", "EventManagerUnintializedError", "EventMetadata", "EventPayload", "EventPublisher", + "EventsConfiguration", "KafkaEventManager", "KafkaEventPublisher", "KafkaMetricsConfiguration", diff --git a/safir/src/safir/metrics/_exceptions.py b/safir/src/safir/metrics/_exceptions.py index 60281b24..33475987 100644 --- a/safir/src/safir/metrics/_exceptions.py +++ b/safir/src/safir/metrics/_exceptions.py @@ -1,8 +1,8 @@ """Metrics exceptions.""" __all__ = [ - "EventManagerUnintializedError", "DuplicateEventError", + "EventManagerUnintializedError", "KafkaTopicError", ] diff --git a/safir/src/safir/redis/_storage.py b/safir/src/safir/redis/_storage.py index 51399c5a..c2637f3d 100644 --- a/safir/src/safir/redis/_storage.py +++ b/safir/src/safir/redis/_storage.py @@ -23,9 +23,9 @@ ) __all__ = [ - "PydanticRedisStorage", - "EncryptedPydanticRedisStorage", "DeserializeError", + "EncryptedPydanticRedisStorage", + "PydanticRedisStorage", ] diff --git a/safir/src/safir/uws/__init__.py b/safir/src/safir/uws/__init__.py index dc7026f3..2c1601b9 100644 --- a/safir/src/safir/uws/__init__.py +++ b/safir/src/safir/uws/__init__.py @@ -27,8 +27,8 @@ "ParameterError", "ParameterParseError", "ParametersModel", - "UWSApplication", "UWSAppSettings", + "UWSApplication", "UWSConfig", "UWSError", "UWSJob", diff --git a/safir/src/safir/uws/_constants.py b/safir/src/safir/uws/_constants.py index 89ed8306..bd1e67f7 100644 --- a/safir/src/safir/uws/_constants.py +++ b/safir/src/safir/uws/_constants.py @@ -7,8 +7,8 @@ from arq.cron import Options __all__ = [ - "JOB_STOP_TIMEOUT", "JOB_RESULT_TIMEOUT", + "JOB_STOP_TIMEOUT", "UWS_DATABASE_TIMEOUT", "UWS_EXPIRE_JOBS_SCHEDULE", ] diff --git a/safir/src/safir/uws/_exceptions.py b/safir/src/safir/uws/_exceptions.py index 50397220..53c85081 100644 --- a/safir/src/safir/uws/_exceptions.py +++ b/safir/src/safir/uws/_exceptions.py @@ -32,9 +32,9 @@ "SyncJobNoResultsError", "SyncJobTimeoutError", "TaskError", + "UWSError", "UnknownJobError", "UsageError", - "UWSError", ]