A quick thumbnail creator for python codes
Project description
Pythumbnail
What is Pythumbnail?
Pythumbnail is a quick thumbnail creator for python codes. You can get an overview of the available functions, for/while loops and if conditions without even running the code.
Suppose you have the following python file:
class someclass:
def __init__(self):
self.a = 10
def do_something(self):
for i in range(len(self.a)):
if i == 2:
print(i)
def do_something_else(self, num):
while self.a < 100:
self.a += num
Here is a small example to show what Pythumbnail could do (Python 3):
import pythumbnail
file = pythumbnail.read_file('some_file.py')
file.scan()
print(file.tree)
The output will look like:
'File some_file.py()'
'class someclass()'
'def __init__(self)'
'def do_something(self)'
'for i in range(len(self.a))'
'if[i,2] LOGIC: [==]'
'def do_something_else(self,num)'
'while[self.a,100] LOGIC: [<]'
Quick Start
To install Pythumbnail, you need python version 3.6.0 or above. Pythumbnail could be installed from pypi:
$ python3 -m pip install pythumbnail
Running Pythumbnail:
import pythumbnail
Usage
Read Documents (This step is necessary to initialize pythumbnail object)
import pythumbnail
file = pythumbnail.read_file('some_file.py') # reads in a new python file
file = pythumbnail.read_file('some_file.py', silent = False) # turns on logging mode (will output all state changes)
file = pythumbnail.read_file('some_file.py', keys = ['for']) # customizes the keywords to capture (default: 'class', 'def', 'for', 'if', 'elif','else:', 'while')
Scan The Document
file.scan()
Output Thumbnail (Document needs to be scanned first)
print(file.tree)
Structure of a Specific Function
b = file.search('some_name')
print(b)
Show Summary (Document needs to be scanned first)
file.show_summary()
Show Entire Text File (Document needs to be scanned first)
file.show_text()
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
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
Hashes for pythumbnail-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb459e361e8c63c333cc270dce7aa619a3e6a71320554a9c23aa491f9480d0da |
|
MD5 | 54900dde2d23b854005bf26c93ccc20c |
|
BLAKE2b-256 | 61b354c7fe7b9b9e4089d4d6c8febf3c02a4021735d40800db331798061f0152 |