python fixed mypy errors

This commit is contained in:
Wiktor Mazur
2020-03-17 18:23:11 +01:00
parent a0bb3ac1fb
commit de68e5a57c
16 changed files with 58 additions and 64 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
try:
import aostats
import aostats # type: ignore
except:
class aostats:
class aostats: # type: ignore
@staticmethod
def initialize(_):
return InitializationResult.NetworkInterfaceListMissing
+1 -1
View File
@@ -127,7 +127,7 @@ class GameStats():
game_stats = GameStats()
event_queue = Queue()
event_queue : Queue = Queue()
class FameStat:
+1 -1
View File
@@ -20,4 +20,4 @@ if TEST_ENV_ENABLED:
raise Exception('Unavailable GUI test type, avaliable values: {}'.format(
','.join(_test_types.keys())))
TEST_TYPE = _test_types[os.getenv('TESTING').lower()]
TEST_TYPE = _test_types[test_type.lower()]
+7 -6
View File
@@ -1,3 +1,10 @@
import os
import sys
from PySide2.QtCore import Qt # type: ignore
from PySide2.QtWidgets import QApplication # type: ignore
from PySide2.QtWidgets import QMessageBox # type: ignore
from ..engine import InitializationResult
from ..engine import initialize
from ..utils.config import config
@@ -7,12 +14,6 @@ from .styling import style
from ..utils.version import current_version as get_current_version
from ..utils.version import latest_url
from ..utils.version import latest_version as get_latest_version
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QApplication
from PySide2.QtWidgets import QMessageBox
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath('__file__')))
+1 -1
View File
@@ -1,4 +1,4 @@
from PySide2.QtWidgets import QMessageBox
from PySide2.QtWidgets import QMessageBox # type: ignore
text = """
+8 -8
View File
@@ -1,14 +1,14 @@
import sys
import functools
from PySide2 import QtGui
from PySide2.QtCore import Qt
from PySide2.QtCore import QTimer
from PySide2.QtWidgets import QComboBox
from PySide2.QtWidgets import QHBoxLayout
from PySide2.QtWidgets import QPushButton
from PySide2.QtWidgets import QVBoxLayout
from PySide2.QtWidgets import QWidget
from PySide2 import QtGui # type: ignore
from PySide2.QtCore import Qt # type: ignore
from PySide2.QtCore import QTimer # type: ignore
from PySide2.QtWidgets import QComboBox # type: ignore
from PySide2.QtWidgets import QHBoxLayout # type: ignore
from PySide2.QtWidgets import QPushButton # type: ignore
from PySide2.QtWidgets import QVBoxLayout # type: ignore
from PySide2.QtWidgets import QWidget # type: ignore
from ... import engine
@@ -1,6 +1,6 @@
from PySide2.QtWidgets import QPushButton
from PySide2 import QtGui
from PySide2.QtWidgets import QPushButton # type: ignore
from PySide2 import QtGui # type: ignore
from ....utils import assets
from ....stats.list_item import PlayerListItem
@@ -1 +1 @@
from .list import List as List
from .list import ListItemView
@@ -3,22 +3,22 @@ import collections
import functools
import re
from typing import List
from PIL import Image, ImageQt
from PIL import Image, ImageQt # type: ignore
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2.QtCore import Qt
from PySide2.QtGui import QStandardItem
from PySide2.QtGui import QStandardItemModel
from PySide2.QtWidgets import QApplication
from PySide2.QtWidgets import QComboBox
from PySide2.QtWidgets import QHBoxLayout
from PySide2.QtWidgets import QLabel
from PySide2.QtWidgets import QListView
from PySide2.QtWidgets import QMessageBox
from PySide2.QtWidgets import QProgressBar
from PySide2.QtWidgets import QPushButton
from PySide2.QtWidgets import QVBoxLayout
from PySide2 import QtCore # type: ignore
from PySide2 import QtGui # type: ignore
from PySide2.QtCore import Qt # type: ignore
from PySide2.QtGui import QStandardItem # type: ignore
from PySide2.QtGui import QStandardItemModel # type: ignore
from PySide2.QtWidgets import QApplication # type: ignore
from PySide2.QtWidgets import QComboBox # type: ignore
from PySide2.QtWidgets import QHBoxLayout # type: ignore
from PySide2.QtWidgets import QLabel # type: ignore
from PySide2.QtWidgets import QListView # type: ignore
from PySide2.QtWidgets import QMessageBox # type: ignore
from PySide2.QtWidgets import QProgressBar # type: ignore
from PySide2.QtWidgets import QPushButton # type: ignore
from PySide2.QtWidgets import QVBoxLayout # type: ignore
from .....stats.list_item import PlayerListItem
from .....utils import assets
@@ -91,7 +91,7 @@ def player_icon(weapon):
return None
class List(QListView):
class ListItemView(QListView):
class Item(QtGui.QStandardItem):
def __init__(self, player, parent):
QtGui.QStandardItem .__init__(self)
@@ -3,22 +3,14 @@
from typing import Callable
from PySide2.QtWidgets import QHBoxLayout
# from PySide2.QtWidgets import QPushButton
from PySide2.QtWidgets import QVBoxLayout
# from PySide2.QtWidgets import QLabel
# from PySide2 import QtGui
# from PySide2 import QtCore
from PySide2.QtWidgets import QComboBox
from PySide2.QtWidgets import QWidget
from PySide2.QtWidgets import QHBoxLayout # type: ignore
from PySide2.QtWidgets import QVBoxLayout # type: ignore
from PySide2.QtWidgets import QComboBox # type: ignore
from PySide2.QtWidgets import QWidget # type: ignore
from ....stats.list_item import PlayerListItem
from .list_view import List
from .list_view import ListItemView
from .stats_type import StatsType
from .player_stats import PlayerStats
from .copy_button import CopyButton
@@ -68,7 +60,7 @@ class ModeBasedListView(QWidget):
self.session_bar = SessionBar(clipboard)
self.layout.addWidget(self.session_bar)
self.list_view = List()
self.list_view = ListItemView()
self.layout.addWidget(self.list_view)
self.setLayout(self.layout)
@@ -1,8 +1,8 @@
import datetime
from PySide2.QtWidgets import QLabel
from PySide2 import QtGui
from PySide2 import QtCore
from PySide2.QtWidgets import QLabel # type: ignore
from PySide2 import QtGui # type: ignore
from PySide2 import QtCore # type: ignore
from src.utils import assets, number
from src.stats.list_item import PlayerListItem
@@ -1,8 +1,8 @@
from typing import Callable
from PySide2.QtWidgets import QPushButton
from PySide2 import QtGui
from PySide2.QtWidgets import QPushButton # type: ignore
from PySide2 import QtGui # type: ignore
from ....utils import assets
from ....stats.list_item import PlayerListItem
+1 -1
View File
@@ -30,7 +30,7 @@ class Player(Stats):
items: dict = field(default_factory=lambda: {'weapon': None})
damage_done: float = 0.0
combat_time: CombatTime = field(default_factory=lambda: CombatTime())
combat_state: CombatState = CombatState.OutOfCombat
combat_state: int = CombatState.OutOfCombat
@staticmethod
def new(self):
+4 -4
View File
@@ -13,11 +13,11 @@ class FameStats(FameEventReceiver, Stats):
return FameStats()
@classmethod
def from_other(other: Stats):
return FameStats(fame=other.fame)
def from_other(other: Stats): # type: ignore
return FameStats(fame=other.fame) # type: ignore
def update(self, other: Stats):
self.fame += other.fame
def update(self, other: Stats): # type: ignore
self.fame += other.fame # type: ignore
def on_fame_update(self, value: float):
self.fame += value
+2 -2
View File
@@ -7,9 +7,9 @@ import collections
Item = collections.namedtuple('Item', 'key value')
_queue = queue.Queue()
_queue : queue.Queue = queue.Queue()
_requests = {}
_requests_threads = {}
_requests_threads : dict = {}
def update_loop():