📝 Updated SourceIterator type hints
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Optional
|
from typing import Optional, Generator
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ from src.utils.save_cover import resize_cover, save_cover
|
|||||||
class BottlesSourceIterator(SourceIterator):
|
class BottlesSourceIterator(SourceIterator):
|
||||||
source: "BottlesSource"
|
source: "BottlesSource"
|
||||||
|
|
||||||
def generator_builder(self) -> Optional[Game]:
|
def generator_builder(self) -> Generator[Optional[Game], None, None]:
|
||||||
"""Generator method producing games"""
|
"""Generator method producing games"""
|
||||||
|
|
||||||
data = (self.source.location / "library.yml").read_text("utf-8")
|
data = (self.source.location / "library.yml").read_text("utf-8")
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from hashlib import sha256
|
|||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Optional, TypedDict
|
from typing import Optional, TypedDict, Generator
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -85,7 +85,7 @@ class HeroicSourceIterator(SourceIterator):
|
|||||||
|
|
||||||
return Game(values, allow_side_effects=False)
|
return Game(values, allow_side_effects=False)
|
||||||
|
|
||||||
def generator_builder(self):
|
def generator_builder(self) -> Generator[Optional[Game], None, None]:
|
||||||
"""Generator method producing games from all the Heroic sub-sources"""
|
"""Generator method producing games from all the Heroic sub-sources"""
|
||||||
|
|
||||||
for sub_source in self.sub_sources.values():
|
for sub_source in self.sub_sources.values():
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from sqlite3 import connect
|
from sqlite3 import connect
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Optional
|
from typing import Optional, Generator
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -12,7 +12,7 @@ from src.utils.save_cover import resize_cover, save_cover
|
|||||||
class LutrisSourceIterator(SourceIterator):
|
class LutrisSourceIterator(SourceIterator):
|
||||||
source: "LutrisSource"
|
source: "LutrisSource"
|
||||||
|
|
||||||
def generator_builder(self) -> Optional[Game]:
|
def generator_builder(self) -> Generator[Optional[Game], None, None]:
|
||||||
"""Generator method producing games"""
|
"""Generator method producing games"""
|
||||||
|
|
||||||
# Query the database
|
# Query the database
|
||||||
|
|||||||
@@ -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 Iterable, Optional
|
from typing import Iterable, Optional, Generator
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -44,7 +44,7 @@ class SteamSourceIterator(SourceIterator):
|
|||||||
)
|
)
|
||||||
return manifests
|
return manifests
|
||||||
|
|
||||||
def generator_builder(self) -> Optional[Game]:
|
def generator_builder(self) -> Generator[Optional[Game], None, None]:
|
||||||
"""Generator method producing games"""
|
"""Generator method producing games"""
|
||||||
appid_cache = set()
|
appid_cache = set()
|
||||||
manifests = self.get_manifests()
|
manifests = self.get_manifests()
|
||||||
|
|||||||
Reference in New Issue
Block a user