Add explicit types to frontend classes.
This commit is contained in:
parent
3863b9f048
commit
b3b6ae7eaf
@ -12,7 +12,7 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class BishiBashiFrontend(FrontendBase):
|
class BishiBashiFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.BISHI_BASHI
|
game: GameConstants = GameConstants.BISHI_BASHI
|
||||||
|
|
||||||
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
|
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
|
||||||
super().__init__(data, config, cache)
|
super().__init__(data, config, cache)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
import copy
|
import copy
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from bemani.backend.ddr import DDRFactory, DDRBase
|
from bemani.backend.ddr import DDRFactory, DDRBase
|
||||||
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
||||||
@ -10,11 +10,11 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class DDRFrontend(FrontendBase):
|
class DDRFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.DDR
|
game: GameConstants = GameConstants.DDR
|
||||||
|
|
||||||
version = 0 # We use a virtual version for DDR to tie charts together
|
version: int = 0 # We use a virtual version for DDR to tie charts together
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
DDRBase.CHART_SINGLE_BEGINNER,
|
DDRBase.CHART_SINGLE_BEGINNER,
|
||||||
DDRBase.CHART_SINGLE_BASIC,
|
DDRBase.CHART_SINGLE_BASIC,
|
||||||
DDRBase.CHART_SINGLE_DIFFICULT,
|
DDRBase.CHART_SINGLE_DIFFICULT,
|
||||||
@ -26,9 +26,9 @@ class DDRFrontend(FrontendBase):
|
|||||||
DDRBase.CHART_DOUBLE_CHALLENGE,
|
DDRBase.CHART_DOUBLE_CHALLENGE,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = [f'friend_{i}' for i in range(10)]
|
valid_rival_types: List[str] = [f'friend_{i}' for i in range(10)]
|
||||||
|
|
||||||
max_active_rivals = {
|
max_active_rivals: Dict[int, int] = {
|
||||||
VersionConstants.DDR_X2: 1,
|
VersionConstants.DDR_X2: 1,
|
||||||
VersionConstants.DDR_X3_VS_2NDMIX: 3,
|
VersionConstants.DDR_X3_VS_2NDMIX: 3,
|
||||||
VersionConstants.DDR_2013: 3,
|
VersionConstants.DDR_2013: 3,
|
||||||
|
@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class IIDXFrontend(FrontendBase):
|
class IIDXFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.IIDX
|
game: GameConstants = GameConstants.IIDX
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
IIDXBase.CHART_TYPE_N7,
|
IIDXBase.CHART_TYPE_N7,
|
||||||
IIDXBase.CHART_TYPE_H7,
|
IIDXBase.CHART_TYPE_H7,
|
||||||
IIDXBase.CHART_TYPE_A7,
|
IIDXBase.CHART_TYPE_A7,
|
||||||
@ -22,7 +22,7 @@ class IIDXFrontend(FrontendBase):
|
|||||||
IIDXBase.CHART_TYPE_A14,
|
IIDXBase.CHART_TYPE_A14,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = [
|
valid_rival_types: List[str] = [
|
||||||
'sp_rival',
|
'sp_rival',
|
||||||
'dp_rival',
|
'dp_rival',
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from bemani.backend.jubeat import JubeatFactory, JubeatBase
|
from bemani.backend.jubeat import JubeatFactory, JubeatBase
|
||||||
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
||||||
@ -9,15 +9,15 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class JubeatFrontend(FrontendBase):
|
class JubeatFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.JUBEAT
|
game: GameConstants = GameConstants.JUBEAT
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
JubeatBase.CHART_TYPE_BASIC,
|
JubeatBase.CHART_TYPE_BASIC,
|
||||||
JubeatBase.CHART_TYPE_ADVANCED,
|
JubeatBase.CHART_TYPE_ADVANCED,
|
||||||
JubeatBase.CHART_TYPE_EXTREME,
|
JubeatBase.CHART_TYPE_EXTREME,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = ['rival']
|
valid_rival_types: List[str] = ['rival']
|
||||||
|
|
||||||
def all_games(self) -> Iterator[Tuple[GameConstants, int, str]]:
|
def all_games(self) -> Iterator[Tuple[GameConstants, int, str]]:
|
||||||
yield from JubeatFactory.all_games()
|
yield from JubeatFactory.all_games()
|
||||||
|
@ -12,7 +12,7 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class MetalGearArcadeFrontend(FrontendBase):
|
class MetalGearArcadeFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.MGA
|
game: GameConstants = GameConstants.MGA
|
||||||
|
|
||||||
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
|
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
|
||||||
super().__init__(data, config, cache)
|
super().__init__(data, config, cache)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from flask_caching import Cache # type: ignore
|
from flask_caching import Cache # type: ignore
|
||||||
|
|
||||||
@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class MusecaFrontend(FrontendBase):
|
class MusecaFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.MUSECA
|
game: GameConstants = GameConstants.MUSECA
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
MusecaBase.CHART_TYPE_GREEN,
|
MusecaBase.CHART_TYPE_GREEN,
|
||||||
MusecaBase.CHART_TYPE_ORANGE,
|
MusecaBase.CHART_TYPE_ORANGE,
|
||||||
MusecaBase.CHART_TYPE_RED,
|
MusecaBase.CHART_TYPE_RED,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from bemani.backend.popn import PopnMusicFactory, PopnMusicBase
|
from bemani.backend.popn import PopnMusicFactory, PopnMusicBase
|
||||||
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
from bemani.common import Profile, ValidatedDict, GameConstants, VersionConstants
|
||||||
@ -9,18 +9,18 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class PopnMusicFrontend(FrontendBase):
|
class PopnMusicFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.POPN_MUSIC
|
game: GameConstants = GameConstants.POPN_MUSIC
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
PopnMusicBase.CHART_TYPE_EASY,
|
PopnMusicBase.CHART_TYPE_EASY,
|
||||||
PopnMusicBase.CHART_TYPE_NORMAL,
|
PopnMusicBase.CHART_TYPE_NORMAL,
|
||||||
PopnMusicBase.CHART_TYPE_HYPER,
|
PopnMusicBase.CHART_TYPE_HYPER,
|
||||||
PopnMusicBase.CHART_TYPE_EX,
|
PopnMusicBase.CHART_TYPE_EX,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = ['rival']
|
valid_rival_types: List[str] = ['rival']
|
||||||
|
|
||||||
max_active_rivals = {
|
max_active_rivals: Dict[int, int] = {
|
||||||
# Technically there is support for Rivals in Tune Street but I
|
# Technically there is support for Rivals in Tune Street but I
|
||||||
# couldn't get it booting anymore to test.
|
# couldn't get it booting anymore to test.
|
||||||
VersionConstants.POPN_MUSIC_TUNE_STREET: 0,
|
VersionConstants.POPN_MUSIC_TUNE_STREET: 0,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
import re
|
import re
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict, List
|
||||||
|
from typing_extensions import Final
|
||||||
from flask import Blueprint, request, Response, url_for, abort
|
from flask import Blueprint, request, Response, url_for, abort
|
||||||
|
|
||||||
from bemani.common import ID, GameConstants
|
from bemani.common import ID, GameConstants
|
||||||
@ -20,7 +21,7 @@ reflec_pages = Blueprint(
|
|||||||
static_folder=static_location,
|
static_folder=static_location,
|
||||||
)
|
)
|
||||||
|
|
||||||
NO_RIVAL_SUPPORT = [1]
|
NO_RIVAL_SUPPORT: Final[List[int]] = [1]
|
||||||
|
|
||||||
|
|
||||||
@reflec_pages.route('/scores')
|
@reflec_pages.route('/scores')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from flask_caching import Cache # type: ignore
|
from flask_caching import Cache # type: ignore
|
||||||
|
|
||||||
@ -11,18 +11,18 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class ReflecBeatFrontend(FrontendBase):
|
class ReflecBeatFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.REFLEC_BEAT
|
game: GameConstants = GameConstants.REFLEC_BEAT
|
||||||
|
|
||||||
version = 0 # We use a virtual version for ReflecBeat to tie charts together
|
version: int = 0 # We use a virtual version for ReflecBeat to tie charts together
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
ReflecBeatBase.CHART_TYPE_BASIC,
|
ReflecBeatBase.CHART_TYPE_BASIC,
|
||||||
ReflecBeatBase.CHART_TYPE_MEDIUM,
|
ReflecBeatBase.CHART_TYPE_MEDIUM,
|
||||||
ReflecBeatBase.CHART_TYPE_HARD,
|
ReflecBeatBase.CHART_TYPE_HARD,
|
||||||
ReflecBeatBase.CHART_TYPE_SPECIAL,
|
ReflecBeatBase.CHART_TYPE_SPECIAL,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = [
|
valid_rival_types: List[str] = [
|
||||||
'rival',
|
'rival',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
from typing import Any, Dict, Iterator, Tuple
|
from typing import Any, Dict, Iterator, List, Tuple
|
||||||
|
|
||||||
from flask_caching import Cache # type: ignore
|
from flask_caching import Cache # type: ignore
|
||||||
|
|
||||||
@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
|
|||||||
|
|
||||||
class SoundVoltexFrontend(FrontendBase):
|
class SoundVoltexFrontend(FrontendBase):
|
||||||
|
|
||||||
game = GameConstants.SDVX
|
game: GameConstants = GameConstants.SDVX
|
||||||
|
|
||||||
valid_charts = [
|
valid_charts: List[int] = [
|
||||||
SoundVoltexBase.CHART_TYPE_NOVICE,
|
SoundVoltexBase.CHART_TYPE_NOVICE,
|
||||||
SoundVoltexBase.CHART_TYPE_ADVANCED,
|
SoundVoltexBase.CHART_TYPE_ADVANCED,
|
||||||
SoundVoltexBase.CHART_TYPE_EXHAUST,
|
SoundVoltexBase.CHART_TYPE_EXHAUST,
|
||||||
@ -21,7 +21,7 @@ class SoundVoltexFrontend(FrontendBase):
|
|||||||
SoundVoltexBase.CHART_TYPE_MAXIMUM,
|
SoundVoltexBase.CHART_TYPE_MAXIMUM,
|
||||||
]
|
]
|
||||||
|
|
||||||
valid_rival_types = [
|
valid_rival_types: List[str] = [
|
||||||
'rival',
|
'rival',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user