Git Product home page Git Product logo

libproton's Introduction

LibProton

CircleCI

This is a library which simplifies the task of creating Proton compliant scoring scripts.

It supports Python 3.7+.

Install

Install from PyPI:

pip install libproton

API

The following is a complete and minimal Proton compliant scorer, and shows the expected usage of the library.

#!/usr/bin/env python

import libproton

class Scorer:
    def __init__(self, teams_data, arena_data):
        self._teams_data = teams_data
        self._arena_data = arena_data

    def calculate_scores(self):
        """Main scoring entry point.

           Expected to return a mapping of TLA -> score for each team in
           the input data. Errors either in the input or otherwise should
           be handled by raising exceptions.
        """
        scores = {}
        for tla in self._teams_data.keys():
            scores[tla] = 4
        return scores

    def validate(self, extra_data):
        """An optional additional method to validate the scoresheet.

           If this method is implemented it will be called with the value
           of the ``other`` key from the input. If the key is not present
           then this method will still be called (with ``None``).

           If there are validation errors the this method should raise
           an exception about them.
        """
        pass

if __name__ == '__main__:
    libproton.main(Scorer)

Tests

Run ./script/test.

libproton's People

Contributors

peterjclaw avatar prophile avatar

Watchers

 avatar  avatar

Forkers

prophile

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.