Clean Flake8 warnings

This commit is contained in:
Mathieu Comandon 2020-03-29 15:41:46 -07:00
parent d929d167c0
commit 49d2bbf1ae
10 changed files with 46 additions and 23 deletions

View file

@ -34,7 +34,7 @@ from gi.repository import Gio, GLib, Gtk
from lutris import pga
from lutris.game import Game
from lutris import settings
from lutris.gui.dialogs import ErrorDialog, InstallOrPlayDialog, GtkBuilderDialog
from lutris.gui.dialogs import ErrorDialog, InstallOrPlayDialog
from lutris.gui.dialogs.issue import IssueReportWindow
from lutris.gui.installerwindow import InstallerWindow
from lutris.gui.widgets.status_icon import LutrisStatusIcon

View file

@ -3,7 +3,6 @@
import os
from lutris import api, pga, runtime, settings
from lutris.gui.widgets.utils import open_uri
from lutris.gui.widgets.log_text_view import LogTextView
from lutris.util import datapath
from lutris.util.log import logger

View file

@ -3,7 +3,7 @@ import os
import time
import webbrowser
from gi.repository import Gtk, GObject
from gi.repository import Gtk
from lutris import api, pga, settings
from lutris.installer import interpreter

View file

@ -1,4 +1,3 @@
# pylint: disable=E1101, E0611
"""Install a game by following its install script."""
import os
import time
@ -354,7 +353,9 @@ class ScriptInterpreter(CommandsMixin):
def swap_humble_game_files(self):
"""Replace the user provided file with download links from Humble Bundle"""
if not self.humbleid:
raise UnavailableGame("This installer has no Humble Bundle ID ('humbleid' in the game section)")
raise UnavailableGame(
"This installer has no Humble Bundle ID ('humbleid' in the game section)"
)
installer_file_id = self.pop_user_provided_file()
if not installer_file_id:
raise UnavailableGame("Installer has no user provided file")

View file

@ -8,7 +8,7 @@ from lutris import runtime, settings
from lutris.config import LutrisConfig
from lutris.runners import import_runner
from lutris.command import MonitoredCommand
from lutris.util import datapath, system
from lutris.util import system
from lutris.util.strings import split_arguments
from lutris.util.log import logger
from lutris.util.wine.wine import (

View file

@ -16,15 +16,31 @@ class dgen(Runner):
}
]
runner_options = [
{"option": "fullscreen", "type": "bool", "label": "Fullscreen", "default": True},
{"option": "pal", "type": "bool", "label": "PAL", "default": False, "advanced": True},
{
"option": "fullscreen",
"type": "bool",
"label": "Fullscreen",
"default": True,
},
{
"option": "pal",
"type": "bool",
"label": "PAL",
"default": False,
"advanced": True,
},
{
"option": "region",
"type": "choice",
"label": "Region",
"choices": [("America (NTSC)", "U"), ("Japan (NTSC)", "J"), ("Japan (PAL)", "X"),("Europe (PAL)", "E")],
"choices": [
("America (NTSC)", "U"),
("Japan (NTSC)", "J"),
("Japan (PAL)", "X"),
("Europe (PAL)", "E"),
],
"default": "off",
"advanced": True
"advanced": True,
},
]

View file

@ -1,3 +1,4 @@
"""libretro runner"""
import os
from lutris.runners.runner import Runner
from lutris.util.libretro import RetroConfig
@ -54,7 +55,9 @@ LIBRETRO_CORES = [
("Mednafen PCE FAST (TurboGrafx-16)", "mednafen_pce_fast", "NEC PC Engine (TurboGrafx-16)"),
("Mednafen PCFX (NEC PC-FX)", "mednafen_pcfx", "NEC PC-FX"),
("Mednafen Saturn (Sega Saturn)", "mednafen_saturn", "Sega Saturn"),
("Mednafen SGX (NEC PC Engine SuperGrafx)", "mednafen_supergrafx", "NEC PC Engine (SuperGrafx)"),
("Mednafen SGX (NEC PC Engine SuperGrafx)",
"mednafen_supergrafx",
"NEC PC Engine (SuperGrafx)"),
("Mednafen WSWAN (Bandai WonderSwan)", "mednafen_wswan", "Bandai WonderSwan"),
("Mednafen PSX (Sony Playstation)", "mednafen_psx", "Sony PlayStation"),
("Mednafen PSX OpenGL (Sony Playstation)", "mednafen_psx_hw", "Sony PlayStation"),

View file

@ -28,7 +28,7 @@ def read_config(steam_data_dir):
"""Read the Steam configuration and return it as an object"""
def get_entry_case_insensitive(config_dict, path):
for key, value in config_dict.items():
for key, _value in config_dict.items():
if key.lower() == path[0].lower():
if len(path) <= 1:
return config_dict[key]
@ -42,14 +42,15 @@ def read_config(steam_data_dir):
with open(config_filename, "r") as steam_config_file:
config = vdf_parse(steam_config_file, {})
try:
return get_entry_case_insensitive(config, ["InstallConfigStore", "Software", "Valve", "Steam"])
return get_entry_case_insensitive(
config,
["InstallConfigStore", "Software", "Valve", "Steam"]
)
except KeyError as ex:
logger.error("Steam config %s is empty: %s", config_filename, ex)
def get_steamapps_paths_for_platform(platform_name):
"""
"""
from lutris.runners import winesteam, steam
runners = {"linux": steam.steam, "windows": winesteam.winesteam}

View file

@ -118,11 +118,12 @@ class WinePrefixManager:
except OSError:
os.rename(path, old_path)
# if we want to create a symlink and one is already there, just skip to the next item.
# this also makes sure the elif doesn't find a dir (isdir only looks at the target of the symlink).
# if we want to create a symlink and one is already there, just
# skip to the next item. this also makes sure the elif doesn't
# find a dir (isdir only looks at the target of the symlink).
if restore and os.path.islink(path):
continue
elif restore and not os.path.isdir(path):
if restore and not os.path.isdir(path):
src_path = get_xdg_entry(DESKTOP_XDG[i])
if not src_path:
logger.error(

View file

@ -22,8 +22,8 @@ def get_xdg_entry(directory):
}
directory = directory.upper()
if directory not in special_dir.keys():
raise ValueError(directory + " not supported. Only those folders are supported: " +
", ".join(special_dir.keys()))
raise ValueError(directory + " not supported. Only those folders are supported: "
+ ", ".join(special_dir.keys()))
return GLib.get_user_special_dir(special_dir[directory])
@ -33,9 +33,9 @@ def get_xdg_basename(game_slug, game_id, base_dir=None):
# When base dir is provided, lookup possible combinations
# and return the first match
for path in [
"{}.desktop".format(game_slug),
"{}-{}.desktop".format(game_slug, game_id),
"net.lutris.{}-{}.desktop".format(game_slug, game_id),
"{}.desktop".format(game_slug),
"{}-{}.desktop".format(game_slug, game_id),
"net.lutris.{}-{}.desktop".format(game_slug, game_id),
]:
if system.path_exists(os.path.join(base_dir, path)):
return path
@ -109,10 +109,12 @@ def get_menu_launcher_path(game_slug, game_id):
def desktop_launcher_exists(game_slug, game_id):
"""Return True if there is an existing desktop icon for a game"""
return system.path_exists(get_launcher_path(game_slug, game_id))
def menu_launcher_exists(game_slug, game_id):
"""Return True if there is an existing application menu entry for a game"""
return system.path_exists(get_menu_launcher_path(game_slug, game_id))