From ac77c5661691d12173d2341a0cbf77e7724e293f Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 25 Jul 2023 00:20:14 -0700 Subject: [PATCH] remove plugin options --- src/ytdl_sub/config/preset.py | 4 ++-- src/ytdl_sub/plugins/plugin.py | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ytdl_sub/config/preset.py b/src/ytdl_sub/config/preset.py index 2b120c18..45b4db69 100644 --- a/src/ytdl_sub/config/preset.py +++ b/src/ytdl_sub/config/preset.py @@ -16,12 +16,12 @@ from ytdl_sub.config.preset_class_mappings import PluginMapping from ytdl_sub.config.preset_options import OptionsValidator from ytdl_sub.config.preset_options import OutputOptions from ytdl_sub.config.preset_options import Overrides +from ytdl_sub.config.preset_options import TOptionsValidator from ytdl_sub.config.preset_options import YTDLOptions from ytdl_sub.downloaders.base_downloader import BaseDownloader from ytdl_sub.downloaders.downloader_validator import DownloaderValidator from ytdl_sub.entries.entry import Entry from ytdl_sub.plugins.plugin import Plugin -from ytdl_sub.plugins.plugin import PluginOptionsT from ytdl_sub.prebuilt_presets import PREBUILT_PRESET_NAMES from ytdl_sub.prebuilt_presets import PUBLISHED_PRESET_NAMES from ytdl_sub.utils.exceptions import ValidationException @@ -85,7 +85,7 @@ class PresetPlugins: """ return zip(self.plugin_types, self.plugin_options) - def get(self, plugin_type: Type[PluginOptionsT]) -> Optional[PluginOptionsT]: + def get(self, plugin_type: Type[TOptionsValidator]) -> Optional[TOptionsValidator]: """ Parameters ---------- diff --git a/src/ytdl_sub/plugins/plugin.py b/src/ytdl_sub/plugins/plugin.py index 630f2270..46d896d7 100644 --- a/src/ytdl_sub/plugins/plugin.py +++ b/src/ytdl_sub/plugins/plugin.py @@ -5,10 +5,9 @@ from typing import List from typing import Optional from typing import Tuple from typing import Type -from typing import TypeVar -from ytdl_sub.config.preset_options import OptionsValidator from ytdl_sub.config.preset_options import Overrides +from ytdl_sub.config.preset_options import TOptionsValidator from ytdl_sub.entries.entry import Entry from ytdl_sub.utils.file_handler import FileMetadata from ytdl_sub.utils.logger import Logger @@ -43,15 +42,12 @@ class PluginPriority: return self.modify_entry >= PluginPriority.MODIFY_ENTRY_AFTER_SPLIT -PluginOptionsT = TypeVar("PluginOptionsT", bound=OptionsValidator) - - -class Plugin(DownloadArchiver, Generic[PluginOptionsT], ABC): +class Plugin(DownloadArchiver, Generic[TOptionsValidator], ABC): """ Class to define the new plugin functionality """ - plugin_options_type: Type[PluginOptionsT] = NotImplemented + plugin_options_type: Type[TOptionsValidator] = NotImplemented priority: PluginPriority = PluginPriority() # If the plugin creates multiple entries from a single entry @@ -59,7 +55,7 @@ class Plugin(DownloadArchiver, Generic[PluginOptionsT], ABC): def __init__( self, - plugin_options: PluginOptionsT, + plugin_options: TOptionsValidator, overrides: Overrides, enhanced_download_archive: EnhancedDownloadArchive, ):