1313import urllib .request
1414import zipfile
1515from configparser import SectionProxy
16- from functools import cached_property
16+ from functools import cached_property , partial
1717from pathlib import Path
18+ from typing import Callable
1819from xml .etree import ElementTree
1920from xml .etree .ElementTree import Element
2021
22+ import mobase
2123from PyQt6 import QtCore
2224from PyQt6 .QtCore import (
2325 QCoreApplication ,
3436)
3537from PyQt6 .QtWidgets import QApplication , QMainWindow , QMessageBox , QProgressDialog
3638
37- import mobase
38- from mobase import IModInterface
39-
4039from ..basic_features import (
4140 BasicGameSaveGameInfo ,
4241 BasicLocalSavegames ,
@@ -280,7 +279,9 @@ def map_files(path, dest_func, pattern="*", dest_dir=docs_path):
280279 )
281280 map_files (
282281 f"{ mod .absolutePath ()} /Script Extender" ,
283- lambda file : os .path .relpath (file , mod .absolutePath ()),
282+ partial (
283+ lambda file , mod : os .path .relpath (file , mod .absolutePath ()), mod = mod
284+ ),
284285 )
285286 progress .setValue (progress .value () + 1 )
286287 QApplication .processEvents ()
@@ -364,7 +365,7 @@ def _set_setting(self, key: str, value: mobase.MoVariant):
364365 def __tr (self , trstr ):
365366 return QCoreApplication .translate (self .name (), trstr )
366367
367- def _active_mods (self ) -> list [IModInterface ]:
368+ def _active_mods (self ) -> list [mobase . IModInterface ]:
368369 return [
369370 self ._organizer .modList ().getMod (mod_name )
370371 for mod_name in filter (
@@ -374,7 +375,9 @@ def _active_mods(self) -> list[IModInterface]:
374375 )
375376 ]
376377
377- def _create_progress_window (self , title , max_progress , msg = "" ):
378+ def _create_progress_window (
379+ self , title : str , max_progress : int , msg : str = ""
380+ ) -> QProgressDialog :
378381 progress = QProgressDialog (
379382 self .__tr (msg if msg else title ),
380383 self .__tr ("Cancel" ),
@@ -454,7 +457,7 @@ def _construct_modsettings_xml(self, _: str = "") -> bool:
454457 progress = self ._create_progress_window (
455458 "Generating modsettings.xml" , len (active_mods )
456459 )
457- metadata = {}
460+ metadata : dict [ str , str ] = {}
458461 threadpool = QThreadPool .globalInstance ()
459462 for mod in active_mods :
460463 threadpool .start (
@@ -633,9 +636,9 @@ def metadata_to_ini(condition: bool, to_parse):
633636 return get_module_short_desc ()
634637
635638 if force_recreate is None :
636- force_recreate = self ._get_setting ("force_reparse_metadata" ) == True
639+ force_recreate = self ._get_setting ("force_reparse_metadata" )
637640 if rm_extracted is None :
638- rm_extracted = self ._get_setting ("remove_extracted_metadata" ) == True
641+ rm_extracted = self ._get_setting ("remove_extracted_metadata" )
639642 meta_ini = Path (mod .absolutePath ()) / "meta.ini"
640643 config = configparser .ConfigParser ()
641644 config .read (meta_ini , encoding = "utf-8" )
0 commit comments