Skip to main content

Utilities for Standard Ranklist (srk).

Project description

algoux-standard-ranklist-utils

Python utilities for Standard Ranklist (srk).

Supported srk versions: >=0.3.0 <0.4.0.

Install

pip install algoux-standard-ranklist-utils

Usage Sample

from standard_ranklist_utils import diagnose_ranklist, format_time_duration, patch_ranklist, resolve_text, sort_rows

format_time_duration([1.5, "h"], "min")  # 90
resolve_text({"fallback": "English", "zh-CN": "中文"}, ["zh-CN"])  # 中文
sort_rows(ranklist["rows"], ranklist.get("sorter", {}).get("config"))
diagnostics = diagnose_ranklist(ranklist)
patched = patch_ranklist(ranklist, {"type": "srk-patch", "version": 1, "operations": []})

Utilities

formatters

  • format_time_duration: Convert an srk TimeDuration between ms, s, min, h, and d.
  • pre_zero_fill: Left-pad a number with zeroes for fixed-width display.
  • sec_to_time_str: Format elapsed seconds as a ranklist time string such as 1:02:03 or 1D 1:02:03.
  • number_to_alphabet: Convert a zero-based problem index to an alphabetic alias such as A, Z, or AA.
  • alphabet_to_number: Convert an alphabetic problem alias back to a zero-based index.

resolvers

  • resolve_text: Resolve plain or i18n srk text using explicit language preferences and fallback text.
  • resolve_contributor: Parse a contributor string into name, optional email, and optional url.
  • resolve_color: Normalize an srk color value to a CSS color string.
  • resolve_theme_color: Expand a single color or theme color object into explicit light and dark colors.
  • resolve_style: Resolve text/background style colors and auto-pick readable text color when needed.
  • resolve_user_markers: Resolve a user's marker IDs to marker definitions from the ranklist config.

ranklist

  • sort_rows: Sort rows by ICPC solved count descending and penalty time ascending, with optional ranking-time precision.
  • regenerate_ranklist_by_solutions: Rebuild rows, scores, sorting, and problem statistics from solution tetrads.
  • regenerate_rows_by_incremental_solutions: Apply incremental solution tetrads to existing rows and re-sort them.
  • convert_to_static_ranklist: Add precomputed per-series rank values and segment indexes to each row.

diagnostics and patch

  • diagnose_ranklist: Inspect SRK completeness/correctness and return structured issues plus repair suggestions.
  • patch_ranklist: Apply a pure srk-patch object to a deep-copied ranklist.
  • create_ranklist_patch_from_diagnostics: Convert diagnostic suggestions into an applicable srk-patch.

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

algoux_standard_ranklist_utils-0.3.2.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

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

algoux_standard_ranklist_utils-0.3.2-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file algoux_standard_ranklist_utils-0.3.2.tar.gz.

File metadata

File hashes

Hashes for algoux_standard_ranklist_utils-0.3.2.tar.gz
Algorithm Hash digest
SHA256 cef026976836b7355770f556cff19cee024c61f738ec85c327ec4cd72c78e532
MD5 a54388a4ec2eef27111ff08cb5918172
BLAKE2b-256 47fcc9953a114db79bdecff1f39d050b7f574a61cde23e4704df3efeaedb1661

See more details on using hashes here.

Provenance

The following attestation bundles were made for algoux_standard_ranklist_utils-0.3.2.tar.gz:

Publisher: release.yml on algoux/standard-ranklist-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file algoux_standard_ranklist_utils-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for algoux_standard_ranklist_utils-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 849bbf2c958631dfebb82efa026e5cde79a2cdf061e30e82fda379f9eb473148
MD5 da8919a9296bc8566495c78cee3a181e
BLAKE2b-256 b4dedd22f31e28f08c461f1fa6616141c4e8f8047048adfb9eaac030c37bdcdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for algoux_standard_ranklist_utils-0.3.2-py3-none-any.whl:

Publisher: release.yml on algoux/standard-ranklist-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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