Skip to main content

Just a small package used in little guy's projects.

Project description

  • bold(text, start="<b>", end="</b>")

    • text (str): The text to be formatted in bold.
    • start (str, optional): The start tag for bold formatting (default is <b>).
    • end (str, optional): The end tag for bold formatting (default is </b>).

    This function replaces the provided HTML-like <b> and </b> tags with ANSI escape codes to make the text bold in the terminal. For example, if the string contains the tags <b>Text</b>, they will be replaced with the corresponding ANSI escape codes for bold text.

  • print(text="", mode="t", icon=None)

    • text (str, optional): The text to be displayed in the console. If no text is provided, an empty string will be printed.
    • mode (str, optional): Defines the color and category of the message. The following options are supported:
      • "d" — Green (for debug messages).
      • "w" — Yellow (for warnings).
      • "e" — Red (for errors).
      • "c" — Purple (for critical messages).
      • "i" — Cyan (for info messages).
      • "t" — White (for text messages).
    • icon (str, optional): A custom icon to be displayed before the message. If None, the default icon for the given mode will be used.

    The print() function combines color formatting and optional icons to output the message to the console. If the text contains HTML-like tags (<b> and </b>), they will be converted into bold formatting using ANSI escape codes.

  • debug(message, icon=None)

    • message (str): The message to be printed in green color (for debug purposes).
    • icon (str, optional): A custom icon to precede the message. Defaults to the debug icon.

    This function is shorthand for printing a debug message using print() with the "d" mode.

  • info(message, icon=None)

    • message (str): The message to be printed in cyan color (for informational purposes).
    • icon (str, optional): A custom icon to precede the message. Defaults to the info icon.

    This function is shorthand for printing an informational message using print() with the "i" mode.

  • warn(message, icon=None)

    • message (str): The message to be printed in yellow color (for warning purposes).
    • icon (str, optional): A custom icon to precede the message. Defaults to the warning icon.

    This function is shorthand for printing a warning message using print() with the "w" mode.

  • error(message, icon=None)

    • message (str): The message to be printed in red color (for error purposes).
    • icon (str, optional): A custom icon to precede the message. Defaults to the error icon.

    This function is shorthand for printing an error message using print() with the "e" mode.

  • critical(message, icon=None, exit_code=1)

    • message (str): The message to be printed in purple color (for critical errors).
    • icon (str, optional): A custom icon to precede the message. Defaults to the critical icon.
    • exit_code (int, optional): The exit code to be used when terminating the program (default: 1). If exit_code is greater than 0, the program will exit after printing the critical message.

    This function is shorthand for printing a critical message using print() with the "c" mode. It also terminates the program if the exit code is non-zero.

Constants:

  • lgp_default_icons: A dictionary mapping message types (i, d, w, e, c, t) to their default icon representations.
  • COLORS: A dictionary mapping message types (i, d, w, e, c, t) to their corresponding ANSI color codes.

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

lgpmodule-1.1.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

LGPmodule-1.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file lgpmodule-1.1.0.tar.gz.

File metadata

  • Download URL: lgpmodule-1.1.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for lgpmodule-1.1.0.tar.gz
Algorithm Hash digest
SHA256 56a572a4fc532601feba0c8255a233c8b3f01aaffbc15792f7bf8a92fc3df90c
MD5 0da6cd656088003cba3ed73d2ef296c8
BLAKE2b-256 0c0c1bdc5463a0e5f8896e57faff4e1367d269714b615b4a1b576a88d2e470bb

See more details on using hashes here.

File details

Details for the file LGPmodule-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: LGPmodule-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for LGPmodule-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1d4f05d2212135acb8268b5b12fe368d2c227f30f62074c14d086f242826127
MD5 db35534b9f8e5ae423d7d26a625ba8d5
BLAKE2b-256 331b05ec9e65f79a2d18f5121b608e3d9b4308ac1147744792b18c23f0b899dd

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