style: apply ruff auto-fixes
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Iterable, List, Optional, Sequence
|
||||
from typing import Dict, Iterable, List, Sequence
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
ROOT_DIR = BASE_DIR.parent
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.containers import Container, Horizontal, Vertical, ScrollableContainer
|
||||
from textual.widgets import Static, Button, Input, Label, ListView, ListItem, Rule, OptionList, Footer, Select
|
||||
from textual.widgets import Static, Button, Input, Label, ListView, ListItem, Rule, Select
|
||||
from textual import on, work
|
||||
from textual.message import Message
|
||||
from typing import Dict, Any, List, Optional
|
||||
import os
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from pathlib import Path
|
||||
from SYS.config import load_config, save_config, global_config
|
||||
|
||||
@@ -9,11 +9,10 @@ This modal allows users to specify:
|
||||
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.containers import Container, Horizontal, Vertical, ScrollableContainer
|
||||
from textual.containers import Container, Horizontal, Vertical
|
||||
from textual.widgets import (
|
||||
Static,
|
||||
Button,
|
||||
Label,
|
||||
Select,
|
||||
Checkbox,
|
||||
TextArea,
|
||||
@@ -448,8 +447,6 @@ class DownloadModal(ModalScreen):
|
||||
|
||||
try:
|
||||
# Capture output from the cmdlet using temp files (more reliable than redirect)
|
||||
import tempfile
|
||||
import subprocess
|
||||
|
||||
# Try normal redirect first
|
||||
import io
|
||||
@@ -461,7 +458,7 @@ class DownloadModal(ModalScreen):
|
||||
# Always capture output
|
||||
try:
|
||||
with redirect_stdout(stdout_buf), redirect_stderr(stderr_buf):
|
||||
logger.info(f"Calling download_cmdlet...")
|
||||
logger.info("Calling download_cmdlet...")
|
||||
cmd_config = (
|
||||
dict(self.config)
|
||||
if isinstance(self.config,
|
||||
@@ -637,7 +634,7 @@ class DownloadModal(ModalScreen):
|
||||
|
||||
# Also append detailed error info to worker stdout for visibility
|
||||
if worker:
|
||||
worker.append_stdout(f"\n❌ DOWNLOAD FAILED\n")
|
||||
worker.append_stdout("\n❌ DOWNLOAD FAILED\n")
|
||||
worker.append_stdout(f"Reason: {error_reason}\n")
|
||||
if stderr_text and stderr_text.strip():
|
||||
worker.append_stdout(
|
||||
@@ -1169,7 +1166,7 @@ class DownloadModal(ModalScreen):
|
||||
url.endswith(".pdf") or "pdf" in url.lower() for url in url
|
||||
)
|
||||
if all_pdfs:
|
||||
logger.info(f"All url are PDFs - creating pseudo-playlist")
|
||||
logger.info("All url are PDFs - creating pseudo-playlist")
|
||||
self._handle_pdf_playlist(url)
|
||||
return
|
||||
|
||||
@@ -1646,7 +1643,7 @@ class DownloadModal(ModalScreen):
|
||||
break
|
||||
|
||||
if not json_line:
|
||||
logger.error(f"No JSON found in get-tag output")
|
||||
logger.error("No JSON found in get-tag output")
|
||||
logger.debug(f"Raw output: {output}")
|
||||
try:
|
||||
self.app.call_from_thread(
|
||||
|
||||
@@ -3,20 +3,16 @@
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.containers import Container, Horizontal, Vertical
|
||||
from textual.widgets import Static, Button, Input, TextArea, Tree, Select
|
||||
from textual.widgets import Static, Button, Input, TextArea, Select
|
||||
from textual.binding import Binding
|
||||
import logging
|
||||
from typing import Optional, Any
|
||||
from typing import Optional
|
||||
from pathlib import Path
|
||||
import json
|
||||
import sys
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
# Add parent directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
from SYS.utils import format_metadata_value
|
||||
from SYS.config import load_config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -147,7 +143,7 @@ class ExportModal(ModalScreen):
|
||||
|
||||
if not metadata:
|
||||
logger.info(
|
||||
f"_get_metadata_text - No metadata found, returning 'No metadata available'"
|
||||
"_get_metadata_text - No metadata found, returning 'No metadata available'"
|
||||
)
|
||||
return "No metadata available"
|
||||
|
||||
@@ -184,7 +180,7 @@ class ExportModal(ModalScreen):
|
||||
)
|
||||
return "\n".join(lines)
|
||||
else:
|
||||
logger.info(f"_get_metadata_text - No matching fields found in metadata")
|
||||
logger.info("_get_metadata_text - No matching fields found in metadata")
|
||||
return "No metadata available"
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.containers import Container, Horizontal, Vertical
|
||||
from textual.containers import Horizontal, Vertical
|
||||
from textual.widgets import Static, Button, Input, Select, DataTable, TextArea
|
||||
from textual.binding import Binding
|
||||
from textual.message import Message
|
||||
@@ -363,7 +363,7 @@ class SearchModal(ModalScreen):
|
||||
tags_text = "\n".join(tags)
|
||||
|
||||
self.tags_textarea.text = tags_text
|
||||
logger.info(f"[search-modal] Populated tags textarea from result")
|
||||
logger.info("[search-modal] Populated tags textarea from result")
|
||||
|
||||
async def _download_book(self, result: Any) -> None:
|
||||
"""Download a book from OpenLibrary using the provider."""
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.containers import Container, ScrollableContainer
|
||||
from textual.widgets import Static, Button, Label
|
||||
from typing import List, Callable
|
||||
from textual.widgets import Static, Button
|
||||
from typing import List
|
||||
|
||||
class SelectionModal(ModalScreen[str]):
|
||||
"""A modal for selecting a type from a list of strings."""
|
||||
|
||||
@@ -238,7 +238,7 @@ class WorkersModal(ModalScreen):
|
||||
"---",
|
||||
"No workers running"
|
||||
)
|
||||
logger.debug(f"[workers-modal] No running workers to display")
|
||||
logger.debug("[workers-modal] No running workers to display")
|
||||
return
|
||||
|
||||
logger.debug(
|
||||
@@ -319,7 +319,7 @@ class WorkersModal(ModalScreen):
|
||||
"---",
|
||||
"No finished workers"
|
||||
)
|
||||
logger.debug(f"[workers-modal] No finished workers to display")
|
||||
logger.debug("[workers-modal] No finished workers to display")
|
||||
return
|
||||
|
||||
logger.info(
|
||||
@@ -399,7 +399,7 @@ class WorkersModal(ModalScreen):
|
||||
workers_list = None
|
||||
if event.control == self.running_table:
|
||||
workers_list = self.running_workers
|
||||
logger.debug(f"[workers-modal] Highlighted in running table")
|
||||
logger.debug("[workers-modal] Highlighted in running table")
|
||||
elif event.control == self.finished_table:
|
||||
workers_list = self.finished_workers
|
||||
logger.debug(
|
||||
@@ -442,7 +442,7 @@ class WorkersModal(ModalScreen):
|
||||
workers_list = None
|
||||
if event.data_table == self.running_table:
|
||||
workers_list = self.running_workers
|
||||
logger.debug(f"[workers-modal] Cell highlighted in running table")
|
||||
logger.debug("[workers-modal] Cell highlighted in running table")
|
||||
elif event.data_table == self.finished_table:
|
||||
workers_list = self.finished_workers
|
||||
logger.debug(
|
||||
@@ -502,7 +502,7 @@ class WorkersModal(ModalScreen):
|
||||
self.stdout_display.cursor_location = (len(combined_text) - 1, 0)
|
||||
except Exception:
|
||||
pass
|
||||
logger.info(f"[workers-modal] Updated stdout display successfully")
|
||||
logger.info("[workers-modal] Updated stdout display successfully")
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"[workers-modal] Error updating stdout display: {e}",
|
||||
|
||||
@@ -22,13 +22,9 @@ for path in (ROOT_DIR, BASE_DIR):
|
||||
sys.path.insert(0, str_path)
|
||||
|
||||
from SYS import pipeline as ctx
|
||||
# Lazily import CLI dependencies to avoid import-time failures in test environments
|
||||
try:
|
||||
from CLI import ConfigLoader, PipelineExecutor as CLIPipelineExecutor, WorkerManagerRegistry
|
||||
except Exception:
|
||||
ConfigLoader = None
|
||||
CLIPipelineExecutor = None
|
||||
WorkerManagerRegistry = None
|
||||
from CLI import ConfigLoader
|
||||
from SYS.pipeline import PipelineExecutor
|
||||
from SYS.worker import WorkerManagerRegistry
|
||||
from SYS.logger import set_debug
|
||||
from SYS.rich_display import capture_rich_output
|
||||
from SYS.result_table import Table
|
||||
@@ -89,7 +85,7 @@ class PipelineRunner:
|
||||
if executor is not None:
|
||||
self._executor = executor
|
||||
else:
|
||||
self._executor = CLIPipelineExecutor(config_loader=self._config_loader) if CLIPipelineExecutor else None
|
||||
self._executor = PipelineExecutor(config_loader=self._config_loader)
|
||||
self._worker_manager = None
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user