mypy: Use class-based API for enum.IntEnum
See https://github.com/python/mypy/issues/4865
This commit is contained in:
parent
563e1e8294
commit
a1e83f0773
@ -40,7 +40,11 @@ from qutebrowser.utils import (usertypes, standarddir, utils, message, log,
|
||||
from qutebrowser.qt import sip
|
||||
|
||||
|
||||
ModelRole = enum.IntEnum('ModelRole', ['item'], start=Qt.UserRole)
|
||||
class ModelRole(enum.IntEnum):
|
||||
|
||||
"""Custom download model roles."""
|
||||
|
||||
item = Qt.UserRole
|
||||
|
||||
|
||||
# Remember the last used directory
|
||||
|
@ -37,8 +37,11 @@ from qutebrowser.misc import objects
|
||||
from qutebrowser.browser import browsertab
|
||||
|
||||
|
||||
PixelMetrics = enum.IntEnum('PixelMetrics', ['icon_padding'],
|
||||
start=QStyle.PM_CustomBase)
|
||||
class PixelMetrics(enum.IntEnum):
|
||||
|
||||
"""Custom PixelMetrics attributes."""
|
||||
|
||||
icon_padding = QStyle.PM_CustomBase
|
||||
|
||||
|
||||
class TabWidget(QTabWidget):
|
||||
|
@ -38,10 +38,14 @@ from qutebrowser.utils import usertypes, objreg, version, qtutils, log, utils
|
||||
from qutebrowser.misc import objects, msgbox
|
||||
|
||||
|
||||
_Result = enum.IntEnum(
|
||||
'_Result',
|
||||
['quit', 'restart', 'restart_webkit', 'restart_webengine'],
|
||||
start=QDialog.Accepted + 1)
|
||||
class _Result(enum.IntEnum):
|
||||
|
||||
"""The result code returned by the backend problem dialog."""
|
||||
|
||||
quit = QDialog.Accepted + 1
|
||||
restart = QDialog.Accepted + 2
|
||||
restart_webkit = QDialog.Accepted + 3
|
||||
restart_webengine = QDialog.Accepted + 4
|
||||
|
||||
|
||||
@attr.s
|
||||
|
@ -42,8 +42,12 @@ from qutebrowser.misc import (miscwidgets, autoupdate, msgbox, httpclient,
|
||||
from qutebrowser.config import config, configfiles
|
||||
|
||||
|
||||
Result = enum.IntEnum('Result', ['restore', 'no_restore'],
|
||||
start=QDialog.Accepted + 1)
|
||||
class Result(enum.IntEnum):
|
||||
|
||||
"""The result code returned by the crash dialog."""
|
||||
|
||||
restore = QDialog.Accepted + 1
|
||||
no_restore = QDialog.Accepted + 2
|
||||
|
||||
|
||||
def parse_fatal_stacktrace(text):
|
||||
|
@ -221,10 +221,17 @@ KeyMode = enum.Enum('KeyMode', ['normal', 'hint', 'command', 'yesno', 'prompt',
|
||||
'jump_mark', 'record_macro', 'run_macro'])
|
||||
|
||||
|
||||
# Exit statuses for errors. Needs to be an int for sys.exit.
|
||||
Exit = enum.IntEnum('Exit', ['ok', 'reserved', 'exception', 'err_ipc',
|
||||
'err_init', 'err_config', 'err_key_config'],
|
||||
start=0)
|
||||
class Exit(enum.IntEnum):
|
||||
|
||||
"""Exit statuses for errors. Needs to be an int for sys.exit."""
|
||||
|
||||
ok = 0
|
||||
reserved = 1
|
||||
exception = 2
|
||||
err_ipc = 3
|
||||
err_init = 4
|
||||
err_config = 5
|
||||
err_key_config = 6
|
||||
|
||||
|
||||
# Load status of a tab
|
||||
|
Loading…
Reference in New Issue
Block a user