Skip to content

Commit

Permalink
Fix: remove base options
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Dumchenko committed Jan 15, 2025
1 parent 74b182d commit e5c5391
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 27 deletions.
7 changes: 2 additions & 5 deletions faststream/rabbit/publisher/specified.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
)
from faststream.rabbit.schemas.proto import BaseRMQInformation as RMQSpecificationMixin
from faststream.rabbit.schemas.publishers import LogicOptions, SpecificationOptions
from faststream.rabbit.schemas.subscribers import BaseOptions
from faststream.rabbit.utils import is_routing_exchange
from faststream.specification.asyncapi.utils import resolve_payloads
from faststream.specification.schema import Message, Operation, PublisherSpec
Expand All @@ -29,13 +28,11 @@ def __init__(
logic_options: LogicOptions,
specification_options: SpecificationOptions,
) -> None:
base_options = BaseOptions(
queue=logic_options.queue, exchange=logic_options.exchange
)
super().__init__(
init_options=specification_options,
# propagate to RMQSpecificationMixin
base_init_options=base_options,
queue=logic_options.queue,
exchange=logic_options.exchange,
)

LogicPublisher.__init__(self, logic_options=logic_options)
Expand Down
8 changes: 3 additions & 5 deletions faststream/rabbit/schemas/proto.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import TYPE_CHECKING, Any, Optional

from faststream.rabbit.schemas.subscribers import BaseOptions

if TYPE_CHECKING:
from faststream.rabbit.schemas.exchange import RabbitExchange
from faststream.rabbit.schemas.queue import RabbitQueue
Expand All @@ -15,9 +13,9 @@ class BaseRMQInformation:
exchange: "RabbitExchange"
app_id: Optional[str]

def __init__(self, *, base_init_options: BaseOptions) -> None:
self.queue = base_init_options.queue
self.exchange = base_init_options.exchange
def __init__(self, *, queue: "RabbitQueue", exchange: "RabbitExchange") -> None:
self.queue = queue
self.exchange = exchange

# Setup it later
self.app_id = None
Expand Down
6 changes: 0 additions & 6 deletions faststream/rabbit/schemas/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,3 @@ class SpecificationOptions:
title_: Optional[str]
description_: Optional[str]
include_in_schema: bool


@dataclass
class BaseOptions:
queue: "RabbitQueue"
exchange: "RabbitExchange"
6 changes: 0 additions & 6 deletions faststream/rabbit/schemas/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@ class SpecificationOptions:
description_: Optional[str]
include_in_schema: bool
exchange: "RabbitExchange"


@dataclass
class BaseOptions:
queue: "RabbitQueue"
exchange: "RabbitExchange"
7 changes: 2 additions & 5 deletions faststream/rabbit/subscriber/specified.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
)
from faststream.rabbit.schemas.proto import BaseRMQInformation as RMQSpecificationMixin
from faststream.rabbit.schemas.subscribers import (
BaseOptions,
LogicOptions,
SpecificationOptions,
)
Expand Down Expand Up @@ -35,9 +34,6 @@ def __init__(
logic_options: LogicOptions,
specification_options: SpecificationOptions,
) -> None:
base_options = BaseOptions(
queue=specification_options.queue, exchange=specification_options.exchange
)
async_api_options = AsyncAPIOptions(
title_=specification_options.title_,
description_=specification_options.description_,
Expand All @@ -46,7 +42,8 @@ def __init__(
super().__init__(
async_api_options=async_api_options,
# propagate to RMQSpecificationMixin
base_init_options=base_options,
queue=specification_options.queue,
exchange=specification_options.exchange,
)

LogicSubscriber.__init__(self, init_options=logic_options)
Expand Down

0 comments on commit e5c5391

Please sign in to comment.