mirror of
https://github.com/DragonMinded/bemaniutils.git
synced 2026-03-21 17:24:33 -05:00
Format with latest black, fix latest type issues.
This commit is contained in:
parent
e55bd017e7
commit
90cedcd5e1
|
|
@ -11,16 +11,16 @@ class GameConstants(Enum):
|
|||
in any of the tables should only contain one of the following strings.
|
||||
"""
|
||||
|
||||
BISHI_BASHI: Final[str] = "bishi"
|
||||
DANCE_EVOLUTION: Final[str] = "danevo"
|
||||
DDR: Final[str] = "ddr"
|
||||
IIDX: Final[str] = "iidx"
|
||||
JUBEAT: Final[str] = "jubeat"
|
||||
MGA: Final[str] = "mga"
|
||||
MUSECA: Final[str] = "museca"
|
||||
POPN_MUSIC: Final[str] = "pnm"
|
||||
REFLEC_BEAT: Final[str] = "reflec"
|
||||
SDVX: Final[str] = "sdvx"
|
||||
BISHI_BASHI = "bishi"
|
||||
DANCE_EVOLUTION = "danevo"
|
||||
DDR = "ddr"
|
||||
IIDX = "iidx"
|
||||
JUBEAT = "jubeat"
|
||||
MGA = "mga"
|
||||
MUSECA = "museca"
|
||||
POPN_MUSIC = "pnm"
|
||||
REFLEC_BEAT = "reflec"
|
||||
SDVX = "sdvx"
|
||||
|
||||
|
||||
class VersionConstants:
|
||||
|
|
@ -146,10 +146,10 @@ class APIConstants(Enum):
|
|||
The four types of IDs found in a BEMAPI request or response.
|
||||
"""
|
||||
|
||||
ID_TYPE_SERVER: Final[str] = "server"
|
||||
ID_TYPE_CARD: Final[str] = "card"
|
||||
ID_TYPE_SONG: Final[str] = "song"
|
||||
ID_TYPE_INSTANCE: Final[str] = "instance"
|
||||
ID_TYPE_SERVER = "server"
|
||||
ID_TYPE_CARD = "card"
|
||||
ID_TYPE_SONG = "song"
|
||||
ID_TYPE_INSTANCE = "instance"
|
||||
|
||||
|
||||
class DBConstants:
|
||||
|
|
@ -297,38 +297,38 @@ class BroadcastConstants(Enum):
|
|||
"""
|
||||
|
||||
# Sections related to the player/song/etc.
|
||||
DJ_NAME: Final[str] = "DJ Name"
|
||||
SONG_NAME: Final[str] = "Song"
|
||||
ARTIST_NAME: Final[str] = "Artist"
|
||||
DIFFICULTY: Final[str] = "Difficulty"
|
||||
DJ_NAME = "DJ Name"
|
||||
SONG_NAME = "Song"
|
||||
ARTIST_NAME = "Artist"
|
||||
DIFFICULTY = "Difficulty"
|
||||
|
||||
# Section headers.
|
||||
PLAY_STATS_HEADER: Final[str] = "Play Stats"
|
||||
PLAY_STATS_HEADER = "Play Stats"
|
||||
|
||||
# Stats that relate to the song, but not the current play of the song.
|
||||
TARGET_EXSCORE: Final[str] = "Target EXScore"
|
||||
BEST_CLEAR_STATUS: Final[str] = "Best Clear"
|
||||
TARGET_EXSCORE = "Target EXScore"
|
||||
BEST_CLEAR_STATUS = "Best Clear"
|
||||
|
||||
# Stats that have to do with the current play of the song.
|
||||
EXSCORE: Final[str] = "Your EXScore"
|
||||
CLEAR_STATUS: Final[str] = "Clear Status"
|
||||
PERFECT_GREATS: Final[str] = "Perfect Greats"
|
||||
GREATS: Final[str] = "Greats"
|
||||
GOODS: Final[str] = "Goods"
|
||||
BADS: Final[str] = "Bads"
|
||||
POORS: Final[str] = "Poors"
|
||||
COMBO_BREAKS: Final[str] = "Combo Breaks"
|
||||
SLOWS: Final[str] = "Slow"
|
||||
FASTS: Final[str] = "Fast"
|
||||
GRADE: Final[str] = "Grade"
|
||||
RATE: Final[str] = "Score Rate"
|
||||
EXSCORE = "Your EXScore"
|
||||
CLEAR_STATUS = "Clear Status"
|
||||
PERFECT_GREATS = "Perfect Greats"
|
||||
GREATS = "Greats"
|
||||
GOODS = "Goods"
|
||||
BADS = "Bads"
|
||||
POORS = "Poors"
|
||||
COMBO_BREAKS = "Combo Breaks"
|
||||
SLOWS = "Slow"
|
||||
FASTS = "Fast"
|
||||
GRADE = "Grade"
|
||||
RATE = "Score Rate"
|
||||
|
||||
# Added for Pnm
|
||||
PLAYER_NAME: Final[str] = "Player Name"
|
||||
SCORE: Final[str] = "Your Score"
|
||||
COOLS: Final[str] = "Cools"
|
||||
COMBO: Final[str] = "Combo"
|
||||
MEDAL: Final[str] = "Medal"
|
||||
PLAYER_NAME = "Player Name"
|
||||
SCORE = "Your Score"
|
||||
COOLS = "Cools"
|
||||
COMBO = "Combo"
|
||||
MEDAL = "Medal"
|
||||
|
||||
|
||||
class _RegionConstants:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed
|
||||
from discord_webhook import DiscordWebhook, DiscordEmbed # type: ignore
|
||||
from typing import Dict
|
||||
|
||||
from bemani.common.constants import GameConstants, BroadcastConstants
|
||||
|
|
|
|||
|
|
@ -2733,7 +2733,7 @@ class SWF(VerboseOutput, TrackedCoverage):
|
|||
ap2_data_version = magic[0] & 0xFF
|
||||
magic = bytes([magic[3] & 0x7F, magic[2] & 0x7F, magic[1] & 0x7F, 0x0])
|
||||
if magic != b"AP2\x00":
|
||||
raise Exception(f"Unrecognzied magic {magic}!")
|
||||
raise Exception(f"Unrecognzied magic {magic!r}!")
|
||||
if length != len(data):
|
||||
raise Exception(f"Unexpected length in AFP header, {length} != {len(data)}!")
|
||||
if ap2_data_version not in [7, 8, 9, 10]:
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ class TDXT:
|
|||
| ((pixel[order[2]] >> 3) & 0x1F)
|
||||
),
|
||||
)
|
||||
for pixel in imgdata.getdata()
|
||||
for pixel in imgdata.getdata() # type: ignore
|
||||
)
|
||||
elif self.fmt == 0x13:
|
||||
# 16-bit A1R5G55 texture format.
|
||||
|
|
@ -396,7 +396,7 @@ class TDXT:
|
|||
| ((pixel[order[2]] >> 3) & 0x1F)
|
||||
),
|
||||
)
|
||||
for pixel in imgdata.getdata()
|
||||
for pixel in imgdata.getdata() # type: ignore
|
||||
)
|
||||
elif self.fmt == 0x1F:
|
||||
# 16-bit 4-4-4-4 RGBA format.
|
||||
|
|
@ -410,7 +410,7 @@ class TDXT:
|
|||
| (((pixel[3] >> 4) & 0xF) << 12)
|
||||
),
|
||||
)
|
||||
for pixel in imgdata.getdata()
|
||||
for pixel in imgdata.getdata() # type: ignore
|
||||
)
|
||||
elif self.fmt == 0x20:
|
||||
# 32-bit RGBA format, stored in BGRA order.
|
||||
|
|
@ -422,7 +422,7 @@ class TDXT:
|
|||
pixel[order[0]],
|
||||
pixel[3],
|
||||
)
|
||||
for pixel in imgdata.getdata()
|
||||
for pixel in imgdata.getdata() # type: ignore
|
||||
)
|
||||
else:
|
||||
raise Exception(f"Unsupported format {hex(self.fmt)} for TDXT file!")
|
||||
|
|
|
|||
|
|
@ -136,31 +136,31 @@ def updatename() -> Dict[str, Any]:
|
|||
if (
|
||||
re.match(
|
||||
"^["
|
||||
+ "\uFF20-\uFF3A"
|
||||
+ "\uFF10-\uFF19" # widetext A-Z, @
|
||||
+ "\u3041-\u308D\u308F\u3092\u3093" # widetext 0-9
|
||||
+ "\u30A1-\u30ED\u30EF\u30F2\u30F3\u30FC" # hiragana
|
||||
+ "\uff20-\uff3a"
|
||||
+ "\uff10-\uff19" # widetext A-Z, @
|
||||
+ "\u3041-\u308d\u308f\u3092\u3093" # widetext 0-9
|
||||
+ "\u30a1-\u30ed\u30ef\u30f2\u30f3\u30fc" # hiragana
|
||||
+ "\u3000" # katakana
|
||||
+ "\u301C" # widetext blank space
|
||||
+ "\u30FB" # widetext ~
|
||||
+ "\u30FC" # widetext middot
|
||||
+ "\u301c" # widetext blank space
|
||||
+ "\u30fb" # widetext ~
|
||||
+ "\u30fc" # widetext middot
|
||||
+ "\u2212" # widetext long dash
|
||||
+ "\u2605" # widetext short dash
|
||||
+ "\uFF01" # widetext heavy star
|
||||
+ "\uFF03" # widetext !
|
||||
+ "\uFF04" # widetext #
|
||||
+ "\uFF05" # widetext $
|
||||
+ "\uFF06" # widetext %
|
||||
+ "\uFF08" # widetext &
|
||||
+ "\uFF09" # widetext (
|
||||
+ "\uFF0A" # widetext )
|
||||
+ "\uFF0B" # widetext *
|
||||
+ "\uFF0F" # widetext +
|
||||
+ "\uFF1C" # widetext /
|
||||
+ "\uFF1D" # widetext <
|
||||
+ "\uFF1E" # widetext =
|
||||
+ "\uFF1F" # widetext >
|
||||
+ "\uFFE5" # widetext ?
|
||||
+ "\uff01" # widetext heavy star
|
||||
+ "\uff03" # widetext !
|
||||
+ "\uff04" # widetext #
|
||||
+ "\uff05" # widetext $
|
||||
+ "\uff06" # widetext %
|
||||
+ "\uff08" # widetext &
|
||||
+ "\uff09" # widetext (
|
||||
+ "\uff0a" # widetext )
|
||||
+ "\uff0b" # widetext *
|
||||
+ "\uff0f" # widetext +
|
||||
+ "\uff1c" # widetext /
|
||||
+ "\uff1d" # widetext <
|
||||
+ "\uff1e" # widetext =
|
||||
+ "\uff1f" # widetext >
|
||||
+ "\uffe5" # widetext ?
|
||||
+ "]*$", # widetext Yen symbol
|
||||
name,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -335,12 +335,12 @@ def updatename() -> Dict[str, Any]:
|
|||
if (
|
||||
re.match(
|
||||
"^["
|
||||
+ "\uFF20-\uFF3A"
|
||||
+ "\uFF41-\uFF5A" # widetext A-Z and @
|
||||
+ "\uFF10-\uFF19" # widetext a-z
|
||||
+ "\uFF0C\uFF0E\uFF3F" # widetext 0-9
|
||||
+ "\u3041-\u308D\u308F\u3092\u3093" # widetext ,._
|
||||
+ "\u30A1-\u30ED\u30EF\u30F2\u30F3\u30FC" # hiragana
|
||||
+ "\uff20-\uff3a"
|
||||
+ "\uff41-\uff5a" # widetext A-Z and @
|
||||
+ "\uff10-\uff19" # widetext a-z
|
||||
+ "\uff0c\uff0e\uff3f" # widetext 0-9
|
||||
+ "\u3041-\u308d\u308f\u3092\u3093" # widetext ,._
|
||||
+ "\u30a1-\u30ed\u30ef\u30f2\u30f3\u30fc" # hiragana
|
||||
+ "]*$", # katakana
|
||||
name,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -332,15 +332,15 @@ def updatename() -> Dict[str, Any]:
|
|||
if (
|
||||
re.match(
|
||||
"^["
|
||||
+ "\uFF21-\uFF3A"
|
||||
+ "\uFF10-\uFF19" # widetext A-Z
|
||||
+ "\uFF0E\u2212\uFF3F\u30FB" # widetext 0-9
|
||||
+ "\uFF06\uFF01\uFF1F\uFF0F"
|
||||
+ "\uFF0A\uFF03\u266D\u2605"
|
||||
+ "\uFF20\u266A\u2193\u2191"
|
||||
+ "\u2192\u2190\uFF08\uFF09"
|
||||
+ "\u221E\u25C6\u25CF\u25BC"
|
||||
+ "\uFFE5\uFF3E\u2200\uFF05"
|
||||
+ "\uff21-\uff3a"
|
||||
+ "\uff10-\uff19" # widetext A-Z
|
||||
+ "\uff0e\u2212\uff3f\u30fb" # widetext 0-9
|
||||
+ "\uff06\uff01\uff1f\uff0f"
|
||||
+ "\uff0a\uff03\u266d\u2605"
|
||||
+ "\uff20\u266a\u2193\u2191"
|
||||
+ "\u2192\u2190\uff08\uff09"
|
||||
+ "\u221e\u25c6\u25cf\u25bc"
|
||||
+ "\uffe5\uff3e\u2200\uff05"
|
||||
+ "\u3000"
|
||||
+ "]*$", # widetext space
|
||||
name,
|
||||
|
|
@ -354,16 +354,16 @@ def updatename() -> Dict[str, Any]:
|
|||
if (
|
||||
re.match(
|
||||
"^["
|
||||
+ "\uFF21-\uFF3A"
|
||||
+ "\uFF41-\uFF5A" # widetext A-Z
|
||||
+ "\uFF10-\uFF19" # widetext a-z
|
||||
+ "\uFF0E\u2212\uFF3F\u30FB" # widetext 0-9
|
||||
+ "\uFF06\uFF01\uFF1F\uFF0F"
|
||||
+ "\uFF0A\uFF03\u266D\u2605"
|
||||
+ "\uFF20\u266A\u2193\u2191"
|
||||
+ "\u2192\u2190\uFF08\uFF09"
|
||||
+ "\u221E\u25C6\u25CF\u25BC"
|
||||
+ "\uFFE5\uFF3E\u2200\uFF05"
|
||||
+ "\uff21-\uff3a"
|
||||
+ "\uff41-\uff5a" # widetext A-Z
|
||||
+ "\uff10-\uff19" # widetext a-z
|
||||
+ "\uff0e\u2212\uff3f\u30fb" # widetext 0-9
|
||||
+ "\uff06\uff01\uff1f\uff0f"
|
||||
+ "\uff0a\uff03\u266d\u2605"
|
||||
+ "\uff20\u266a\u2193\u2191"
|
||||
+ "\u2192\u2190\uff08\uff09"
|
||||
+ "\u221e\u25c6\u25cf\u25bc"
|
||||
+ "\uffe5\uff3e\u2200\uff05"
|
||||
+ "\u3000"
|
||||
+ "]*$", # widetext space
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class EAmuseProtocol:
|
|||
"""
|
||||
|
||||
SHARED_SECRET: Final[bytes] = (
|
||||
b"\x69\xD7\x46\x27\xD9\x85\xEE\x21\x87\x16\x15\x70\xD0\x8D\x93\xB1\x24\x55\x03\x5B\x6D\xF0\xD8\x20\x5D\xF5"
|
||||
b"\x69\xd7\x46\x27\xd9\x85\xee\x21\x87\x16\x15\x70\xd0\x8d\x93\xb1\x24\x55\x03\x5b\x6d\xf0\xd8\x20\x5d\xf5"
|
||||
)
|
||||
|
||||
XML: Final[int] = 1
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class TestXmlDecoder(unittest.TestCase):
|
|||
self.assertEqual(tree.name, "node")
|
||||
self.assertEqual(tree.attributes, {})
|
||||
self.assertEqual(tree.data_type, "bin")
|
||||
self.assertEqual(tree.value, b"\xDE\xAD\xBE\xEF")
|
||||
self.assertEqual(tree.value, b"\xde\xad\xbe\xef")
|
||||
|
||||
xml = XmlDecoder(b'<node __type="bin">\nDEADBEEF\n</node>', "ascii")
|
||||
tree = xml.get_tree()
|
||||
|
|
@ -82,7 +82,7 @@ class TestXmlDecoder(unittest.TestCase):
|
|||
self.assertEqual(tree.name, "node")
|
||||
self.assertEqual(tree.attributes, {})
|
||||
self.assertEqual(tree.data_type, "bin")
|
||||
self.assertEqual(tree.value, b"\xDE\xAD\xBE\xEF")
|
||||
self.assertEqual(tree.value, b"\xde\xad\xbe\xef")
|
||||
|
||||
xml = XmlDecoder(b'<node __type="bin"> D E A D B E E F </node>', "ascii")
|
||||
tree = xml.get_tree()
|
||||
|
|
@ -91,7 +91,7 @@ class TestXmlDecoder(unittest.TestCase):
|
|||
self.assertEqual(tree.name, "node")
|
||||
self.assertEqual(tree.attributes, {})
|
||||
self.assertEqual(tree.data_type, "bin")
|
||||
self.assertEqual(tree.value, b"\xDE\xAD\xBE\xEF")
|
||||
self.assertEqual(tree.value, b"\xde\xad\xbe\xef")
|
||||
|
||||
def test_decode_array(self) -> None:
|
||||
xml = XmlDecoder(b'<node __type="u32" __count="4">1 2 3 4</node>', "ascii")
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ def main() -> None:
|
|||
if args.no_reset:
|
||||
chunks = [data]
|
||||
else:
|
||||
chunks = [data[x:x + 768] for x in range(0, len(data), 768)]
|
||||
chunks = [data[x : x + 768] for x in range(0, len(data), 768)]
|
||||
|
||||
outputs = []
|
||||
proto = EAmuseProtocol()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user