1
0
mirror of synced 2024-09-23 19:08:21 +02:00

Add explicit types to frontend classes.

This commit is contained in:
Jennifer Taylor 2021-09-07 17:57:31 +00:00
parent 3863b9f048
commit b3b6ae7eaf
10 changed files with 35 additions and 34 deletions

View File

@ -12,7 +12,7 @@ from bemani.frontend.base import FrontendBase
class BishiBashiFrontend(FrontendBase):
game = GameConstants.BISHI_BASHI
game: GameConstants = GameConstants.BISHI_BASHI
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
super().__init__(data, config, cache)

View File

@ -1,6 +1,6 @@
# vim: set fileencoding=utf-8
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.common import Profile, ValidatedDict, GameConstants, VersionConstants
@ -10,11 +10,11 @@ from bemani.frontend.base import 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_BASIC,
DDRBase.CHART_SINGLE_DIFFICULT,
@ -26,9 +26,9 @@ class DDRFrontend(FrontendBase):
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_X3_VS_2NDMIX: 3,
VersionConstants.DDR_2013: 3,

View File

@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
class IIDXFrontend(FrontendBase):
game = GameConstants.IIDX
game: GameConstants = GameConstants.IIDX
valid_charts = [
valid_charts: List[int] = [
IIDXBase.CHART_TYPE_N7,
IIDXBase.CHART_TYPE_H7,
IIDXBase.CHART_TYPE_A7,
@ -22,7 +22,7 @@ class IIDXFrontend(FrontendBase):
IIDXBase.CHART_TYPE_A14,
]
valid_rival_types = [
valid_rival_types: List[str] = [
'sp_rival',
'dp_rival',
]

View File

@ -1,5 +1,5 @@
# 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.common import Profile, ValidatedDict, GameConstants, VersionConstants
@ -9,15 +9,15 @@ from bemani.frontend.base import FrontendBase
class JubeatFrontend(FrontendBase):
game = GameConstants.JUBEAT
game: GameConstants = GameConstants.JUBEAT
valid_charts = [
valid_charts: List[int] = [
JubeatBase.CHART_TYPE_BASIC,
JubeatBase.CHART_TYPE_ADVANCED,
JubeatBase.CHART_TYPE_EXTREME,
]
valid_rival_types = ['rival']
valid_rival_types: List[str] = ['rival']
def all_games(self) -> Iterator[Tuple[GameConstants, int, str]]:
yield from JubeatFactory.all_games()

View File

@ -12,7 +12,7 @@ from bemani.frontend.base import FrontendBase
class MetalGearArcadeFrontend(FrontendBase):
game = GameConstants.MGA
game: GameConstants = GameConstants.MGA
def __init__(self, data: Data, config: Config, cache: Cache) -> None:
super().__init__(data, config, cache)

View File

@ -1,5 +1,5 @@
# 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
@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
class MusecaFrontend(FrontendBase):
game = GameConstants.MUSECA
game: GameConstants = GameConstants.MUSECA
valid_charts = [
valid_charts: List[int] = [
MusecaBase.CHART_TYPE_GREEN,
MusecaBase.CHART_TYPE_ORANGE,
MusecaBase.CHART_TYPE_RED,

View File

@ -1,5 +1,5 @@
# 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.common import Profile, ValidatedDict, GameConstants, VersionConstants
@ -9,18 +9,18 @@ from bemani.frontend.base import 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_NORMAL,
PopnMusicBase.CHART_TYPE_HYPER,
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
# couldn't get it booting anymore to test.
VersionConstants.POPN_MUSIC_TUNE_STREET: 0,

View File

@ -1,6 +1,7 @@
# vim: set fileencoding=utf-8
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 bemani.common import ID, GameConstants
@ -20,7 +21,7 @@ reflec_pages = Blueprint(
static_folder=static_location,
)
NO_RIVAL_SUPPORT = [1]
NO_RIVAL_SUPPORT: Final[List[int]] = [1]
@reflec_pages.route('/scores')

View File

@ -1,5 +1,5 @@
# 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
@ -11,18 +11,18 @@ from bemani.frontend.base import 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_MEDIUM,
ReflecBeatBase.CHART_TYPE_HARD,
ReflecBeatBase.CHART_TYPE_SPECIAL,
]
valid_rival_types = [
valid_rival_types: List[str] = [
'rival',
]

View File

@ -1,5 +1,5 @@
# 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
@ -11,9 +11,9 @@ from bemani.frontend.base import FrontendBase
class SoundVoltexFrontend(FrontendBase):
game = GameConstants.SDVX
game: GameConstants = GameConstants.SDVX
valid_charts = [
valid_charts: List[int] = [
SoundVoltexBase.CHART_TYPE_NOVICE,
SoundVoltexBase.CHART_TYPE_ADVANCED,
SoundVoltexBase.CHART_TYPE_EXHAUST,
@ -21,7 +21,7 @@ class SoundVoltexFrontend(FrontendBase):
SoundVoltexBase.CHART_TYPE_MAXIMUM,
]
valid_rival_types = [
valid_rival_types: List[str] = [
'rival',
]