Skip to main content

No project description provided

Project description

Code style: black

Introduction

This code provides functions to print colored messages in the console, as well as decorators to print the return values and arguments of a function.

Usage

Functions

The print_colored, print_error, print_log, and print_success functions all take the same arguments:

  • *args: the arguments to be printed.
  • color: the color in which to print the text (default: white).
  • sep: the separator to be used between the arguments (default: " ").
  • end: the character to be used at the end of the printed text (default: "\n").

Example usage:

print_colored("This text is white.")
print_error("This text is red.")
print_log("This text is yellow.")
print_success("This text is green.")

Decorators

The print_return and print_return_info decorators can be used to print the return value and/or arguments of a function.

Example usage:

@print_return
def add_numbers(x, y):
    return x + y

add_numbers(2, 3)
## Output:
# 5            <-     add_numbers

@print_return_info
def multiply_numbers(x, y):
    return x * y

multiply_numbers(2, 3)
## Output: 
# 6             <-     multiply_numbers(2, 3)

Dependencies

colorama = "^0.4.6"

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

printopia-0.4.0.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

printopia-0.4.0-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page