🚨 Fixed some pylint warnings

This commit is contained in:
GeoffreyCoulaud
2023-05-20 02:03:34 +02:00
parent 138dcb6271
commit 7b97481b55
4 changed files with 14 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ from src.utils.steamgriddb import SGDBAuthError, SGDBError, SGDBHelper
from src.utils.task import Task
# pylint: disable=too-many-instance-attributes
class Importer:
"""A class in charge of scanning sources for games"""
@@ -87,9 +88,6 @@ class Importer:
self.import_dialog.present()
def update_progressbar(self):
logging.debug(
"Progressbar updated (%f)", self.progress
) # TODO why progress not workie?
self.progressbar.set_fraction(self.progress)
def source_task_thread_func(self, _task, _obj, data, _cancellable):
@@ -162,7 +160,7 @@ class Importer:
except SGDBAuthError as error:
cancellable.cancel()
self.sgdb_error = error
except (HTTPError, SGDBError) as error:
except (HTTPError, SGDBError) as _error:
# TODO handle other SGDB errors
pass

View File

@@ -28,7 +28,7 @@ class SourceIterator(Iterator, Sized):
class Source(Iterable):
"""Source of games. E.g an installed app with a config file that lists game directories"""
win = None # TODO maybe not depend on that ?
win = None
name: str
variant: str

View File

@@ -1,4 +1,4 @@
from functools import cache
from functools import lru_cache
from sqlite3 import connect
from time import time
@@ -48,7 +48,7 @@ class LutrisSourceIterator(SourceIterator):
self.db_games_request, self.db_request_params
)
@cache
@lru_cache(maxsize=1)
def __len__(self):
cursor = self.db_connection.execute(self.db_len_request, self.db_request_params)
return cursor.fetchone()[0]
@@ -60,9 +60,9 @@ class LutrisSourceIterator(SourceIterator):
row = None
try:
row = self.db_cursor.__next__()
except StopIteration as e:
except StopIteration as error:
self.db_connection.close()
raise e
raise error
# Create game
values = {
@@ -99,16 +99,13 @@ class LutrisSource(Source):
@property
def is_installed(self):
# pylint: disable=pointless-statement
try:
self.location
self.cache_location
except FileNotFoundError:
return False
else:
return True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
return True
def __iter__(self):
return LutrisSourceIterator(source=self)