예제 #1
0
파일: utils.py 프로젝트: neeraj9/oioioi
def min_group_scorer(test_results):
    """Gets minimal result of all tests inside a test group."""

    scores = [ScoreValue.deserialize(result["score"]) for result in test_results.itervalues()]
    score = min(scores)
    status = aggregate_statuses([result["status"] for result in test_results.itervalues()])
    return score, status
예제 #2
0
파일: utils.py 프로젝트: neeraj9/oioioi
def sum_score_aggregator(group_results):
    if not group_results:
        return None, "OK"

    scores = [ScoreValue.deserialize(result["score"]) for result in group_results.itervalues()]
    score = sum(scores[1:], scores[0])
    status = aggregate_statuses([result["status"] for result in group_results.itervalues()])
    return score, status
예제 #3
0
파일: utils.py 프로젝트: neeraj9/oioioi
def sum_group_scorer(test_results):
    """Adds results of all tests inside a test group."""

    if not test_results:
        return None, "OK"

    scores = [ScoreValue.deserialize(result["score"]) for result in test_results.itervalues()]
    score = sum(scores[1:], scores[0])
    status = aggregate_statuses([result["status"] for result in test_results.itervalues()])
    return score, status
예제 #4
0
파일: utils.py 프로젝트: matrach/oioioi
def min_group_scorer(test_results):
    """Gets minimal result of all tests inside a test group."""

    scores = [
        ScoreValue.deserialize(result['score'])
        for result in test_results.itervalues()
    ]
    score = min(scores)
    status = aggregate_statuses(
        [result['status'] for result in test_results.itervalues()])
    return score, status
예제 #5
0
파일: utils.py 프로젝트: matrach/oioioi
def sum_score_aggregator(group_results):
    if not group_results:
        return None, 'OK'

    scores = [
        ScoreValue.deserialize(result['score'])
        for result in group_results.itervalues()
    ]
    score = sum(scores[1:], scores[0])
    status = aggregate_statuses(
        [result['status'] for result in group_results.itervalues()])
    return score, status
예제 #6
0
파일: utils.py 프로젝트: matrach/oioioi
def sum_group_scorer(test_results):
    """Adds results of all tests inside a test group."""

    if not test_results:
        return None, 'OK'

    scores = [
        ScoreValue.deserialize(result['score'])
        for result in test_results.itervalues()
    ]
    score = sum(scores[1:], scores[0])
    status = aggregate_statuses(
        [result['status'] for result in test_results.itervalues()])
    return score, status
예제 #7
0
파일: utils.py 프로젝트: Agrendalath/oioioi
def sum_score_aggregator(group_results):
    if not group_results:
        return None, None, 'OK'

    scores = [ScoreValue.deserialize(result['score'])
              for result in group_results.itervalues()]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in group_results.itervalues()]

    score = sum(scores[1:], scores[0])
    max_score = sum(max_scores[1:], max_scores[0])
    status = aggregate_statuses([result['status']
        for result in group_results.itervalues()])

    return score, max_score, status
예제 #8
0
파일: utils.py 프로젝트: sio2project/oioioi
def sum_group_scorer(test_results):
    """Adds results of all tests inside a test group."""

    if not test_results:
        return None, None, 'OK'

    scores = [ScoreValue.deserialize(result['score'])
              for result in six.itervalues(test_results)]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in six.itervalues(test_results)]

    score = sum(scores[1:], scores[0])
    max_score = sum(max_scores[1:], max_scores[0])
    status = aggregate_statuses([result['status']
        for result in six.itervalues(test_results)])

    return score, max_score, status
예제 #9
0
파일: utils.py 프로젝트: sio2project/oioioi
def sum_score_aggregator(group_results):
    if not group_results:
        return None, None, 'OK'

    scores = [ScoreValue.deserialize(result['score'])
              for result in six.itervalues(group_results)]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in six.itervalues(group_results)]

    # the sum below needs a start value of an appropriate type,
    # the default zero is not suitable
    score = sum(scores[1:], scores[0])
    max_score = sum(max_scores[1:], max_scores[0])
    status = aggregate_statuses([result['status']
        for result in six.itervalues(group_results)])

    return score, max_score, status
예제 #10
0
def sum_score_aggregator(group_results):
    if not group_results:
        return None, None, 'OK'

    scores = [ScoreValue.deserialize(result['score'])
              for result in group_results.itervalues()]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in group_results.itervalues()]

    # the sum below needs a start value of an appropriate type,
    # the default zero is not suitable
    score = sum(scores[1:], scores[0])
    max_score = sum(max_scores[1:], max_scores[0])
    status = aggregate_statuses([result['status']
        for result in group_results.itervalues()])

    return score, max_score, status
예제 #11
0
파일: utils.py 프로젝트: Agrendalath/oioioi
def min_group_scorer(test_results):
    """Gets minimal result of all tests inside a test group."""

    scores = [ScoreValue.deserialize(result['score'])
              for result in test_results.itervalues()]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in test_results.itervalues()]

    score = min(scores)
    max_score = min(max_scores)
    if max_score != max(max_scores):
        raise UnequalMaxScores("Tests in one group cannot "
                "have different max scores.")

    sorted_results = sorted(test_results.values(), key=itemgetter('order'))
    status = aggregate_statuses([result['status']
        for result in sorted_results])

    return score, max_score, status
예제 #12
0
def min_group_scorer(test_results):
    """Gets minimal result of all tests inside a test group."""

    scores = [ScoreValue.deserialize(result['score'])
              for result in test_results.itervalues()]
    max_scores = [ScoreValue.deserialize(result['max_score'])
              for result in test_results.itervalues()]

    score = min(scores)
    max_score = min(max_scores)
    if max_score != max(max_scores):
        raise UnequalMaxScores("Tests in one group cannot "
                "have different max scores.")

    sorted_results = sorted(test_results.values(), key=itemgetter('order'))
    status = aggregate_statuses([result['status']
        for result in sorted_results])

    return score, max_score, status
예제 #13
0
파일: utils.py 프로젝트: marmistrz/oioioi
def acm_group_scorer(test_results):
    status = aggregate_statuses([result['status']
            for result in test_results.itervalues()])
    return None, None, status
예제 #14
0
파일: utils.py 프로젝트: marmistrz/oioioi
def acm_score_aggregator(group_results):
    if not group_results:
        return None, None, 'OK'
    status = aggregate_statuses([result['status']
            for result in group_results.itervalues()])
    return BinaryScore(status == 'OK'), BinaryScore(True), status