Add decoration to print
Project description
plsline
PlsLine is a Python library that allows you to add the file you printed, the position of which line it is written, the function name, and the function type.
--directory\file_name.py-line_number---type------var_name----------------------var
Usage notes
The contents of the print are output, but the contents can be up to three. If it exceeds that, an error will occur. Please note that you may need to divide it into multiple copies and output it.
The first one is used to obtain type, etc.
from plsline import printsimple as prints
#You can also use plsline
prints("one")
prints("one","two")
prints("one","two","three")
#You can do it with print, but if you do the same thing with plsline, you'll get an error
prints("one","two","three", "four") #error
#Please split it into two
prints("one","two","three")
prints("four")
Compatibility
Plsline only checks its operation on Windows.
Color does not work properly in the old terminal, in that case, please use plssimple or plsmonochrome.
We have only checked the operation in Japanese environments, and the acquisition of var_name etc. should be performed by encoding='utf-8'
I'm using it.
Python versions 3.8 or later are required to use plsline.
Requirements
Only the standard library is used.
#List of imports used
from inspect import (
currentframe,
getfile,
)
import re
import os
from time import sleep
Installation method
python -m pip install plsline
You can test the output of plsline in the terminal by running the following command:
python -m plsline
Usage
Examples of using printsimple
simple does not search for files, outputs lines and types.
##import to make printsimple usable <as> and you can change it to your favorite name, this time it's sinple so I'm going to prints
from plsline import printsimple as prints
##Price setting
view_material = True
price_apple = 500
prints(price_apple,view_print=view_material)
price_orange = 600
prints(price_orange,view_print=view_material)
#Calculate total price
buy = price_apple + price_orange
#confirmation print
prints(buy)
#Output Result
--0008---int--500
--0011---int--600
--0018---int--1100
It shows it in lines 8, 11, and 18,
##import to make printcolor available <as>and then you can change it to your favorite name, this time it's color so I'm going to printc
from plsline import printcolor as printc
##Price setting
view_material = True
price_apple = 500
printc(price_apple,view_print=view_material)
price_orange = 600
printc(price_orange,view_print=view_material)
#Calculate total price
buy = price_apple + price_orange
#confirmation print
printc(buy,color="red")
#{directory} {file_name} {type} {line_number} {var_name} {var}
#Output Result
--admake\printcolor.py-0008---int------price_apple----------------------500
--admake\printcolor.py-0011---int------price_orange---------------------600
--admake\printcolor.py-0018---int------buy------------------------------1100
Argument List
| Argment Name | Type | Default Value | Content |
|---|---|---|---|
| print_normal_content | - | This is the first content of print | |
| print_normal_content_sub | - | This is the second content of print | |
| print_normal_content_three | - | This is the third content of print | |
| view_print | bool | True | print if True |
| line_fast_int | int | 2 | I put - at the beginning to make it easier to distinguish it from regular print |
| line_end_int | int | 0 | You can make it stand out by adding - at the end |
| line_int | int | 3 | The number of - after the filename |
| max_file_int | int | 20 | Set the maximum number of characters for folders and file names, |
| max_var_name_int | int | 30 | Set the maximum number of characters for a variable name |
| max_type_int | int | 9 | Set the maximum number of characters for type |
| sleep_time | int | 0 | Sets the time to pause when output, in units of seconds |
Color arguments Please use name or abbreviation
| Name | Abbreviated name | Default value | Content |
|---|---|---|---|
| color | str | "white" | Change the text color, a list of the compatibility is written separately below. |
| color_back | str | "black" | Change the color of the text background, a list of the corresponding items has been written separately below. |
| colorreset | str | "\033[0m" | Reset color |
| help | bool | False | If the contents is empty and the content is empty, the corresponding color list will be output. printc(help=Ture) |
| Name | Abbreviation | Value | Content Sample |
|---|---|---|---|
| black | b | "\033[30m" | black |
| red | r | "\033[31m" | red |
| green | g | "\033[32m" | green |
| yellow | y | "\033[33m" | yellow |
| blue | bl | "\033[34m" | blue |
| magenta | m | "\033[35m" | magenta |
| cyan | c | "\033[36m" | cyan |
| white | w | "\033[37m" | white |
| reset | r | "\033[0m" | reset |
| Name (Background) | Abbreviation | Value | Content Sample |
|---|---|---|---|
| black | b | "\033[40m" | black background |
| red | r | "\033[41m" | red background |
| green | g | "\033[42m" | green background |
| yellow | y | "\033[43m" | yellow background |
| blue | bl | "\033[44m" | blue background |
| magenta | m | "\033[45m" | magenta background |
| cyan | c | "\033[46m" | cyan background |
| white | w | "\033[47m" | white background |
| reset | r | "\033[0m" | reset |
License MIT
Commercial use is fully permitted
Source code can be copied, modified, and distributed.
There is no obligation to publish the source code, so please use it as you like.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plsline-0.0.1.tar.gz.
File metadata
- Download URL: plsline-0.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0b4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
129d165e2810cd7471948821e29a7473ee70ac082350691cdaa167aee8ddc20f
|
|
| MD5 |
531dab24507c91484e1a7500247420dc
|
|
| BLAKE2b-256 |
d22b25b91255e092498b024a00f66cd3e25f289b697ebc9b864e3cd547484de7
|
File details
Details for the file plsline-0.0.1-py3-none-any.whl.
File metadata
- Download URL: plsline-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0b4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57b0335d354064a689efdb987855e9ae14a86e994c7673d023335388b08ea8a6
|
|
| MD5 |
221f81d553fbab555e988fb0400fc34d
|
|
| BLAKE2b-256 |
0f90d29764837ddb66620ea0325d361d4f2b2d2d585397f325ba7f2864124ba3
|