From e470b602fc8d1dfbea2a6e457b2bd12d0466be2c Mon Sep 17 00:00:00 2001 From: gatsik <74517072+Gatsik@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:01:00 +0300 Subject: [PATCH] Fix some code style issues --- changelog.md | 8 ++++---- res/client/client.css | 16 +++++++-------- res/client/randomcolors.json | 2 +- res/coop/formatters/coop.qthtml | 2 -- res/coop/formatters/style.css | 9 ++++----- res/games/formatters/faf.qthtml | 2 -- res/notification_system/dialog.ui | 6 +++--- res/stats/formatters/ladder_header.qthtml | 1 - res/stats/formatters/style.css | 4 ++-- res/tournaments/formatters/open.qthtml | 2 -- res/tournaments/formatters/style.css | 1 - res/tutorials/formatters/tutorials.qthtml | 2 -- res/vaults/modvault/comment.qthtml | 2 +- res/vaults/modvault/uimod.qthtml | 2 +- runtests.py | 3 ++- setup.py | 10 +++++----- src/__main__.py | 3 ++- src/api/stats_api.py | 4 +++- src/chat/__init__.py | 5 +++++ src/chat/channel_view.py | 9 ++++++--- src/client/__init__.py | 4 ++++ src/client/_clientwindow.py | 20 +++++++++++++------ src/client/aliasviewer.py | 2 +- src/coop/__init__.py | 4 ++++ src/fa/__init__.py | 13 ++++++++++++ src/fa/game_process.py | 1 - src/fa/game_session.py | 3 +-- src/fa/replayserver.py | 1 - src/fa/updater.py | 2 +- src/games/__init__.py | 4 ++++ src/games/hostgamewidget.py | 2 +- src/model/chat/chat.py | 3 ++- src/news/__init__.py | 7 +++++++ src/news/wpapi.py | 4 +++- src/notifications/__init__.py | 9 ++++----- src/notifications/hook_gamefull.py | 5 ++--- src/notifications/hook_newgame.py | 7 +++---- src/notifications/hook_partyinvite.py | 7 +++---- src/notifications/hook_useronline.py | 7 +++---- src/notifications/ns_dialog.py | 6 +++--- src/notifications/ns_hook.py | 7 +++---- src/notifications/ns_settings.py | 20 +++++++++---------- src/replays/__init__.py | 4 ++++ src/replays/_replayswidget.py | 4 +++- src/secondaryServer/__init__.py | 4 ++++ src/stats/__init__.py | 6 ++++++ src/tourneys/__init__.py | 4 ++++ src/tutorials/__init__.py | 4 ++++ src/tutorials/_tutorialswidget.py | 4 +++- src/util/__init__.py | 1 - src/vaults/mapvault/mapvault.py | 3 +-- src/vaults/modvault/modvault.py | 5 +---- tests/fa/test_featured.py | 10 ++++++---- tests/fa/test_updater.py | 10 ++++++---- .../model/test_player_game.py | 6 +++--- .../model/test_player_ircuser.py | 2 +- tests/unit_tests/client/test_gameurl.py | 1 + .../unit_tests/client/test_mouse_position.py | 1 - tests/unit_tests/client/test_updating.py | 3 +-- tests/unit_tests/model/chat/test_channel.py | 1 + .../model/chat/test_channelchatter.py | 1 + .../unit_tests/model/chat/test_channelset.py | 2 +- tests/unit_tests/model/chat/test_lines.py | 1 + tests/unit_tests/model/test_game.py | 3 ++- tests/unit_tests/model/test_gameset.py | 5 +++-- 65 files changed, 189 insertions(+), 127 deletions(-) diff --git a/changelog.md b/changelog.md index 0f1a1de93..6b751af1a 100644 --- a/changelog.md +++ b/changelog.md @@ -39,7 +39,7 @@ Contributors: * Fix basic searching in vaults * Implement somewhat of a cache system like in the Java client * Online replay vault: fix downloading replays - + Contributors: - Gatsik @@ -92,7 +92,7 @@ Contributors: Contributors: - Strogo - muellni - + 0.18.3 ===== * ICE adapter debug window fixes @@ -100,7 +100,7 @@ Contributors: Contributors: - Geosearchef - muellni - + 0.18.2 ===== * ICE adapter integration @@ -662,7 +662,7 @@ Bugfixes - Fixed colouring problem with certain names - Automatic login will now get disabled if login fails - Fixed exceptions popping up related to corrupted replays -- Logs will no longer fill to unreasonable sizes +- Logs will no longer fill to unreasonable sizes - Many other small issues fixed diff --git a/res/client/client.css b/res/client/client.css index a8464240f..c561126ae 100644 --- a/res/client/client.css +++ b/res/client/client.css @@ -259,12 +259,12 @@ QSplitter::handle:hover background-color: #353535; color: orange; } - + QDateEdit:disabled { color: #8D8B85; } - + QDateEdit::down-arrow { color: orange; @@ -297,7 +297,7 @@ QSpinBox#minRating::disabled background-color: #4b4b4b; } -QComboBox#filter1, #filter2, #filter3, #filter4, #filter5, #filter6, +QComboBox#filter1, #filter2, #filter3, #filter4, #filter5, #filter6, #operator1, #operator2, #operator3, #operator4, #operator5, #operator6 { background-color: #353535; @@ -310,7 +310,7 @@ QToolBox#replayToolBox::tab color: silver; border-radius: 3px; padding-left: 145px; /* "alignment: center" doesn't work with toolboxes :| */ -} +} #advancedSearch, #mapPreview { @@ -374,7 +374,7 @@ QHeaderView::section background-color: #4b4b4b; font: bold; border-left: 1 solid; - + } QHeaderView::down-arrow @@ -671,7 +671,7 @@ QCheckBox#spoilerCheckbox, #automaticCheckbox, #showLatestCheckbox, #hideUnrChec { color: silver; } -QCheckBox#spoilerCheckbox::indicator:unchecked, #automaticCheckbox::indicator:unchecked, #showLatestCheckbox::indicator:unchecked, +QCheckBox#spoilerCheckbox::indicator:unchecked, #automaticCheckbox::indicator:unchecked, #showLatestCheckbox::indicator:unchecked, #hideUnrCheckbox::indicator:unchecked ,#landRandomDensity::indicator::unchecked, #plateausRandomDensity::indicator::unchecked, #mountainsRandomDensity::indicator::unchecked ,#rampsRandomDensity::indicator::unchecked, #mexRandomDensity::indicator::unchecked ,#reclaimRandomDensity::indicator::unchecked @@ -679,7 +679,7 @@ QCheckBox#spoilerCheckbox::indicator:unchecked, #automaticCheckbox::indicator:un image: url('%THEMEPATH%/client/chboxUncheked.png'); } -QCheckBox#spoilerCheckbox::indicator:checked, #automaticCheckbox::indicator:checked, #showLatestCheckbox::indicator:checked, +QCheckBox#spoilerCheckbox::indicator:checked, #automaticCheckbox::indicator:checked, #showLatestCheckbox::indicator:checked, #hideUnrCheckbox::indicator:checked ,#landRandomDensity::indicator::checked, #plateausRandomDensity::indicator::checked, #mountainsRandomDensity::indicator::checked ,#rampsRandomDensity::indicator::checked, #mexRandomDensity::indicator::checked ,#reclaimRandomDensity::indicator::checked @@ -759,7 +759,7 @@ QToolButton::checked background-color:#C0C0C0; border-radius : 5px; } - + QPushButton#refreshButton, #nextButton, #previousButton, #goToPageButton, #firstButton, #lastButton, #resetButton, #searchPlayerButton, #UIButton, #uploadButton, #kickButton, #leaveButton { diff --git a/res/client/randomcolors.json b/res/client/randomcolors.json index 2bc1c5ffa..aa3f77545 100644 --- a/res/client/randomcolors.json +++ b/res/client/randomcolors.json @@ -1 +1 @@ -["IndianRed","LightCoral","Salmon","DarkSalmon","LightSalmon","Red","FireBrick","DarkRed","Pink","LightPink","HotPink","DeepPink","MediumVioletRed","PaleVioletRed","LightSalmon","Coral","Tomato","Gold","Yellow","LightYellow","LemonChiffon","LightGoldenrodYellow","PapayaWhip","Moccasin","PeachPuff","PaleGoldenrod","Khaki","DarkKhaki","Lavender","Thistle","Plum","Violet","Orchid","Fuchsia","Magenta","MediumOrchid","MediumPurple","Amethyst","BlueViolet","DarkViolet","DarkOrchid","DarkMagenta","Purple","SlateBlue","DarkSlateBlue","MediumSlateBlue","GreenYellow","Chartreuse","LawnGreen","Lime","LimeGreen","PaleGreen","LightGreen","MediumSpringGreen","SpringGreen","MediumSeaGreen","SeaGreen","ForestGreen","Green","DarkGreen","YellowGreen","OliveDrab","Olive","DarkOliveGreen","MediumAquamarine","DarkSeaGreen","LightSeaGreen","DarkCyan","Teal","Aqua","Cyan","LightCyan","PaleTurquoise","Aquamarine","Turquoise","MediumTurquoise","DarkTurquoise","CadetBlue","SteelBlue","LightSteelBlue","PowderBlue","SkyBlue","DeepSkyBlue","DodgerBlue","CornflowerBlue","MediumSlateBlue","RoyalBlue","Blue","MediumBlue"] \ No newline at end of file +["IndianRed","LightCoral","Salmon","DarkSalmon","LightSalmon","Red","FireBrick","DarkRed","Pink","LightPink","HotPink","DeepPink","MediumVioletRed","PaleVioletRed","LightSalmon","Coral","Tomato","Gold","Yellow","LightYellow","LemonChiffon","LightGoldenrodYellow","PapayaWhip","Moccasin","PeachPuff","PaleGoldenrod","Khaki","DarkKhaki","Lavender","Thistle","Plum","Violet","Orchid","Fuchsia","Magenta","MediumOrchid","MediumPurple","Amethyst","BlueViolet","DarkViolet","DarkOrchid","DarkMagenta","Purple","SlateBlue","DarkSlateBlue","MediumSlateBlue","GreenYellow","Chartreuse","LawnGreen","Lime","LimeGreen","PaleGreen","LightGreen","MediumSpringGreen","SpringGreen","MediumSeaGreen","SeaGreen","ForestGreen","Green","DarkGreen","YellowGreen","OliveDrab","Olive","DarkOliveGreen","MediumAquamarine","DarkSeaGreen","LightSeaGreen","DarkCyan","Teal","Aqua","Cyan","LightCyan","PaleTurquoise","Aquamarine","Turquoise","MediumTurquoise","DarkTurquoise","CadetBlue","SteelBlue","LightSteelBlue","PowderBlue","SkyBlue","DeepSkyBlue","DodgerBlue","CornflowerBlue","MediumSlateBlue","RoyalBlue","Blue","MediumBlue"] diff --git a/res/coop/formatters/coop.qthtml b/res/coop/formatters/coop.qthtml index 6507bac61..0979d36c0 100644 --- a/res/coop/formatters/coop.qthtml +++ b/res/coop/formatters/coop.qthtml @@ -9,5 +9,3 @@ - - diff --git a/res/coop/formatters/style.css b/res/coop/formatters/style.css index e3e0eaf57..2384ef4e8 100644 --- a/res/coop/formatters/style.css +++ b/res/coop/formatters/style.css @@ -33,7 +33,7 @@ QTabWidget::pane /* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ -QTabWidget > QTabBar::tab +QTabWidget > QTabBar::tab { background-color:#383838; color: silver; @@ -42,21 +42,21 @@ QTabWidget > QTabBar::tab } -QTabWidget > QTabBar::tab:!selected +QTabWidget > QTabBar::tab:!selected { background-color: #203040; } -QTabWidget > QTabBar::tab:hover +QTabWidget > QTabBar::tab:hover { color:white; background-color: #606060; } -QTabWidget > QTabBar::tab:selected +QTabWidget > QTabBar::tab:selected { color:white; background-color: #303030; @@ -106,4 +106,3 @@ body {background-color: #2f2f2f; overflow: hidden;} .pages .current_page {color: black;} .search_form {float: left;} - diff --git a/res/games/formatters/faf.qthtml b/res/games/formatters/faf.qthtml index 86abafb45..2a479cea5 100644 --- a/res/games/formatters/faf.qthtml +++ b/res/games/formatters/faf.qthtml @@ -15,5 +15,3 @@ - - diff --git a/res/notification_system/dialog.ui b/res/notification_system/dialog.ui index 2419db6ca..e3137df19 100644 --- a/res/notification_system/dialog.ui +++ b/res/notification_system/dialog.ui @@ -15,7 +15,7 @@ QDialog { - + background-color: #272b30; } @@ -56,7 +56,7 @@ QPushButton:hover { background-color: rgba(0,0,0,0); width: 18px; height: 18px; - + } @@ -118,7 +118,7 @@ QPushButton:hover { QLabel { color: rgb(255, 255, 255); font-weight: bold; - font-family: Verdana; + font-family: Verdana; font-size:13pt; } diff --git a/res/stats/formatters/ladder_header.qthtml b/res/stats/formatters/ladder_header.qthtml index 629bebcb3..d1ae729a7 100644 --- a/res/stats/formatters/ladder_header.qthtml +++ b/res/stats/formatters/ladder_header.qthtml @@ -3,4 +3,3 @@ {name} {score} - diff --git a/res/stats/formatters/style.css b/res/stats/formatters/style.css index da0cd6457..27f4ae42d 100644 --- a/res/stats/formatters/style.css +++ b/res/stats/formatters/style.css @@ -14,7 +14,7 @@ QTabWidget::pane } /* Style the tab using the tab sub-control. Note that it reads QTabBar _not_ QTabWidget */ -QTabWidget > QTabBar::tab +QTabWidget > QTabBar::tab { background-color:#383838; color: silver; @@ -27,7 +27,7 @@ QTabWidget > QTabBar::tab:!selected background-color: #203040; } -QTabWidget > QTabBar::tab:hover +QTabWidget > QTabBar::tab:hover { color:white; background-color: #606060; diff --git a/res/tournaments/formatters/open.qthtml b/res/tournaments/formatters/open.qthtml index 529aeea12..27420cddc 100644 --- a/res/tournaments/formatters/open.qthtml +++ b/res/tournaments/formatters/open.qthtml @@ -15,5 +15,3 @@ - - diff --git a/res/tournaments/formatters/style.css b/res/tournaments/formatters/style.css index 22d144b76..50504d6fe 100644 --- a/res/tournaments/formatters/style.css +++ b/res/tournaments/formatters/style.css @@ -13,4 +13,3 @@ QListWidget::item::hover { background-color: #555555; } - diff --git a/res/tutorials/formatters/tutorials.qthtml b/res/tutorials/formatters/tutorials.qthtml index b59a20ae2..92c6fb984 100644 --- a/res/tutorials/formatters/tutorials.qthtml +++ b/res/tutorials/formatters/tutorials.qthtml @@ -11,5 +11,3 @@ - - diff --git a/res/vaults/modvault/comment.qthtml b/res/vaults/modvault/comment.qthtml index 9275af5cf..a4fba559f 100644 --- a/res/vaults/modvault/comment.qthtml +++ b/res/vaults/modvault/comment.qthtml @@ -3,4 +3,4 @@

{text} -

\ No newline at end of file +

diff --git a/res/vaults/modvault/uimod.qthtml b/res/vaults/modvault/uimod.qthtml index 0cf87d963..d5f17b1d7 100644 --- a/res/vaults/modvault/uimod.qthtml +++ b/res/vaults/modvault/uimod.qthtml @@ -3,4 +3,4 @@

{description}

- \ No newline at end of file + diff --git a/runtests.py b/runtests.py index d7338fd39..fc148a245 100644 --- a/runtests.py +++ b/runtests.py @@ -1,7 +1,8 @@ #! /usr/bin/env python3 -import pytest import sys +import pytest + if __name__ == '__main__': sys.exit(pytest.main(sys.argv[1:])) diff --git a/setup.py b/setup.py index 2975380ed..2ac8dbe72 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,10 @@ import os -import sys import site +import sys +from pathlib import Path +import PyQt5.uic import sip -from pathlib import Path sip.setapi('QString', 2) sip.setapi('QVariant', 2) @@ -11,9 +12,8 @@ sip.setapi('QList', 2) sip.setapi('QProcess', 2) -import PyQt5.uic if sys.platform == 'win32': - from cx_Freeze import setup, Executable + from cx_Freeze import Executable, setup else: from distutils.core import setup @@ -169,5 +169,5 @@ def get_jsonschema_includes(): maintainer='Sheeo', url='http://www.faforever.com', license='GNU General Public License, Version 3', - **platform_options + **platform_options, ) diff --git a/src/__main__.py b/src/__main__.py index 6983eb916..412c47d7c 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -10,7 +10,8 @@ # According to PyQt5 docs we need to import QtWebEngineWidgets before we create # QApplication -from PyQt5 import QtWebEngineWidgets, QtWidgets, uic +from PyQt5 import QtWebEngineWidgets # noqa: F401 +from PyQt5 import QtWidgets, uic from PyQt5.QtCore import Qt import util diff --git a/src/api/stats_api.py b/src/api/stats_api.py index fbbf8db26..c7971b0e4 100644 --- a/src/api/stats_api.py +++ b/src/api/stats_api.py @@ -1,5 +1,7 @@ -from .ApiBase import ApiBase import logging + +from .ApiBase import ApiBase + logger = logging.getLogger(__name__) diff --git a/src/chat/__init__.py b/src/chat/__init__.py index ea626ff6f..745895151 100644 --- a/src/chat/__init__.py +++ b/src/chat/__init__.py @@ -3,6 +3,11 @@ from chat.chatlineedit import ChatLineEdit from chat.chatterlistview import ChatterListView +__all__ = ( + "ChatLineEdit", + "ChatterListView", +) + class ChatMVC: def __init__( diff --git a/src/chat/channel_view.py b/src/chat/channel_view.py index 6c7c1cc93..72c0252dc 100644 --- a/src/chat/channel_view.py +++ b/src/chat/channel_view.py @@ -9,9 +9,12 @@ from chat.channel_widget import ChannelWidget from chat.chatter_menu import ChatterMenu from chat.chatter_model import ( - ChatterEventFilter, ChatterFormat, - ChatterItemDelegate, ChatterLayout, - ChatterLayoutElements, ChatterModel, + ChatterEventFilter, + ChatterFormat, + ChatterItemDelegate, + ChatterLayout, + ChatterLayoutElements, + ChatterModel, ChatterSortFilterModel, ) from downloadManager import DownloadRequest diff --git a/src/client/__init__.py b/src/client/__init__.py index 088628823..1cb67b3b6 100644 --- a/src/client/__init__.py +++ b/src/client/__init__.py @@ -5,6 +5,10 @@ from ._clientwindow import ClientWindow +__all__ = ( + "ThemeMenu", +) + logger = logging.getLogger(__name__) instance = ClientWindow() diff --git a/src/client/_clientwindow.py b/src/client/_clientwindow.py index 075fac567..a4d159c7d 100644 --- a/src/client/_clientwindow.py +++ b/src/client/_clientwindow.py @@ -24,25 +24,33 @@ from chat.ircconnection import IrcConnection from chat.language_channel_config import LanguageChannelConfig from chat.line_restorer import ChatLineRestorer -from client.clientstate import ClientState from client.aliasviewer import AliasSearchWindow, AliasWindow from client.chat_config import ChatConfig +from client.clientstate import ClientState from client.connection import ( - ConnectionState, Dispatcher, LobbyInfo, - ServerConnection, ServerReconnecter, + ConnectionState, + Dispatcher, + LobbyInfo, + ServerConnection, + ServerReconnecter, ) from client.gameannouncer import GameAnnouncer from client.login import LoginWidget from client.playercolors import PlayerColors from client.theme_menu import ThemeMenu from client.user import ( - User, UserRelationController, UserRelationModel, - UserRelations, UserRelationTrackers, + User, + UserRelationController, + UserRelationModel, + UserRelations, + UserRelationTrackers, ) from connectivity.ConnectivityDialog import ConnectivityDialog from coop import CoopWidget from downloadManager import ( - MAP_PREVIEW_ROOT, AvatarDownloader, PreviewDownloader, + MAP_PREVIEW_ROOT, + AvatarDownloader, + PreviewDownloader, ) from fa.factions import Factions from fa.game_runner import GameRunner diff --git a/src/client/aliasviewer.py b/src/client/aliasviewer.py index 0cf951202..ebbbb2a8a 100644 --- a/src/client/aliasviewer.py +++ b/src/client/aliasviewer.py @@ -1,7 +1,7 @@ import logging from PyQt5 import QtWidgets -from PyQt5.QtCore import QDateTime, QTimer, Qt +from PyQt5.QtCore import QDateTime, Qt, QTimer from api.player_api import PlayerApiConnector diff --git a/src/coop/__init__.py b/src/coop/__init__.py index a5d3f7d8d..327683cd1 100644 --- a/src/coop/__init__.py +++ b/src/coop/__init__.py @@ -3,4 +3,8 @@ # For use by other modules from ._coopwidget import CoopWidget +__all__ = ( + "CoopWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/fa/__init__.py b/src/fa/__init__.py index 5f7b0d0e9..fbc8b0c23 100644 --- a/src/fa/__init__.py +++ b/src/fa/__init__.py @@ -8,4 +8,17 @@ from .play import run from .replay import replay +__all__ = ( + "check", + "factions", + "maps", + "mods", + "replayserver", + "updater", + "wizards", + "instance", + "run", + "replay", +) + logger = logging.getLogger(__name__) diff --git a/src/fa/game_process.py b/src/fa/game_process.py index b2c00e0ec..e61176586 100644 --- a/src/fa/game_process.py +++ b/src/fa/game_process.py @@ -7,7 +7,6 @@ import config import util - from model.game import GameState logger = logging.getLogger(__name__) diff --git a/src/fa/game_session.py b/src/fa/game_session.py index fe0766a54..9a1a1dec2 100644 --- a/src/fa/game_session.py +++ b/src/fa/game_session.py @@ -5,11 +5,10 @@ import client from config import setup_file_handler -from fa.game_process import instance as game_process_instance - from connectivity.IceAdapterClient import IceAdapterClient from connectivity.IceAdapterProcess import IceAdapterProcess from connectivity.IceServersPoller import IceServersPoller +from fa.game_process import instance as game_process_instance logger = logging.getLogger(__name__) # Log to a separate file to not pollute normal log with huge json dumps diff --git a/src/fa/replayserver.py b/src/fa/replayserver.py index 1eab8e619..8099d3bcb 100644 --- a/src/fa/replayserver.py +++ b/src/fa/replayserver.py @@ -10,7 +10,6 @@ import util from config import Settings - GPGNET_HOST = "lobby.faforever.com" GPGNET_PORT = 8000 diff --git a/src/fa/updater.py b/src/fa/updater.py index 32e9985a0..18982c410 100644 --- a/src/fa/updater.py +++ b/src/fa/updater.py @@ -22,8 +22,8 @@ from PyQt5 import QtCore, QtWidgets import config -import vaults.modvault.modvault import util +import vaults.modvault.modvault from api.featured_mod_updater import FeaturedModFiles, FeaturedModId from api.sim_mod_updater import SimModFiles from config import Settings diff --git a/src/games/__init__.py b/src/games/__init__.py index 44857e9b7..771706343 100644 --- a/src/games/__init__.py +++ b/src/games/__init__.py @@ -3,4 +3,8 @@ # For use by other modules from ._gameswidget import GamesWidget +__all__ = ( + "GamesWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/games/hostgamewidget.py b/src/games/hostgamewidget.py index d0c5dd924..ff54d4fb5 100644 --- a/src/games/hostgamewidget.py +++ b/src/games/hostgamewidget.py @@ -4,8 +4,8 @@ import fa.check import games.mapgenoptionsdialog as MapGenDialog -import vaults.modvault.utils import util +import vaults.modvault.utils from fa import maps from games.gamemodel import GameModel from model.game import Game, GameState, GameVisibility diff --git a/src/model/chat/chat.py b/src/model/chat/chat.py index aa2d824a0..cb839c1db 100644 --- a/src/model/chat/chat.py +++ b/src/model/chat/chat.py @@ -1,7 +1,8 @@ from PyQt5.QtCore import QObject, pyqtSignal from model.chat.channelchatterset import ( - ChannelChatterRelation, ChannelChatterset, + ChannelChatterRelation, + ChannelChatterset, ) from model.chat.channelset import Channelset from model.chat.chatterset import Chatterset diff --git a/src/news/__init__.py b/src/news/__init__.py index 013681a86..fbc0740e2 100644 --- a/src/news/__init__.py +++ b/src/news/__init__.py @@ -2,3 +2,10 @@ from .newsitem import NewsItem from .newsmanager import NewsManager from .wpapi import WPAPI + +__all__ = ( + "NewsWidget", + "NewsItem", + "NewsManager", + "WPAPI", +) diff --git a/src/news/wpapi.py b/src/news/wpapi.py index 45d994830..b05c3aa2a 100644 --- a/src/news/wpapi.py +++ b/src/news/wpapi.py @@ -3,7 +3,9 @@ from PyQt5 import QtCore from PyQt5.QtNetwork import ( - QNetworkAccessManager, QNetworkReply, QNetworkRequest, + QNetworkAccessManager, + QNetworkReply, + QNetworkRequest, ) from config import Settings diff --git a/src/notifications/__init__.py b/src/notifications/__init__.py index 95559cd0d..718ff90f6 100644 --- a/src/notifications/__init__.py +++ b/src/notifications/__init__.py @@ -1,3 +1,7 @@ +""" +The Notification Systems reacts on events and displays a popup. +Each event_type has a NsHook to customize it. +""" from PyQt5 import QtCore import util @@ -6,11 +10,6 @@ from notifications.ns_dialog import NotificationDialog from notifications.ns_settings import IngameNotification, NsSettingsDialog -""" -The Notification Systems reacts on events and displays a popup. -Each event_type has a NsHook to customize it. -""" - class Notifications: USER_ONLINE = 'user_online' diff --git a/src/notifications/hook_gamefull.py b/src/notifications/hook_gamefull.py index 0675c8aa7..845f7a194 100644 --- a/src/notifications/hook_gamefull.py +++ b/src/notifications/hook_gamefull.py @@ -1,9 +1,8 @@ -import notifications as ns -from notifications.ns_hook import NsHook - """ Settings for notifications: If a game is full """ +import notifications as ns +from notifications.ns_hook import NsHook class NsHookGameFull(NsHook): diff --git a/src/notifications/hook_newgame.py b/src/notifications/hook_newgame.py index 7b37c6d2e..8452f10eb 100644 --- a/src/notifications/hook_newgame.py +++ b/src/notifications/hook_newgame.py @@ -1,3 +1,6 @@ +""" +Settings for notifications: if a new game is hosted. +""" from PyQt5 import QtCore import config @@ -6,10 +9,6 @@ from config import Settings from notifications.ns_hook import NsHook -""" -Settings for notifications: if a new game is hosted. -""" - class NsHookNewGame(NsHook): def __init__(self): diff --git a/src/notifications/hook_partyinvite.py b/src/notifications/hook_partyinvite.py index ab418dcb0..e0d115261 100644 --- a/src/notifications/hook_partyinvite.py +++ b/src/notifications/hook_partyinvite.py @@ -1,3 +1,6 @@ +""" +Settings for notifications: if a player comes online +""" from PyQt5 import QtCore import notifications as ns @@ -5,10 +8,6 @@ from config import Settings from notifications.ns_hook import NsHook -""" -Settings for notifications: if a player comes online -""" - class NsHookPartyInvite(NsHook): def __init__(self): diff --git a/src/notifications/hook_useronline.py b/src/notifications/hook_useronline.py index 495dcd3e9..41eddea6a 100644 --- a/src/notifications/hook_useronline.py +++ b/src/notifications/hook_useronline.py @@ -1,3 +1,6 @@ +""" +Settings for notifications: if a player comes online +""" from PyQt5 import QtCore import notifications as ns @@ -5,10 +8,6 @@ from config import Settings from notifications.ns_hook import NsHook -""" -Settings for notifications: if a player comes online -""" - class NsHookUserOnline(NsHook): def __init__(self): diff --git a/src/notifications/ns_dialog.py b/src/notifications/ns_dialog.py index 264d76003..b25bcae9b 100644 --- a/src/notifications/ns_dialog.py +++ b/src/notifications/ns_dialog.py @@ -1,3 +1,6 @@ +""" +The UI popup of the notification system +""" import time from PyQt5 import QtCore, QtWidgets @@ -6,9 +9,6 @@ from .ns_settings import NotificationPosition -""" -The UI popup of the notification system -""" FormClass, BaseClass = util.THEME.loadUiType("notification_system/dialog.ui") diff --git a/src/notifications/ns_hook.py b/src/notifications/ns_hook.py index 5bc7c6611..3bca343f4 100644 --- a/src/notifications/ns_hook.py +++ b/src/notifications/ns_hook.py @@ -1,7 +1,3 @@ -from PyQt5 import QtWidgets - -from config import Settings - """ Setting Model class. All Event Types (Notifications) are customizable. @@ -11,6 +7,9 @@ self.button.clicked.connect(self.dialog.show) """ +from PyQt5 import QtWidgets + +from config import Settings class NsHook(): diff --git a/src/notifications/ns_settings.py b/src/notifications/ns_settings.py index e9fddcfd9..d0683cd22 100644 --- a/src/notifications/ns_settings.py +++ b/src/notifications/ns_settings.py @@ -1,3 +1,7 @@ +""" +The UI of the Notification System Settings Frame. +Each module/hook for the notification system must be registered here. +""" from enum import Enum from PyQt5 import QtCore, QtWidgets @@ -10,11 +14,6 @@ from notifications.hook_partyinvite import NsHookPartyInvite from notifications.hook_useronline import NsHookUserOnline -""" -The UI of the Notification System Settings Frame. -Each module/hook for the notification system must be registered here. -""" - class IngameNotification(Enum): ENABLE = 0 @@ -147,13 +146,12 @@ def getCustomSetting(self, eventType, key): return None -""" -Model Class for notification type table. -Needs an NsHook. -""" - - class NotificationHooks(QtCore.QAbstractTableModel): + """ + Model Class for notification type table. + Needs an NsHook. + """ + POPUP = 1 SOUND = 2 SETTINGS = 3 diff --git a/src/replays/__init__.py b/src/replays/__init__.py index 04421942d..a9a26303b 100644 --- a/src/replays/__init__.py +++ b/src/replays/__init__.py @@ -3,4 +3,8 @@ from ._replayswidget import ReplaysWidget +__all__ = ( + "ReplaysWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/replays/_replayswidget.py b/src/replays/_replayswidget.py index 10ba5e6d0..c08b6b5c5 100644 --- a/src/replays/_replayswidget.py +++ b/src/replays/_replayswidget.py @@ -6,7 +6,9 @@ import jsonschema from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtNetwork import ( - QNetworkAccessManager, QNetworkReply, QNetworkRequest, + QNetworkAccessManager, + QNetworkReply, + QNetworkRequest, ) import client diff --git a/src/secondaryServer/__init__.py b/src/secondaryServer/__init__.py index 108b24a31..3996427ad 100644 --- a/src/secondaryServer/__init__.py +++ b/src/secondaryServer/__init__.py @@ -1 +1,5 @@ from .secondaryserver import SecondaryServer + +__all__ = ( + "SecondaryServer", +) diff --git a/src/stats/__init__.py b/src/stats/__init__.py index db7e95100..d20f230c7 100644 --- a/src/stats/__init__.py +++ b/src/stats/__init__.py @@ -6,4 +6,10 @@ from ._statswidget import StatsWidget +__all__ = ( + "LeaderboardTableView", + "LeaderboardLineEdit", + "StatsWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/tourneys/__init__.py b/src/tourneys/__init__.py index 511a79fac..6ed377d0b 100644 --- a/src/tourneys/__init__.py +++ b/src/tourneys/__init__.py @@ -2,4 +2,8 @@ from ._tournamentswidget import TournamentsWidget +__all__ = ( + "TournamentsWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/tutorials/__init__.py b/src/tutorials/__init__.py index c54f5a00f..d494ff256 100644 --- a/src/tutorials/__init__.py +++ b/src/tutorials/__init__.py @@ -3,4 +3,8 @@ from ._tutorialswidget import TutorialsWidget +__all__ = ( + "TutorialsWidget", +) + logger = logging.getLogger(__name__) diff --git a/src/tutorials/_tutorialswidget.py b/src/tutorials/_tutorialswidget.py index ed290ade5..166779875 100644 --- a/src/tutorials/_tutorialswidget.py +++ b/src/tutorials/_tutorialswidget.py @@ -3,7 +3,9 @@ from PyQt5 import QtCore, QtWidgets from PyQt5.QtNetwork import ( - QNetworkAccessManager, QNetworkReply, QNetworkRequest, + QNetworkAccessManager, + QNetworkReply, + QNetworkRequest, ) import fa diff --git a/src/util/__init__.py b/src/util/__init__.py index 357dcf19f..5cd10fd67 100644 --- a/src/util/__init__.py +++ b/src/util/__init__.py @@ -277,7 +277,6 @@ def clearDirectory(directory, confirm=True): def _setup_theme(): global THEME - global VERSION_STRING default = Theme(COMMON_DIR, None) themes = [] diff --git a/src/vaults/mapvault/mapvault.py b/src/vaults/mapvault/mapvault.py index ce9812b79..c80df7ae4 100644 --- a/src/vaults/mapvault/mapvault.py +++ b/src/vaults/mapvault/mapvault.py @@ -13,8 +13,7 @@ from fa import maps from mapGenerator import mapgenUtils from vaults import luaparser -from vaults.vault import Vault -from vaults.vault import VaultItem +from vaults.vault import Vault, VaultItem from .mapwidget import MapWidget diff --git a/src/vaults/modvault/modvault.py b/src/vaults/modvault/modvault.py index ef7642cf9..537ada936 100644 --- a/src/vaults/modvault/modvault.py +++ b/src/vaults/modvault/modvault.py @@ -49,15 +49,12 @@ import util from api.vaults_api import ModApiConnector from vaults.modvault import utils +from vaults.vault import Vault, VaultItem from .modwidget import ModWidget from .uimodwidget import UIModWidget from .uploadwidget import UploadModWidget -from vaults.vault import Vault -from vaults.vault import VaultItem - - logger = logging.getLogger(__name__) diff --git a/tests/fa/test_featured.py b/tests/fa/test_featured.py index c372520c6..5bb166e25 100644 --- a/tests/fa/test_featured.py +++ b/tests/fa/test_featured.py @@ -1,10 +1,12 @@ __author__ = 'Thygrrr' -from fa import updater -from PyQt5 import QtWidgets, QtCore -import pytest import collections +import pytest +from PyQt5 import QtCore, QtWidgets + +from fa import updater + class _TestObjectWithoutIsFinished(QtCore.QObject): finished = QtCore.pyqtSignal() @@ -69,7 +71,7 @@ def test_updater_add_watch_raises_error_on_watch_without_signal_finished( updater.UpdaterProgressDialog(None).addWatch(QtCore.QObject()) -def test_updater_watch_finished_raises_error_on_watch_without_method_is_finished( +def test_updater_watch_finished_raises_error_on_watch_without_method_finished( application, ): u = updater.UpdaterProgressDialog(None) diff --git a/tests/fa/test_updater.py b/tests/fa/test_updater.py index 95c935d93..7c6822dd8 100644 --- a/tests/fa/test_updater.py +++ b/tests/fa/test_updater.py @@ -1,10 +1,12 @@ __author__ = 'Thygrrr' -from fa import updater -from PyQt5 import QtWidgets, QtCore -import pytest import collections +import pytest +from PyQt5 import QtCore, QtWidgets + +from fa import updater + class NoIsFinished(QtCore.QObject): finished = QtCore.pyqtSignal() @@ -69,7 +71,7 @@ def test_updater_add_watch_raises_error_on_watch_without_signal_finished( updater.UpdaterProgressDialog(None).addWatch(QtCore.QObject()) -def test_updater_watch_finished_raises_error_on_watch_without_method_is_finished( +def test_updater_watch_finished_raises_error_on_watch_without_method_finished( application, ): u = updater.UpdaterProgressDialog(None) diff --git a/tests/integration_tests/model/test_player_game.py b/tests/integration_tests/model/test_player_game.py index debaa82dc..2f1206ac8 100644 --- a/tests/integration_tests/model/test_player_game.py +++ b/tests/integration_tests/model/test_player_game.py @@ -2,8 +2,8 @@ from model.game import Game, GameState, GameVisibility from model.gameset import Gameset, PlayerGameIndex -from model.playerset import Playerset from model.player import Player +from model.playerset import Playerset GAME_DICT = { "uid": 1, @@ -66,7 +66,7 @@ def test_setup(): def test_player_at_game_change(mocker): ps = Playerset() gs = Gameset(ps) - pgr = PlayerGameIndex(gs, ps) + pgr = PlayerGameIndex(gs, ps) # noqa: F841 p = Player(**{"id_": 1, "login": "Guy"}) ps[p.id] = p @@ -126,7 +126,7 @@ def test_player_at_another_game(mocker): def test_game_at_missing_player(mocker): ps = Playerset() gs = Gameset(ps) - pgr = PlayerGameIndex(gs, ps) + pgr = PlayerGameIndex(gs, ps) # noqa: F841 p = Player(**{"id_": 1, "login": "Guy"}) ps[p.id] = p diff --git a/tests/integration_tests/model/test_player_ircuser.py b/tests/integration_tests/model/test_player_ircuser.py index 2bc7933d1..222495747 100644 --- a/tests/integration_tests/model/test_player_ircuser.py +++ b/tests/integration_tests/model/test_player_ircuser.py @@ -2,8 +2,8 @@ from model.ircuser import IrcUser from model.ircuserset import IrcUserset -from model.playerset import Playerset from model.player import Player +from model.playerset import Playerset def test_player_change(mocker): diff --git a/tests/unit_tests/client/test_gameurl.py b/tests/unit_tests/client/test_gameurl.py index 0d9b3f129..5df77e797 100644 --- a/tests/unit_tests/client/test_gameurl.py +++ b/tests/unit_tests/client/test_gameurl.py @@ -1,4 +1,5 @@ import pytest + from util.gameurl import GameUrl, GameUrlType # NOTE - any time url format gets updated, fix below URLs to be correct diff --git a/tests/unit_tests/client/test_mouse_position.py b/tests/unit_tests/client/test_mouse_position.py index fbcc81414..e79902b02 100644 --- a/tests/unit_tests/client/test_mouse_position.py +++ b/tests/unit_tests/client/test_mouse_position.py @@ -1,5 +1,4 @@ import pytest - from PyQt5.QtCore import QPoint diff --git a/tests/unit_tests/client/test_updating.py b/tests/unit_tests/client/test_updating.py index df917142a..166a40f9b 100644 --- a/tests/unit_tests/client/test_updating.py +++ b/tests/unit_tests/client/test_updating.py @@ -1,6 +1,5 @@ import pytest - -from PyQt5 import QtWebEngineWidgets +from PyQt5 import QtWebEngineWidgets # noqa: F401 import config diff --git a/tests/unit_tests/model/chat/test_channel.py b/tests/unit_tests/model/chat/test_channel.py index 52e73936e..150c6cf20 100644 --- a/tests/unit_tests/model/chat/test_channel.py +++ b/tests/unit_tests/model/chat/test_channel.py @@ -1,4 +1,5 @@ import pytest + from model.chat.channel import Channel, ChannelID, ChannelType diff --git a/tests/unit_tests/model/chat/test_channelchatter.py b/tests/unit_tests/model/chat/test_channelchatter.py index 959a6f10a..2223b2002 100644 --- a/tests/unit_tests/model/chat/test_channelchatter.py +++ b/tests/unit_tests/model/chat/test_channelchatter.py @@ -1,4 +1,5 @@ import pytest + from model.chat.channelchatter import ChannelChatter diff --git a/tests/unit_tests/model/chat/test_channelset.py b/tests/unit_tests/model/chat/test_channelset.py index 38a115c55..56122c8be 100644 --- a/tests/unit_tests/model/chat/test_channelset.py +++ b/tests/unit_tests/model/chat/test_channelset.py @@ -1,7 +1,7 @@ import pytest -from model.chat.channelset import Channelset from model.chat.channel import ChannelID, ChannelType +from model.chat.channelset import Channelset class MockChannels(): diff --git a/tests/unit_tests/model/chat/test_lines.py b/tests/unit_tests/model/chat/test_lines.py index 336907d27..78a6e70f5 100644 --- a/tests/unit_tests/model/chat/test_lines.py +++ b/tests/unit_tests/model/chat/test_lines.py @@ -1,4 +1,5 @@ import pytest + from model.chat.channel import Lines diff --git a/tests/unit_tests/model/test_game.py b/tests/unit_tests/model/test_game.py index 300f1c9e6..e13d23742 100644 --- a/tests/unit_tests/model/test_game.py +++ b/tests/unit_tests/model/test_game.py @@ -1,6 +1,7 @@ -import pytest import copy +import pytest + from model import game DEFAULT_DICT = { diff --git a/tests/unit_tests/model/test_gameset.py b/tests/unit_tests/model/test_gameset.py index ef6cda755..19f18be43 100644 --- a/tests/unit_tests/model/test_gameset.py +++ b/tests/unit_tests/model/test_gameset.py @@ -1,7 +1,8 @@ -import pytest import copy -from model import gameset, game +import pytest + +from model import game, gameset DEFAULT_DICT = { "uid": 1,