📝 Consistent typing in exsiting sources
This commit is contained in:
@@ -112,8 +112,8 @@ class HeroicSourceIterator(SourceIterator):
|
|||||||
continue
|
continue
|
||||||
yield game
|
yield game
|
||||||
|
|
||||||
def __init__(self, source: "HeroicSource") -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
self.source = source
|
super().__init__(*args, **kwargs)
|
||||||
self.generator = self.sub_sources_generator()
|
self.generator = self.sub_sources_generator()
|
||||||
|
|
||||||
def __next__(self) -> Optional[Game]:
|
def __next__(self) -> Optional[Game]:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from sqlite3 import connect
|
from sqlite3 import connect
|
||||||
from time import time
|
from time import time
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -27,7 +28,7 @@ class LutrisSourceIterator(SourceIterator):
|
|||||||
"""
|
"""
|
||||||
db_request_params = None
|
db_request_params = None
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.import_steam = shared.schema.get_boolean("lutris-import-steam")
|
self.import_steam = shared.schema.get_boolean("lutris-import-steam")
|
||||||
self.db_location = self.source.location / "pga.db"
|
self.db_location = self.source.location / "pga.db"
|
||||||
@@ -37,9 +38,7 @@ class LutrisSourceIterator(SourceIterator):
|
|||||||
self.db_games_request, self.db_request_params
|
self.db_games_request, self.db_request_params
|
||||||
)
|
)
|
||||||
|
|
||||||
def __next__(self):
|
def __next__(self) -> Optional[Game]:
|
||||||
"""Produce games"""
|
|
||||||
|
|
||||||
row = None
|
row = None
|
||||||
try:
|
try:
|
||||||
row = self.db_cursor.__next__()
|
row = self.db_cursor.__next__()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Iterator
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -27,7 +27,7 @@ class SteamSourceIterator(SourceIterator):
|
|||||||
installed_state_mask: int = 4
|
installed_state_mask: int = 4
|
||||||
appid_cache: set = None
|
appid_cache: set = None
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.appid_cache = set()
|
self.appid_cache = set()
|
||||||
@@ -56,9 +56,7 @@ class SteamSourceIterator(SourceIterator):
|
|||||||
|
|
||||||
self.manifests_iterator = iter(self.manifests)
|
self.manifests_iterator = iter(self.manifests)
|
||||||
|
|
||||||
def __next__(self):
|
def __next__(self) -> Optional[Game]:
|
||||||
"""Produce games"""
|
|
||||||
|
|
||||||
# Get metadata from manifest
|
# Get metadata from manifest
|
||||||
manifest_path = next(self.manifests_iterator)
|
manifest_path = next(self.manifests_iterator)
|
||||||
steam = SteamHelper()
|
steam = SteamHelper()
|
||||||
|
|||||||
Reference in New Issue
Block a user