Skip to main content

A small package to block print statements

Project description

HiddenPrints

workflow

Sick of unnecessary prints from other libraries? Simply block them of with this small package

Install

via pip

pip install hiddenprint

Usage

1) with-Wrapper

To use the blocking mechanisms inside of methods for one or more lines of code, just wrap it in a with-statement

from hiddenprint import *

with HiddenPrints():
    # code where prints should not be visible in the console
    print("This won't be printed")

# code where prints should be visible in the console
print("Hello World!")

2) Function Decorator Flag

To block prints right up for a self defined function, decorator annotations can be used to block all prints within the function.

from hiddenprint import *

@hide
def print_nothing_and_sum(a: int, b: int):
    print("something nobody can see")
    return a + b

result = print_nothing_and_sum(4, 3) 
print(result) # prints 7

Contribution

This is only a very small package and project. If you have some ideas to improve the quality of life, feel free to make a pull request.

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

hiddenprint-0.0.2.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

hiddenprint-0.0.2-py3-none-any.whl (2.9 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