Fix for typing after stubs update.

This commit is contained in:
Mikaël Capelle
2022-05-07 14:02:01 +02:00
parent dce39d8cb4
commit af6fa07882
8 changed files with 12 additions and 16 deletions
+5 -5
View File
@@ -2,7 +2,7 @@
import sys
from pathlib import Path
from typing import Callable, List, Optional
from typing import Callable
from PyQt6.QtCore import QDateTime, Qt
from PyQt6.QtGui import QImage, QPixmap
@@ -28,12 +28,12 @@ class BasicGameSaveGame(mobase.ISaveGame):
def getSaveGroupIdentifier(self) -> str:
return ""
def allFiles(self) -> List[str]:
def allFiles(self) -> list[str]:
return [self.getFilepath()]
class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
def __init__(self, parent: QWidget, get_preview: Callable[[str], str]):
def __init__(self, parent: QWidget, get_preview: Callable[[Path], Path | None]):
super().__init__(parent)
self._get_preview = get_preview
@@ -60,7 +60,7 @@ class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
self.resize(0, 0)
# Retrieve the pixmap:
value = self._get_preview(save.getFilepath())
value = self._get_preview(Path(save.getFilepath()))
if value is None:
return
@@ -89,7 +89,7 @@ class BasicGameSaveGameInfoWidget(mobase.ISaveGameInfoWidget):
class BasicGameSaveGameInfo(mobase.SaveGameInfo):
def __init__(self, get_preview: Optional[Callable[[str], str]] = None):
def __init__(self, get_preview: Callable[[Path], Path | None] | None = None):
super().__init__()
self._get_preview = get_preview
+1 -1
View File
@@ -300,7 +300,7 @@ class BlackAndWhite2SaveGameInfoWidget(BasicGameSaveGameInfoWidget):
self.resize(0, 0)
# Retrieve the pixmap:
value = self._get_preview(save.getFilepath())
value = self._get_preview(Path(save.getFilepath()))
if value is None:
return
+1 -3
View File
@@ -1,5 +1,3 @@
import os
import mobase
from ..basic_features import BasicGameSaveGameInfo
@@ -33,6 +31,6 @@ class DA2Game(BasicGame):
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
lambda s: os.path.split(s)[0] + "/screen.dds"
lambda s: s.parent.joinpath("screen.dds")
)
return True
+1 -3
View File
@@ -1,5 +1,3 @@
import os
import mobase
from ..basic_features import BasicGameSaveGameInfo
@@ -29,6 +27,6 @@ class DAOriginsGame(BasicGame):
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
lambda s: os.path.split(s)[0] + "/screen.dds"
lambda s: s.parent.joinpath("screen.dds")
)
return True
+1 -1
View File
@@ -34,6 +34,6 @@ class DivinityOriginalSinGame(BasicGame):
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
lambda s: s.replace(".lsv", ".png") # Not confirmed
lambda s: s.with_suffix(".png") # Not confirmed
)
return True
+1 -1
View File
@@ -94,7 +94,7 @@ class DivinityOriginalSinEnhancedEditionGame(BasicGame, mobase.IPluginFileMapper
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
lambda s: s.replace(".lsv", ".png")
lambda s: s.with_suffix(".png")
)
self._featureMap[
mobase.ModDataChecker
+1 -1
View File
@@ -42,7 +42,7 @@ class Witcher3Game(BasicGame):
def init(self, organizer: mobase.IOrganizer):
super().init(organizer)
self._featureMap[mobase.SaveGameInfo] = BasicGameSaveGameInfo(
lambda s: s.replace(".sav", ".png")
lambda s: s.with_suffix(".png")
)
return True
+1 -1
View File
@@ -36,7 +36,7 @@ pip_version = pip>=20
skip_install = true
deps =
git+https://github.com/TilmanK/PyQt6-stubs.git
mobase-stubs==2.5.0.dev4
mobase-stubs>=2.5.0.dev9
psutil==5.8.0
vdf==3.4
lzokay==1.0.1