Make black do 120 character lines instead of 80.

This commit is contained in:
Jennifer Taylor
2024-01-02 02:46:24 +00:00
parent d3413715f3
commit f6a9aa69fd
211 changed files with 3914 additions and 12437 deletions
+2 -6
View File
@@ -14,15 +14,11 @@ class BaseObject:
various fetch versions.
"""
def __init__(
self, data: Data, game: GameConstants, version: int, omnimix: bool
) -> None:
def __init__(self, data: Data, game: GameConstants, version: int, omnimix: bool) -> None:
self.data = data
self.game = game
self.version = version
self.omnimix = omnimix
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> Any:
def fetch_v1(self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]) -> Any:
raise APIException("Object fetch not supported for this version!")
+3 -10
View File
@@ -65,9 +65,7 @@ class CatalogObject(BaseObject):
}
return {
"difficulty": song.data.get_int("difficulty"),
"category": categorymapping.get(
song.data.get_int("version", defaultcategory), "1"
),
"category": categorymapping.get(song.data.get_int("version", defaultcategory), "1"),
"bpm_min": song.data.get_int("bpm_min"),
"bpm_max": song.data.get_int("bpm_max"),
}
@@ -228,9 +226,7 @@ class CatalogObject(BaseObject):
else:
return self.version
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> Dict[str, List[Dict[str, Any]]]:
def fetch_v1(self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]) -> Dict[str, List[Dict[str, Any]]]:
# Verify IDs
if idtype != APIConstants.ID_TYPE_SERVER:
raise APIException(
@@ -240,10 +236,7 @@ class CatalogObject(BaseObject):
# Fetch the songs
songs = self.data.local.music.get_all_songs(self.game, self.music_version)
if (
self.game == GameConstants.JUBEAT
and self.version == VersionConstants.JUBEAT_CLAN
):
if self.game == GameConstants.JUBEAT and self.version == VersionConstants.JUBEAT_CLAN:
# There's always a special case. We don't store all music IDs since those in
# the range of 80000301-80000347 are actually the same song, but copy-pasted
# for different prefectures and slightly different charts. So, we need to copy
+3 -9
View File
@@ -74,15 +74,11 @@ class ProfileObject(BaseObject):
return base
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> List[Dict[str, Any]]:
def fetch_v1(self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]) -> List[Dict[str, Any]]:
# Fetch the profiles
profiles: List[Tuple[UserID, Profile]] = []
if idtype == APIConstants.ID_TYPE_SERVER:
profiles.extend(
self.data.local.user.get_all_profiles(self.game, self.version)
)
profiles.extend(self.data.local.user.get_all_profiles(self.game, self.version))
elif idtype == APIConstants.ID_TYPE_SONG:
raise APIException(
"Unsupported ID for lookup!",
@@ -108,9 +104,7 @@ class ProfileObject(BaseObject):
# in the case that we returned scores for a user that doesn't have a
# profile on a particular version. We allow that on this network, so in
# order to not break remote networks, try our best to return any profile.
profile = self.data.local.user.get_any_profile(
self.game, self.version, userid
)
profile = self.data.local.user.get_any_profile(self.game, self.version, userid)
if profile is not None:
profiles.append((userid, profile))
else:
+3 -9
View File
@@ -235,9 +235,7 @@ class RecordsObject(BaseObject):
else:
return self.version
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> List[Dict[str, Any]]:
def fetch_v1(self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]) -> List[Dict[str, Any]]:
since = params.get("since")
until = params.get("until")
@@ -247,9 +245,7 @@ class RecordsObject(BaseObject):
# Because of the way this query works, we can't apply since/until to it directly.
# If we did, it would miss higher scores earned before since or after until, and
# incorrectly report records.
records.extend(
self.data.local.music.get_all_records(self.game, self.music_version)
)
records.extend(self.data.local.music.get_all_records(self.game, self.music_version))
elif idtype == APIConstants.ID_TYPE_SONG:
if len(ids) == 1:
songid = int(ids[0])
@@ -273,9 +269,7 @@ class RecordsObject(BaseObject):
cardid = ids[2]
userid = self.data.local.user.from_cardid(cardid)
if userid is not None:
score = self.data.local.music.get_score(
self.game, self.music_version, userid, songid, chart
)
score = self.data.local.music.get_score(self.game, self.music_version, userid, songid, chart)
if score is not None:
records.append((userid, score))
elif idtype == APIConstants.ID_TYPE_CARD:
+13 -50
View File
@@ -17,9 +17,7 @@ class StatisticsObject(BaseObject):
"combos": stats.get("combos", -1),
}
def __format_user_statistics(
self, cardids: List[str], stats: Dict[str, Any]
) -> Dict[str, Any]:
def __format_user_statistics(self, cardids: List[str], stats: Dict[str, Any]) -> Dict[str, Any]:
base = self.__format_statistics(stats)
base["cards"] = cardids
return base
@@ -48,20 +46,11 @@ class StatisticsObject(BaseObject):
}:
return True
if self.game == GameConstants.IIDX:
return (
attempt.data.get_int("clear_status")
!= DBConstants.IIDX_CLEAR_STATUS_NO_PLAY
)
return attempt.data.get_int("clear_status") != DBConstants.IIDX_CLEAR_STATUS_NO_PLAY
if self.game == GameConstants.REFLEC_BEAT:
return (
attempt.data.get_int("clear_type")
!= DBConstants.REFLEC_BEAT_CLEAR_TYPE_NO_PLAY
)
return attempt.data.get_int("clear_type") != DBConstants.REFLEC_BEAT_CLEAR_TYPE_NO_PLAY
if self.game == GameConstants.SDVX:
return (
attempt.data.get_int("clear_type")
!= DBConstants.SDVX_CLEAR_TYPE_NO_PLAY
)
return attempt.data.get_int("clear_type") != DBConstants.SDVX_CLEAR_TYPE_NO_PLAY
return False
@@ -72,17 +61,11 @@ class StatisticsObject(BaseObject):
if self.game == GameConstants.DDR:
return attempt.data.get_int("rank") != DBConstants.DDR_RANK_E
if self.game == GameConstants.IIDX:
return (
attempt.data.get_int("clear_status")
!= DBConstants.IIDX_CLEAR_STATUS_FAILED
)
return attempt.data.get_int("clear_status") != DBConstants.IIDX_CLEAR_STATUS_FAILED
if self.game == GameConstants.JUBEAT:
return attempt.data.get_int("medal") != DBConstants.JUBEAT_PLAY_MEDAL_FAILED
if self.game == GameConstants.MUSECA:
return (
attempt.data.get_int("clear_type")
!= DBConstants.MUSECA_CLEAR_TYPE_FAILED
)
return attempt.data.get_int("clear_type") != DBConstants.MUSECA_CLEAR_TYPE_FAILED
if self.game == GameConstants.POPN_MUSIC:
return attempt.data.get_int("medal") not in [
DBConstants.POPN_MUSIC_PLAY_MEDAL_CIRCLE_FAILED,
@@ -90,14 +73,9 @@ class StatisticsObject(BaseObject):
DBConstants.POPN_MUSIC_PLAY_MEDAL_STAR_FAILED,
]
if self.game == GameConstants.REFLEC_BEAT:
return (
attempt.data.get_int("clear_type")
!= DBConstants.REFLEC_BEAT_CLEAR_TYPE_FAILED
)
return attempt.data.get_int("clear_type") != DBConstants.REFLEC_BEAT_CLEAR_TYPE_FAILED
if self.game == GameConstants.SDVX:
return attempt.data.get_int(
"grade"
) != DBConstants.SDVX_GRADE_NO_PLAY and attempt.data.get_int(
return attempt.data.get_int("grade") != DBConstants.SDVX_GRADE_NO_PLAY and attempt.data.get_int(
"clear_type"
) not in [
DBConstants.SDVX_CLEAR_TYPE_NO_PLAY,
@@ -113,10 +91,7 @@ class StatisticsObject(BaseObject):
if self.game == GameConstants.DDR:
return attempt.data.get_int("halo") != DBConstants.DDR_HALO_NONE
if self.game == GameConstants.IIDX:
return (
attempt.data.get_int("clear_status")
== DBConstants.IIDX_CLEAR_STATUS_FULL_COMBO
)
return attempt.data.get_int("clear_status") == DBConstants.IIDX_CLEAR_STATUS_FULL_COMBO
if self.game == GameConstants.JUBEAT:
return attempt.data.get_int("medal") in [
DBConstants.JUBEAT_PLAY_MEDAL_FULL_COMBO,
@@ -124,10 +99,7 @@ class StatisticsObject(BaseObject):
DBConstants.JUBEAT_PLAY_MEDAL_EXCELLENT,
]
if self.game == GameConstants.MUSECA:
return (
attempt.data.get_int("clear_type")
== DBConstants.MUSECA_CLEAR_TYPE_FULL_COMBO
)
return attempt.data.get_int("clear_type") == DBConstants.MUSECA_CLEAR_TYPE_FULL_COMBO
if self.game == GameConstants.POPN_MUSIC:
return attempt.data.get_int("medal") in [
DBConstants.POPN_MUSIC_PLAY_MEDAL_CIRCLE_FULL_COMBO,
@@ -213,20 +185,13 @@ class StatisticsObject(BaseObject):
return retval
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> List[Dict[str, Any]]:
def fetch_v1(self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]) -> List[Dict[str, Any]]:
retval: List[Dict[str, Any]] = []
# Fetch the attempts
if idtype == APIConstants.ID_TYPE_SERVER:
retval = self.__aggregate_global(
[
attempt[1]
for attempt in self.data.local.music.get_all_attempts(
self.game, self.music_version
)
]
[attempt[1] for attempt in self.data.local.music.get_all_attempts(self.game, self.music_version)]
)
elif idtype == APIConstants.ID_TYPE_SONG:
if len(ids) == 1:
@@ -272,9 +237,7 @@ class StatisticsObject(BaseObject):
id_to_cards[userid] = self.data.local.user.get_cards(userid)
attempts.extend(
self.data.local.music.get_all_attempts(
self.game, self.music_version, userid=userid
)
self.data.local.music.get_all_attempts(self.game, self.music_version, userid=userid)
)
retval = self.__aggregate_local(id_to_cards, attempts)
else: