Skip to main content

Generates rankings

Project description

Ranker

Ranker is a CLI tool that processes results from games and generates a ranking table into stdout.

1. Tarantulas, 6 pts
2. Lions, 5 pts
3. FC Awesome, 1 pt
4. Snakes, 1 pt
5. Grouches, 0 pts

The rules A draw (tie) is worth 1 point and a win is worth 3 points. A loss is worth 0 points. If two or more teams have the same number of points, they should have the same rank and be printed in alphabetical order (as in the tie for 3rd place in the sample data).

Installation & Requirements

Ranker has been tested in Python versions 3.7 - 3.9. It is recomended to have at least Python 3.7 with PIP installed.

Run the following command:

# Install package from PyPI
$ pip install ranker

Usage

Format The input must contain results of games one per line and must have this format:

Lions 3, Snakes 3
Tarantulas 1, FC Awesome 0
Lions 1, FC Awesome 1
Tarantulas 3, Snakes 1
Lions 4, Grouches 0

File

$ ranker path/to/file

Ranker accepts a file path as an optional argument to process the information inside the file and returns the ranking table.

Stdin

$ ranker

If no argument is provided to Ranker, it will read the input from stdin and stop when it finds an empty line then returns the result.

Tests

The tests can be run from the project root directory using the following command:

$ python -m unittest

References

This CLI uses the argparse library for command-line parsing, and the unittest framework for testing, both of which come by default in the Python standard library being this the main reason I decided to use them in the project.

The project was built using setuptools, and distributed to the Python Package Index (PyPI) using twine.

For a detailed Python Packaging Guide visit: https://packaging.python.org/en/latest/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ranker-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ranker-0.0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file ranker-0.0.1.tar.gz.

File metadata

  • Download URL: ranker-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for ranker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bde6b93b640eda44cbe05064d70fbfb89a600f88f85e0d9404a14ac61c9f42fb
MD5 8decce60adff4590bac56f513d0b488e
BLAKE2b-256 737bb31fdc958452afcd1fdb0743083c2c530d613f33a367a8669337f8d55810

See more details on using hashes here.

File details

Details for the file ranker-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ranker-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for ranker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cafc15fc5169daf0a702ae5220dcc16d332eaef8d9e474472cd03a2927b6a0a
MD5 8b05de91ada34abf8f381dda641b8074
BLAKE2b-256 e31f6b7f8007141b3d96292d3026cfedb280a3fdcede218882dd782dc0dbc1cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page