def eligible_replays(replays, *, age=None):
"""Filter replays down to just the replays we want to train with.
Parameters
----------
replays : iterable[Replay]
The replays to filter.
age : datetime.timedelta, optional
Only count replays less than this age old.
Yields
------
replay : Replay
The eligible replays in the directory.
Notes
-----
The same beatmap may appear more than once if there are multiple replays
for this beatmap.
"""
for replay in replays:
if age is not None and datetime.utcnow() - replay.timestamp > age:
continue
if not (replay.mode != GameMode.standard or
replay.failed or
replay.autoplay or
replay.auto_pilot or
replay.cinema or
replay.relax or
len(replay.beatmap.hit_objects) < 2):
# ignore plays with mods that are not representative of user skill
yield replay
评论列表
文章目录