Pylint fixes

This commit is contained in:
Mathieu Comandon 2022-11-28 22:27:40 -08:00
parent 65f2dbabd4
commit 027a55e2b7
11 changed files with 16 additions and 12 deletions

View file

@ -108,7 +108,7 @@ class Application(Gtk.Application):
"To install a game, add lutris:install/game-identifier."
))
else:
logger.warning("GLib.set_option_context_summary missing, " "was added in GLib 2.56 (Released 2018-03-12)")
logger.warning("GLib.set_option_context_summary missing, was added in GLib 2.56 (Released 2018-03-12)")
self.add_main_option(
"version",
ord("v"),

View file

@ -122,7 +122,7 @@ def _init_template(self, cls, base_init_template):
# TODO: could disallow using a metaclass.. but this is good enough
# .. if you disagree, feel free to fix it and issue a PR :)
if self.__class__ is not cls:
raise TypeError("Inheritance from classes with @GtkTemplate decorators " "is not allowed at this time")
raise TypeError("Inheritance from classes with @GtkTemplate decorators is not allowed at this time")
connected_signals = set()
self.__connected_template_signals__ = connected_signals

View file

@ -148,7 +148,7 @@ def create_prefix( # noqa: C901
if loop_index == 60:
logger.warning("Wine prefix creation is taking longer than expected...")
if not os.path.exists(os.path.join(prefix, "user.reg")):
logger.error("No user.reg found after prefix creation. " "Prefix might not be valid")
logger.error("No user.reg found after prefix creation. Prefix might not be valid")
return
logger.info("%s Prefix created in %s", arch, prefix)
prefix_manager = WinePrefixManager(prefix)

View file

@ -26,7 +26,11 @@ def get_libretro_cores():
# Get core identifiers from info dir
info_path = get_default_config_path("info")
if not os.path.exists(info_path):
req = requests.get("http://buildbot.libretro.com/assets/frontend/info.zip", allow_redirects=True)
req = requests.get(
"http://buildbot.libretro.com/assets/frontend/info.zip",
allow_redirects=True,
timeout=5
)
if req.status_code == requests.codes.ok: # pylint: disable=no-member
with open(get_default_config_path('info.zip'), 'wb') as info_zip:
info_zip.write(req.content)

View file

@ -18,7 +18,7 @@ class redream(Runner):
"option": "main_file",
"type": "file",
"label": _("Disc image file"),
"help": _("Game data file\n" "Supported formats: GDI, CDI, CHD"),
"help": _("Game data file\nSupported formats: GDI, CDI, CHD"),
}
]
runner_options = [

View file

@ -87,7 +87,7 @@ class FlathubService(BaseService):
logger.warning("Flathub games are already loading")
return
self.is_loading = True
response = requests.get(self.api_url)
response = requests.get(self.api_url, timeout=5)
entries = response.json()
# seen = set()
flathub_games = []

View file

@ -627,7 +627,7 @@ class GOGService(OnlineService):
patch_installers = []
for version in patch_versions:
patch = patch_versions[version]
size = human_size(sum([part["total_size"] for part in patch]))
size = human_size(sum(part["total_size"] for part in patch))
patch_id = "gogpatch-%s" % slugify(patch[0]["version"])
installer = {
"name": db_game["name"],

View file

@ -140,7 +140,7 @@ class Downloader:
headers["User-Agent"] = "Lutris/%s" % __version__
if self.referer:
headers["Referer"] = self.referer
response = requests.get(self.url, headers=headers, stream=True)
response = requests.get(self.url, headers=headers, stream=True, timeout=30)
if response.status_code != 200:
logger.info("%s returned a %s error", self.url, response.status_code)
response.raise_for_status()

View file

@ -19,7 +19,7 @@ class SettingsIO:
except configparser.ParsingError as ex:
logger.error("Failed to readconfig file %s: %s", self.config_file, ex)
except UnicodeDecodeError as ex:
logger.error("Some invalid characters are preventing " "the setting file from loading properly: %s", ex)
logger.error("Some invalid characters are preventing the setting file from loading properly: %s", ex)
def read_setting(self, key, section="lutris", default=""):
"""Read a setting from the config file

View file

@ -112,7 +112,7 @@ def get_steam_library(steamid):
settings.STEAM_API_KEY, steamid
)
)
response = requests.get(steam_games_url)
response = requests.get(steam_games_url, timeout=30)
if response.status_code > 400:
logger.error("Invalid response from steam: %s", response)
return []

View file

@ -467,11 +467,11 @@ def get_disk_size(path):
"""Return the disk size in bytes of a folder"""
total_size = 0
for base, _dirs, files in os.walk(path):
total_size += sum([
total_size += sum(
os.stat(os.path.join(base, f)).st_size
for f in files
if os.path.isfile(os.path.join(base, f))
])
)
return total_size