

def __init__(self, game):
    self.leaderboards = {
        
    }
    self.ordered_leaderboards = []
    self.leaderboard_path = None
    self.issues = []
    yaml_path = unicode(get_absolute_path(join_path(game.path, 'leaderboards.yaml')))
    total_yaml_errors = 0
    if path_exists(yaml_path):
        try:
            f = open(yaml_path, 'r')
            try:
                file_meta = yaml.load(f)
                for (i, m) in enumerate(file_meta):
                    key = m['key']
                    leaderboard = Leaderboard(game, key, m, i)
                    num_errors = len(leaderboard.errors)
                    if (num_errors > 0):
                        total_yaml_errors += num_errors
                        self.issues.append((key, {
                            'errors': leaderboard.errors,
                            'warnings': leaderboard.warnings,
                        }))
                    elif (len(leaderboard.warnings) > 0):
                        self.issues.append((key, {
                            'errors': leaderboard.errors,
                            'warnings': leaderboard.warnings,
                        }))
                    self.leaderboards[key] = leaderboard
                    self.ordered_leaderboards.append(leaderboard)
            finally:
                f.close()
        except (IOError, yaml.YAMLError) as e:
            LOG.error('Failed loading leaderboards: %s', str(e))
            raise LeaderboardError(('Failed loading leaderboards.yaml file: %s' % str(e)))
    else:
        raise LeaderboardsUnsupported()
    if (total_yaml_errors > 0):
        raise ValidationException(self.issues)

dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/apiv1/leaderboards.py GameLeaderboards.__init__/original