Skip to main content

Module utils

Module utils 

Source
Expand description

Generic utility functions

Functionsยง

calculate_sha256
Calculate the SHA256 hash of content and return it as a 64-character lowercase hex string (the standard hex encoding of the 32-byte digest).
current_timestamp
Get current Unix timestamp in seconds
env_flag_enabled
Whether the environment variable var_name is set to an affirmative flag.
extract_readme_excerpt
Get the first meaningful section of the README/markdown as an excerpt
extract_toml_str
Extract a string value from a simple TOML key assignment within the [package] section
parse_bool_env_value
Parse a boolean env-var value, returning None when unrecognized.
parse_env_bool
Read the environment variable name as a boolean, returning default when it is unset or unrecognized.
safe_replace_text
Safe text replacement with validation