Skip to content

Commit

Permalink
fix(isort): run ruff check --select I001 --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stegayet committed Jan 27, 2025
1 parent 06b6ab8 commit a2cc6ad
Show file tree
Hide file tree
Showing 30 changed files with 179 additions and 84 deletions.
7 changes: 5 additions & 2 deletions examples/delayed_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
from examples.experimental.async_consume import queue
from kombu import Connection, Exchange, Queue
from kombu.transport.native_delayed_delivery import (
bind_queue_to_native_delayed_delivery_exchange, calculate_routing_key,
declare_native_delayed_delivery_exchanges_and_queues, level_name)
bind_queue_to_native_delayed_delivery_exchange,
calculate_routing_key,
declare_native_delayed_delivery_exchanges_and_queues,
level_name,
)

with Connection('amqp://guest:guest@localhost:5672//') as connection:
declare_native_delayed_delivery_exchanges_and_queues(connection, 'quorum')
Expand Down
9 changes: 7 additions & 2 deletions kombu/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
from contextlib import contextmanager
from io import BytesIO

from .exceptions import (ContentDisallowed, DecodeError, EncodeError,
SerializerNotInstalled, reraise)
from .exceptions import (
ContentDisallowed,
DecodeError,
EncodeError,
SerializerNotInstalled,
reraise,
)
from .utils.compat import entrypoints
from .utils.encoding import bytes_to_str, str_to_bytes

Expand Down
13 changes: 8 additions & 5 deletions kombu/transport/azureservicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@
import azure.core.exceptions
import azure.servicebus.exceptions
import isodate
from azure.servicebus import (ServiceBusClient, ServiceBusMessage,
ServiceBusReceiveMode, ServiceBusReceiver,
ServiceBusSender)
from azure.servicebus import (
ServiceBusClient,
ServiceBusMessage,
ServiceBusReceiveMode,
ServiceBusReceiver,
ServiceBusSender,
)
from azure.servicebus.management import ServiceBusAdministrationClient

try:
from azure.identity import (DefaultAzureCredential,
ManagedIdentityCredential)
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
except ImportError:
DefaultAzureCredential = None
ManagedIdentityCredential = None
Expand Down
3 changes: 1 addition & 2 deletions kombu/transport/azurestoragequeues.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
QueueServiceClient = None

try:
from azure.identity import (DefaultAzureCredential,
ManagedIdentityCredential)
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
except ImportError:
DefaultAzureCredential = None
ManagedIdentityCredential = None
Expand Down
3 changes: 1 addition & 2 deletions kombu/transport/confluentkafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@

try:
import confluent_kafka
from confluent_kafka import (Consumer, KafkaException, Producer,
TopicPartition)
from confluent_kafka import Consumer, KafkaException, Producer, TopicPartition

Check warning on line 72 in kombu/transport/confluentkafka.py

View check run for this annotation

Codecov / codecov/patch

kombu/transport/confluentkafka.py#L72

Added line #L72 was not covered by tests
from confluent_kafka.admin import AdminClient, NewTopic

KAFKA_CONNECTION_ERRORS = ()
Expand Down
13 changes: 5 additions & 8 deletions kombu/transport/gcpubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,24 @@
import datetime
import string
import threading
from concurrent.futures import (FIRST_COMPLETED, Future, ThreadPoolExecutor,
wait)
from _socket import gethostname
from _socket import timeout as socket_timeout
from concurrent.futures import FIRST_COMPLETED, Future, ThreadPoolExecutor, wait
from contextlib import suppress
from os import getpid
from queue import Empty
from threading import Lock
from time import monotonic, sleep
from uuid import NAMESPACE_OID, uuid3

from _socket import gethostname
from _socket import timeout as socket_timeout
from google.api_core.exceptions import (AlreadyExists, DeadlineExceeded,
PermissionDenied)
from google.api_core.exceptions import AlreadyExists, DeadlineExceeded, PermissionDenied
from google.api_core.retry import Retry
from google.cloud import monitoring_v3
from google.cloud.monitoring_v3 import query
from google.cloud.pubsub_v1 import PublisherClient, SubscriberClient
from google.cloud.pubsub_v1 import exceptions as pubsub_exceptions
from google.cloud.pubsub_v1.publisher import exceptions as publisher_exceptions
from google.cloud.pubsub_v1.subscriber import \
exceptions as subscriber_exceptions
from google.cloud.pubsub_v1.subscriber import exceptions as subscriber_exceptions
from google.pubsub_v1 import gapic_version as package_version

from kombu.entity import TRANSIENT_DELIVERY_MODE
Expand Down
3 changes: 1 addition & 2 deletions kombu/transport/qpid.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@
qpidtoollibs = None

try:
from qpid.messaging.exceptions import ConnectionError
from qpid.messaging.exceptions import ConnectionError, NotFound, SessionClosed
from qpid.messaging.exceptions import Empty as QpidEmpty
from qpid.messaging.exceptions import NotFound, SessionClosed
except ImportError: # pragma: no cover
ConnectionError = None
NotFound = None
Expand Down
14 changes: 12 additions & 2 deletions kombu/transport/sqlalchemy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@

import datetime

from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Index, Integer,
Sequence, SmallInteger, String, Text)
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Index,
Integer,
Sequence,
SmallInteger,
String,
Text,
)
from sqlalchemy.orm import relationship
from sqlalchemy.schema import MetaData

Expand Down
18 changes: 15 additions & 3 deletions kombu/transport/virtual/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
from __future__ import annotations

from .base import (AbstractChannel, Base64, BrokerState, Channel, Empty,
Management, Message, NotEquivalentError, QoS, Transport,
UndeliverableWarning, binding_key_t, queue_binding_t)
from .base import (
AbstractChannel,
Base64,
BrokerState,
Channel,
Empty,
Management,
Message,
NotEquivalentError,
QoS,
Transport,
UndeliverableWarning,
binding_key_t,
queue_binding_t,
)

__all__ = (
'Base64', 'NotEquivalentError', 'UndeliverableWarning', 'BrokerState',
Expand Down
3 changes: 1 addition & 2 deletions kombu/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from .collections import EqualityDict
from .compat import fileno, maybe_fileno, nested, register_after_fork
from .div import emergency_dump_state
from .functional import (fxrange, fxrangemax, maybe_list, reprcall,
retry_over_time)
from .functional import fxrange, fxrangemax, maybe_list, reprcall, retry_over_time
from .imports import symbol_by_name
from .objects import cached_property
from .uuid import uuid
Expand Down
3 changes: 1 addition & 2 deletions t/integration/test_kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import kombu

from .common import (BaseExchangeTypes, BaseFailover, BaseMessage,
BasicFunctionality)
from .common import BaseExchangeTypes, BaseFailover, BaseMessage, BasicFunctionality


def get_connection(hostname, port):
Expand Down
3 changes: 1 addition & 2 deletions t/integration/test_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import kombu

from .common import (BaseExchangeTypes, BaseMessage, BasePriority,
BasicFunctionality)
from .common import BaseExchangeTypes, BaseMessage, BasePriority, BasicFunctionality


def get_connection(hostname, port, vhost):
Expand Down
10 changes: 8 additions & 2 deletions t/integration/test_py_amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
import kombu
from kombu.connection import ConnectionPool

from .common import (BaseExchangeTypes, BaseFailover, BaseMessage,
BasePriority, BaseTimeToLive, BasicFunctionality)
from .common import (
BaseExchangeTypes,
BaseFailover,
BaseMessage,
BasePriority,
BaseTimeToLive,
BasicFunctionality,
)


def get_connection(hostname, port, vhost):
Expand Down
3 changes: 1 addition & 2 deletions t/integration/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import kombu
from kombu.transport.redis import Transport

from .common import (BaseExchangeTypes, BaseMessage, BasePriority,
BasicFunctionality)
from .common import BaseExchangeTypes, BaseMessage, BasePriority, BasicFunctionality


def get_connection(
Expand Down
10 changes: 6 additions & 4 deletions t/unit/asynchronous/aws/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
from vine.abstract import Thenable

from kombu.asynchronous import http
from kombu.asynchronous.aws.connection import (AsyncAWSQueryConnection,
AsyncConnection,
AsyncHTTPResponse,
AsyncHTTPSConnection)
from kombu.asynchronous.aws.connection import (
AsyncAWSQueryConnection,
AsyncConnection,
AsyncHTTPResponse,
AsyncHTTPSConnection,
)
from kombu.asynchronous.aws.ext import boto3
from kombu.exceptions import HttpError
from t.mocks import PromiseMock
Expand Down
3 changes: 1 addition & 2 deletions t/unit/asynchronous/http/test_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import urllib3

import t.skip
from kombu.asynchronous.http.urllib3_client import (Urllib3Client,
_get_pool_key_parts)
from kombu.asynchronous.http.urllib3_client import Urllib3Client, _get_pool_key_parts


@t.skip.if_pypy
Expand Down
9 changes: 7 additions & 2 deletions t/unit/asynchronous/test_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
from kombu.asynchronous import ERR, READ, WRITE, Hub
from kombu.asynchronous import hub as _hub
from kombu.asynchronous.debug import _rcb, callback_for, repr_flag
from kombu.asynchronous.hub import (Stop, _dummy_context, _raise_stop_error,
get_event_loop, set_event_loop)
from kombu.asynchronous.hub import (
Stop,
_dummy_context,
_raise_stop_error,
get_event_loop,
set_event_loop,
)
from kombu.asynchronous.semaphore import DummyLock, LaxBoundedSemaphore


Expand Down
14 changes: 11 additions & 3 deletions t/unit/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
from amqp import RecoverableConnectionError

from kombu import common
from kombu.common import (PREFETCH_COUNT_MAX, Broadcast, QoS, collect_replies,
declaration_cached, generate_oid, ignore_errors,
maybe_declare, send_reply)
from kombu.common import (
PREFETCH_COUNT_MAX,
Broadcast,
QoS,
collect_replies,
declaration_cached,
generate_oid,
ignore_errors,
maybe_declare,
send_reply,
)
from t.mocks import ContextMock, MockPool

if TYPE_CHECKING:
Expand Down
10 changes: 8 additions & 2 deletions t/unit/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
import sys
from unittest.mock import ANY, Mock, patch

from kombu.log import (Log, LogMixin, get_logger, get_loglevel, safeify_format,
setup_logging)
from kombu.log import (
Log,
LogMixin,
get_logger,
get_loglevel,
safeify_format,
setup_logging,
)


class test_get_logger:
Expand Down
11 changes: 9 additions & 2 deletions t/unit/test_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

import pytest

from kombu.matcher import (MatcherNotInstalled, fnmatch, match, register,
registry, rematch, unregister)
from kombu.matcher import (
MatcherNotInstalled,
fnmatch,
match,
register,
registry,
rematch,
unregister,
)


class test_Matcher:
Expand Down
24 changes: 17 additions & 7 deletions t/unit/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@

import t.skip
from kombu.exceptions import ContentDisallowed, DecodeError, EncodeError
from kombu.serialization import (SerializerNotInstalled,
disable_insecure_serializers, dumps,
enable_insecure_serializers, loads, pickle,
pickle_protocol, prepare_accept_content,
raw_encode, register, register_msgpack,
register_pickle, register_yaml, registry,
unregister)
from kombu.serialization import (
SerializerNotInstalled,
disable_insecure_serializers,
dumps,
enable_insecure_serializers,
loads,
pickle,
pickle_protocol,
prepare_accept_content,
raw_encode,
register,
register_msgpack,
register_pickle,
register_yaml,
registry,
unregister,
)
from kombu.utils.encoding import str_to_bytes

# For content_encoding tests
Expand Down
3 changes: 1 addition & 2 deletions t/unit/transport/test_azureservicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from azure.servicebus import ServiceBusMessage, ServiceBusReceiveMode # noqa

try:
from azure.identity import (DefaultAzureCredential,
ManagedIdentityCredential)
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
except ImportError:
DefaultAzureCredential = None
ManagedIdentityCredential = None
Expand Down
8 changes: 6 additions & 2 deletions t/unit/transport/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@

from kombu import Connection, Consumer, Exchange, Producer, Queue
from kombu.message import Message
from kombu.transport.base import (Management, StdChannel, Transport,
to_rabbitmq_queue_arguments)
from kombu.transport.base import (
Management,
StdChannel,
Transport,
to_rabbitmq_queue_arguments,
)


@pytest.mark.parametrize('args,input,expected', [
Expand Down
Loading

0 comments on commit a2cc6ad

Please sign in to comment.