A small package that counts TOP-15 racers from data files
Project description
Racers Counter
Racers Counter is a Python package that processes racing logs, including driver names, teams, start times, and stop times. It reads data from log files placed in a folder 'additional', calculates the lap time for each racer, and generates a report with the fastest lap times. It also handles errors in the input data and provides a detailed list of invalid records.
Features
- Reads abbreviations, start, and stop logs to process race records
- Calculates lap times for each driver
- Sorts drivers based on their lap times
- Generates a report with top racers and records with errors
Installation
You can install the package via pip:
pip install racers-countering
Usage
- Prepare the following log files in a directory (by default additional folder):
- abbreviations.txt: Contains abbreviations of drivers and teams.
- start.log: Contains the start time of each driver.
- end.log: Contains the stop time of each driver.
- Import the Record class and call its methods to build and print the report: from racers_counter.record import Record
good_records, bad_records = Record.build_report( folder_path="path_to_your_logs", abbr_file_name="abbreviations.txt", startlog_file_name="start.log", stoplog_file_name="end.log", reverse=False )
print(Record.print_report(good_records, bad_records, under_number=5))
Methods:
Record.read_abbreviations()
Read all abbreviations from 'additional\abbreviations.txt'
Record.build_report()
Builds the race report by reading the abbreviations, start times, and stop times. Returns two lists:
- good_records: List of records that were processed correctly.
- bad_records: List of records with errors.
Record.print_report()
Generates a formatted report based on the provided records.
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
Built Distribution
File details
Details for the file racers_countering-0.0.1.tar.gz
.
File metadata
- Download URL: racers_countering-0.0.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5800c9d18d324a46b44d1179fe0ab5ef92878e68a658f6b008e43a234efd5991 |
|
MD5 | e354c550f75c3422f3eb66cc871b9cba |
|
BLAKE2b-256 | 5b790b1186291d0a1de1b0d703677aef81e6a6f79d4e4618f6617cb996ff0772 |
File details
Details for the file racers_countering-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: racers_countering-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48ef976a803e8de7c35618514af8c740c341d0de6d19406a12b7312723fa9745 |
|
MD5 | 717db5662e942dfb1774a572c5037c86 |
|
BLAKE2b-256 | aff488727936aff17397ca4c4acfc8b0217d6debc1795d70f8d10f1dd4f66da4 |