

def validate_stats(self):
    '\n        Making sure all stats are within range.\n        Nevermind that we have modernized_stats!\n        If the modernized stat is bigger than the difference between max and base, we have to adjust.\n        '
    diff = self.ship.max_stats.diff(self.ship.base_stats)
    mapper = inspect(diff)
    for column in mapper.attrs:
        if (column.key == 'id'):
            continue
        modern_value = getattr(self.modernized_stats, column.key)
        if (modern_value is not None):
            diff_value = getattr(diff, column.key)
            if (modern_value > diff_value):
                setattr(self.stats, column.key, getattr(self.ship.max_stats, column.key))
                setattr(self.modernized_stats, column.key, diff_value)

dataset/ETHPy150Open KanColleTool/kcsrv/db/ships.py Kanmusu.validate_stats/original