LibProton
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.
Release files for libproton 3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| libproton-3.3.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| libproton-3.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 16.0 kB
Release files / libproton-3.3.tar.gz
| Download URL | libproton-3.3.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42f903a41f201a6fa2b8a5edde8c343db04f3037e6a9270c1c1382486acfc0e1
|
|
BLAKE2b-256 checksum How to use checksums |
d9ec13ca32148a042227ed4d0483ba6305f87a07759f37ddd524c0d6029b583d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Release files / libproton-3.3-py2.py3-none-any.whl
| Download URL | libproton-3.3-py2.py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bfdb949ac8306ab0bd201472f651a046c33cc604de53e9c8151cb11d43b9b2a3
|
|
BLAKE2b-256 checksum How to use checksums |
b11dc156cb46f83dd68c7313b1355b03d7158b790b70ae6af83c6b67c96083ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|