Skip to main content

Useful stuff for TCR projects!

Project description

TCRUtils - yet another utilities package

TCRUtils is a collection of utility functions, classes, and helpers designed to streamline various tasks in projects. Below is a brief overview of some of the key features.

Featured Features (yipee :3)

  • fmt_iterable(x: LITERALLY_ANY_OBJECT_TYPE): Pretty-formats any python object that i have thought of for easier readability, even some third-party-library ones.
  • console, or just tcr.c: Provides hikari-styled logging combined with the above fmt_iterable to pretty-print your debugging! Yay!
  • timestr2: Convert between seconds and readable timestrs. Now with timezones! for example "1h" -> 3600.
  • ShelveDB & sdb2: Quickly and easily set up a dict-based, python built-in shelve module's shelf - a python dictionary able to contain arbitrary python types that persists on restart.

Iterable Helpers

  • Or: Returns the first element of the tuple (arg, *args) that does not equal the supplied (none) variable, by default None. This is different from just doing x or y or y because it does not fail on falsey values, just the ones that are specified to be equal to the noney value
  • batched: py3.12 itertools.batched() in py3.11 with some extra features!
  • cut_at: Cut a string (or an iterable) with a specified suffix for example i'm running out of space on this markdown line so i will use th...
  • shuffled: Returns a shuffled version of an iterable. So you dont have to do random.shuffle(x) which does not return the shuffled

String and Formatting Utilities

  • commafy: Adds commas to numbers for better readability.
  • apostrophe_s: Handles the correct placement of apostrophes if the word ends with s for example "peoples'" and "mike's" (not "peoples's").

Error Handling

  • extract_error and extract_traceback: Extracts the error object's name and the error message (or the traceback's contents).

Decorators

  • @test: Prints a nice block separator containing formatted name of the function before executing
  • @timeit: Measures the execution time of a function and prints it afterwards.

Miscellaneous

  • insist: Prompts user input with a customizable insistence until a valid answer is provided, for example you can keep input()ing the user if they provided invalid value for an integer field.

This package includes many other useful utilities, go look for yourself if you want...

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

tcrutils-13.1.39.tar.gz (145.4 kB view details)

Uploaded Source

Built Distribution

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

tcrutils-13.1.39-py3-none-any.whl (109.3 kB view details)

Uploaded Python 3

File details

Details for the file tcrutils-13.1.39.tar.gz.

File metadata

  • Download URL: tcrutils-13.1.39.tar.gz
  • Upload date:
  • Size: 145.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for tcrutils-13.1.39.tar.gz
Algorithm Hash digest
SHA256 6f0e2a18bb13121cf1cdd041dadbb59d0ffe32f5700c3ef053c0510c6482239d
MD5 27dac49f20ac1aeb4fce11ff73193c79
BLAKE2b-256 7c428fbd7c2a2ce61a4a1ba33ef4eef521d5666450ef63beed0b44721c7201b9

See more details on using hashes here.

File details

Details for the file tcrutils-13.1.39-py3-none-any.whl.

File metadata

  • Download URL: tcrutils-13.1.39-py3-none-any.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for tcrutils-13.1.39-py3-none-any.whl
Algorithm Hash digest
SHA256 5b9add0e0e3d13ef3aabe6cc267778e49e3cb14715e70ac8a7f8499740a096ba
MD5 bbd58618c9970ab27f9f5ae3b5702fde
BLAKE2b-256 7ce2e70abe7f3ad4f04162339f81379c0a07c7729f8f9bf9b96a3e9e804ca2fa

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