Skip to main content

Usefull methods cause i'm lazy and they made everything easier and fancier(check project link for a decent README)

Project description

LazyT

Compilation of methods for speeding up the boring tasks such as build banner, ask for y/n or change the color for an error/warning message.


Table of contents


Install and Update

Install

pip3 install LazyT==[version]

update

pip3 install lazyt -U

(released whenever a bunch of new method are developed and successfully tested)


Function Description

class Function name Description Return value
lazyt yon(question,deaf=True) Accept only Y/n input. True/False
lazyt clear_console() clear the console None
lazyt create_banner(options,cols=3) Build personalized banner str
tprint info(text) Print the text in yellow None
tprint error(text) Print the text in red None
tprint system(text) Print the text in blue None
Loader Loader(runningmsg='', endmsg='', timeout=0.1) initialize a Loader() element None
Loader start() start the Loader element None
Loader stop() stop the Loader element None

(All the example code shown below is in the "example.py" file inside the <lazyt> directory)


Notation

The line marked as follow:

#>>> stuff

are used for showing the console output of the previous command.

def main():
	print("Hello!")
	#>>> Hello!

All the arguments are mandatory except for the args defined as "method(arg=value)" which are, by definition optional and already with a default value.

def default_example(ex="default text"):
	print(ex)
def main():
	default_example()
	#>>> default text
	default_example(ex="different text")
	#>>> different text

Function usage

Import the library

from lazyt import *

lazyt

yon(question,deaf=True)
def main():
    proceed=lazyt.yon("Would you like to proceed?")
    #>>>Would you like to proceed?[Y/n]:
    if(proceed):
        print("Positive")
    else:
        print("never mind, bye")
        exit(0)

    #Default param is True, for setting it to False use:
    proceed=lazyt.yon("Would you like to proceed?",deaf=False)
    #>>>Would you like to proceed?[y/N]:
    if(proceed):
        print("positive pt.2")
clear_console()
def main():
	trash=os.urandom(10000)
    print("{}\n\nThere's something on your console!".format(trash))
	input("Press any button to wipe it away!")
    lazyt.clear_console()
    print("You're welcome.\n")
create_banner(options,cols=3)
def main():
    options=['first choice','second choice','third choice',
            'fourth choice','fifth choice','sixth choice']

    print(lazyt.create_banner(options))
    #>>> [0] first choice 	[1] second choice	[2] third choice
    #>>> [3] fourth choice	[4] fifth choice 	[5] sixth choice

    #Default number of cols is 3
    print(lazyt.create_banner(options,cols=2))
    #>>> [0] first choice 	[1] second choice
    #>>> [2] third choice 	[3] fourth choice
    #>>> [4] fifth choice 	[5] sixth choice

tprint

def main():
    tprint.info("info, yellow text")
    #>>>(yellow)info, yellow text
    tprint.error("error, red text")
    #>>>(red)error, red text
    tprint.system("system, blue text")
    #>>>(blue)system, blue text

Loader

def main():
    import time

    l = Loader("While working message...", "Work done message!", 0.05).start()
    #>>>While working message... ⣽
    for i in range(10):
        time.sleep(0.25)
    l.stop()
    #delete the working message and write
    #>>>Work done message!

Annotations

If you have some cool methods feel free to ping me or create a merge request, this package have the only purpose of simplifying and speeding up the boring task and why not making even a small script look more aesthetic without too much effort.\

All this methods are developed by me - @ThomasAndreatta - in different project and copy-pasting the methods -or the class file - between the different repo was too much effort for me, that's why i've decided to build a pypi package, in this way wherever i am i can simply type

import lazyt

and i'm good to go.
Funny how being lazy leaded me to BUILD a package with all the documentation instead of coping and pasting a file.
Yeah, LazyT 'cause i'm T, and i'm lazy.

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

lazyt-1.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

lazyt-1.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lazyt-1.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for lazyt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bb34af185b4f5be4d7907cd491df934263515c1d94f184e911d82ff0ba1425a6
MD5 8482fb4ff2065916d58eb234846f8c59
BLAKE2b-256 4729e6c347ce4df97b80a0f8767f5112d9c7dd7c90cfb6ec574eae4267dcd866

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lazyt-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for lazyt-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08e398ad9352159199312658c0c8810fa9cb43ab963943e7fe3fbfe4d33b730d
MD5 67e24509028f5f5f6cdad97b6aa477a8
BLAKE2b-256 855154547cebdef26b0c101914cae0a1e9d3b04e43b96e0270acc9fb6834e6ed

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