feat: add response type
This commit is contained in:
@@ -1,38 +1,5 @@
|
||||
import enum
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from typing import Iterator
|
||||
from ..common import DeviceKind, Circuit
|
||||
|
||||
|
||||
class ResultPriority(enum.Enum):
|
||||
"""
|
||||
The priority of the result.
|
||||
"""
|
||||
|
||||
LESS_DEVICES = enum.auto()
|
||||
"""Less devices is the first priority."""
|
||||
MORE_ACCURACY = enum.auto()
|
||||
"""More accuracy is the first priority."""
|
||||
|
||||
|
||||
@dataclass
|
||||
class ResolverRequest:
|
||||
"""
|
||||
All request infomation for the resolver.
|
||||
"""
|
||||
|
||||
device_kind: DeviceKind
|
||||
"""The kind of device to resolve."""
|
||||
target_value: float
|
||||
"""The target value of the device."""
|
||||
tolerance: float
|
||||
"""The tolerance of the device in absolute value."""
|
||||
result_priority: ResultPriority
|
||||
"""The priority of the result."""
|
||||
count_limit: int
|
||||
"""The limited count of results."""
|
||||
|
||||
from ..query import Request, Response
|
||||
|
||||
class Resolver(ABC):
|
||||
"""
|
||||
@@ -40,5 +7,5 @@ class Resolver(ABC):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def resolve(self, request: ResolverRequest) -> Iterator[Circuit]:
|
||||
def resolve(self, request: Request) -> Response:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user