let black do it's magic

This commit is contained in:
2023-03-09 11:38:58 -05:00
parent fa7206848c
commit a76bb94eb1
150 changed files with 8474 additions and 4843 deletions

View File

@ -25,7 +25,7 @@ music = Table(
Column("bpm", Integer),
Column("date", String(255)),
UniqueConstraint("version", "songId", "chartId", name="diva_static_music_uk"),
mysql_charset='utf8mb4'
mysql_charset="utf8mb4",
)
quests = Table(
@ -43,9 +43,8 @@ quests = Table(
Column("quest_order", Integer),
Column("start_datetime", String(255)),
Column("end_datetime", String(255)),
UniqueConstraint("version", "questId", name="diva_static_quests_uk"),
mysql_charset='utf8mb4'
mysql_charset="utf8mb4",
)
shop = Table(
@ -62,7 +61,7 @@ shop = Table(
Column("end_date", String(255)),
Column("enabled", Boolean, server_default="1"),
UniqueConstraint("version", "shopId", name="diva_static_shop_uk"),
mysql_charset='utf8mb4'
mysql_charset="utf8mb4",
)
items = Table(
@ -79,64 +78,91 @@ items = Table(
Column("end_date", String(255)),
Column("enabled", Boolean, server_default="1"),
UniqueConstraint("version", "itemId", name="diva_static_items_uk"),
mysql_charset='utf8mb4'
mysql_charset="utf8mb4",
)
class DivaStaticData(BaseData):
def put_quests(self, version: int, questId: int, name: str, kind: int, unknown_0: int, unknown_1: int, unknown_2: int, quest_order: int, start_datetime: str, end_datetime: str) -> Optional[int]:
def put_quests(
self,
version: int,
questId: int,
name: str,
kind: int,
unknown_0: int,
unknown_1: int,
unknown_2: int,
quest_order: int,
start_datetime: str,
end_datetime: str,
) -> Optional[int]:
sql = insert(quests).values(
version = version,
questId = questId,
name = name,
kind = kind,
unknown_0 = unknown_0,
unknown_1 = unknown_1,
unknown_2 = unknown_2,
quest_order = quest_order,
start_datetime = start_datetime,
end_datetime = end_datetime
version=version,
questId=questId,
name=name,
kind=kind,
unknown_0=unknown_0,
unknown_1=unknown_1,
unknown_2=unknown_2,
quest_order=quest_order,
start_datetime=start_datetime,
end_datetime=end_datetime,
)
conflict = sql.on_duplicate_key_update(
name = name
)
conflict = sql.on_duplicate_key_update(name=name)
result = self.execute(conflict)
if result is None: return None
if result is None:
return None
return result.lastrowid
def get_enabled_quests(self, version: int) -> Optional[List[Row]]:
sql = select(quests).where(and_(quests.c.version == version, quests.c.quest_enable == True))
sql = select(quests).where(
and_(quests.c.version == version, quests.c.quest_enable == True)
)
result = self.execute(sql)
if result is None: return None
if result is None:
return None
return result.fetchall()
def put_shop(self, version: int, shopId: int, name: str, type: int, points: int, unknown_0: int, start_date: str, end_date: str) -> Optional[int]:
def put_shop(
self,
version: int,
shopId: int,
name: str,
type: int,
points: int,
unknown_0: int,
start_date: str,
end_date: str,
) -> Optional[int]:
sql = insert(shop).values(
version = version,
shopId = shopId,
name = name,
type = type,
points = points,
unknown_0 = unknown_0,
start_date = start_date,
end_date = end_date
version=version,
shopId=shopId,
name=name,
type=type,
points=points,
unknown_0=unknown_0,
start_date=start_date,
end_date=end_date,
)
conflict = sql.on_duplicate_key_update(
name = name
)
conflict = sql.on_duplicate_key_update(name=name)
result = self.execute(conflict)
if result is None: return None
if result is None:
return None
return result.lastrowid
def get_enabled_shop(self, version: int, shopId: int) -> Optional[Row]:
sql = select(shop).where(and_(
shop.c.version == version,
shop.c.shopId == shopId,
shop.c.enabled == True))
sql = select(shop).where(
and_(
shop.c.version == version,
shop.c.shopId == shopId,
shop.c.enabled == True,
)
)
result = self.execute(sql)
if result is None:
@ -144,40 +170,52 @@ class DivaStaticData(BaseData):
return result.fetchone()
def get_enabled_shops(self, version: int) -> Optional[List[Row]]:
sql = select(shop).where(and_(
shop.c.version == version,
shop.c.enabled == True))
sql = select(shop).where(
and_(shop.c.version == version, shop.c.enabled == True)
)
result = self.execute(sql)
if result is None:
return None
return result.fetchall()
def put_items(self, version: int, itemId: int, name: str, type: int, points: int, unknown_0: int, start_date: str, end_date: str) -> Optional[int]:
def put_items(
self,
version: int,
itemId: int,
name: str,
type: int,
points: int,
unknown_0: int,
start_date: str,
end_date: str,
) -> Optional[int]:
sql = insert(items).values(
version = version,
itemId = itemId,
name = name,
type = type,
points = points,
unknown_0 = unknown_0,
start_date = start_date,
end_date = end_date
version=version,
itemId=itemId,
name=name,
type=type,
points=points,
unknown_0=unknown_0,
start_date=start_date,
end_date=end_date,
)
conflict = sql.on_duplicate_key_update(
name = name
)
conflict = sql.on_duplicate_key_update(name=name)
result = self.execute(conflict)
if result is None: return None
if result is None:
return None
return result.lastrowid
def get_enabled_item(self, version: int, itemId: int) -> Optional[Row]:
sql = select(items).where(and_(
items.c.version == version,
items.c.itemId == itemId,
items.c.enabled == True))
sql = select(items).where(
and_(
items.c.version == version,
items.c.itemId == itemId,
items.c.enabled == True,
)
)
result = self.execute(sql)
if result is None:
@ -185,66 +223,89 @@ class DivaStaticData(BaseData):
return result.fetchone()
def get_enabled_items(self, version: int) -> Optional[List[Row]]:
sql = select(items).where(and_(
items.c.version == version,
items.c.enabled == True))
sql = select(items).where(
and_(items.c.version == version, items.c.enabled == True)
)
result = self.execute(sql)
if result is None:
return None
return result.fetchall()
def put_music(self, version: int, song: int, chart: int, title: str, arranger: str, illustrator: str,
lyrics: str, music_comp: str, level: float, bpm: int, date: str) -> Optional[int]:
def put_music(
self,
version: int,
song: int,
chart: int,
title: str,
arranger: str,
illustrator: str,
lyrics: str,
music_comp: str,
level: float,
bpm: int,
date: str,
) -> Optional[int]:
sql = insert(music).values(
version = version,
songId = song,
chartId = chart,
title = title,
vocaloid_arranger = arranger,
pv_illustrator = illustrator,
lyrics = lyrics,
bg_music = music_comp,
level = level,
bpm = bpm,
date = date
version=version,
songId=song,
chartId=chart,
title=title,
vocaloid_arranger=arranger,
pv_illustrator=illustrator,
lyrics=lyrics,
bg_music=music_comp,
level=level,
bpm=bpm,
date=date,
)
conflict = sql.on_duplicate_key_update(
title = title,
vocaloid_arranger = arranger,
pv_illustrator = illustrator,
lyrics = lyrics,
bg_music = music_comp,
level = level,
bpm = bpm,
date = date
title=title,
vocaloid_arranger=arranger,
pv_illustrator=illustrator,
lyrics=lyrics,
bg_music=music_comp,
level=level,
bpm=bpm,
date=date,
)
result = self.execute(conflict)
if result is None: return None
if result is None:
return None
return result.lastrowid
def get_music(self, version: int, song_id: Optional[int] = None) -> Optional[List[Row]]:
def get_music(
self, version: int, song_id: Optional[int] = None
) -> Optional[List[Row]]:
if song_id is None:
sql = select(music).where(music.c.version == version)
else:
sql = select(music).where(and_(
music.c.version == version,
music.c.songId == song_id,
))
sql = select(music).where(
and_(
music.c.version == version,
music.c.songId == song_id,
)
)
result = self.execute(sql)
if result is None: return None
if result is None:
return None
return result.fetchall()
def get_music_chart(self, version: int, song_id: int, chart_id: int) -> Optional[List[Row]]:
sql = select(music).where(and_(
music.c.version == version,
music.c.songId == song_id,
music.c.chartId == chart_id
))
def get_music_chart(
self, version: int, song_id: int, chart_id: int
) -> Optional[List[Row]]:
sql = select(music).where(
and_(
music.c.version == version,
music.c.songId == song_id,
music.c.chartId == chart_id,
)
)
result = self.execute(sql)
if result is None: return None
if result is None:
return None
return result.fetchone()