refactor: extract ConversionCancelled to conversion_ports

- Single definition in application layer
- Both adapters import from ports instead of defining locally
This commit is contained in:
Artem Akymenko
2026-07-22 11:06:14 +03:00
parent d0fe221176
commit df5705779e
3 changed files with 7 additions and 12 deletions
+5
View File
@@ -13,6 +13,11 @@ from dataclasses import dataclass
from typing import Any, List, Optional, Protocol, runtime_checkable
class ConversionCancelled(Exception):
"""Raised when conversion is cancelled by user."""
pass
class ConversionEvents(Protocol):
"""UI-specific actions the conversion service delegates back to the caller.
+1 -6
View File
@@ -18,7 +18,7 @@ from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
from abogen.application.conversion_request import ConversionRequest
from abogen.application.conversion_ports import ResolvedVoice
from abogen.application.conversion_ports import ConversionCancelled, ResolvedVoice
def build_conversion_request_from_thread(thread: Any) -> ConversionRequest:
@@ -135,11 +135,6 @@ class PyQtEvents:
raise ConversionCancelled("Conversion cancelled by user")
class ConversionCancelled(Exception):
"""Raised when conversion is cancelled."""
pass
class PyQtPipelineProvider:
"""PyQt implementation of PipelineProvider protocol.
+1 -6
View File
@@ -18,7 +18,7 @@ from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
from abogen.application.conversion_request import ConversionRequest
from abogen.application.conversion_ports import ResolvedVoice
from abogen.application.conversion_ports import ConversionCancelled, ResolvedVoice
def build_conversion_request_from_job(job: Any) -> ConversionRequest:
@@ -114,11 +114,6 @@ class WebJobEvents:
raise ConversionCancelled("Job cancelled by user")
class ConversionCancelled(Exception):
"""Raised when conversion is cancelled."""
pass
class WebPipelineProvider:
"""WebUI implementation of PipelineProvider protocol.