A General Purpose Utility package for Python 3
Project description
Beetroot, a general purpose library full of random python functions that I thought were useful. Has file manipulation, random, tts and more! Have fun using it!
Also, to make JSON dumping and reading faster, do pip install ujson or pip install simplejson
If you find a problem, feel free to report it here.
To install the bare minimum from pip, use pip install beetroot, to install all dependencies for all classes, use pip install beetroot[all]
Upgrading python-beetroot uses the command pip install --upgrade beetroot
Warnings/Known Issues:
beetroot.file.bdump() might not work too well, use with caution.
beetroot.file.delete() doesn’t throw errors when trying to delete non-existent files, wtf.
beetroot.crash() doesn’t even do anything, damn my horrible python skills
Yay I fixed the previous crash() bug but the damn thing broke OMFG I DIDN’T EVEN TOUCH ANYTHING WHAT WHY AAAAAAAAAAAA
fixed it, still uses the old system
Different extras installation thingies:
beetroot[all]
beetroot[tts]
beetroot[img]
beetroot[yt]
beetroot[text]
beetroot[ram]
beetroot[keyboard]
beetroot[cython]
Functions and uses:
Bad Obfuscation Stuff:
beetroot.obf.obfuscate(string) ; Minorly obfuscates objects, this is definitely not secure, don’t rely on this being irreversible or secure. If you want to obfuscate Python 3 code, use beetroot.cython()
beetroot.obf.unobfuscate(string) ; Deobfuscates objects made by beetroot.strobfuscate()
Random stuff:
beetroot.random.randint(start, end) ; generates random number but using SystemRandom
beetroot.random.srandint(seed, start, end) ; generates seeded pseudorandom number
Stopwatch stuff:
beetroot.stopwatch.start() ; Starts global stopwatch
beetroot.stopwatch.stop() ; Stops global stopwatch and returns time in milliseconds between start and stop
File Manipulation stuff:
beetroot.file.move(start, end) ; Moves files
beetroot.file.rename(start, end) ; Renames files
beetroot.file.delete(file_to_delete, force=<bool>) ; Deletes files
beetroot.file.dump(file, data) ; Dumps data to file as string or bytestring
beetroot.file.jdump(file, data, pp=<bool>) ; Dumps data
beetroot.file.load(file) ; Reads data from file as string
beetroot.file.bload(file) ; Reads data from file as bytestring
beetroot.file.jload(file) ; Reads data from file as JSON object
TTS stuff:
beetroot.tts.say(text) ; Reads text with tts installed, requires pyttsx3 to be installed or use pip install beetroot[tts]
beetroot.tts.changeRate(text) ; Changes global tts talk speed, requires pyttsx3 to be installed or use pip install beetroot[tts]
beetroot.tts.changeVoice(text) ; Changes global tts voice you can pick ids from 0-n, depending on how many voices you have on your computer, requires pyttsx3 to be installed or use pip install beetroot[tts]
beetroot.tts.changeVolume(text) ; Changes global tts volume, requires pyttsx3 to be installed or use pip install beetroot[tts]
Hash stuff:
beetroot.hashl.hashf(text, secure=<bool>) ; Hashes an object.
beetroot.hashl.dehash(hash) ; Dehashes a hash, this totally works and is definitely possible and is absolutely not a dumb joke that I’m making…
Miscellaneous stuff:
beetroot.objtype(obj) ; python type(), but better
beetroot.test() ; Literally just a hello world program.
beetroot.quicksort(arr) ; Quicksort, which in most cases is slightly faster than Python3’s default Timsort.
beetroot.execfile(file) ; Execute .py script
beetroot.systemstats() ; Returns [Username, OS, OS version, OS architecture, computer nodename, IP address, MAC address]
beetroot.unline(string) ; Makes a multi-line string a single-line string
beetroot.reline(string) ; Reverses beetroot.unline()
beetroot.pixelgrab(x, y) ; Grabs the colour of the pixel on your screen at (x, y), requires PIL, use pip install pillow
beetroot.mousepixelgrab() ; Grabs colour of the pixel at your mouse, requires PIL and pyautogui, use pip install pillow pyautogui or pip install beetroot[img]
beetroot.remove(str, item_to_remove) ; Removes all occurences of item_to_remove in str
beetroot.siteize(str) ; Makes text into site names, for example “hello there” becomes “www.HelloThere.com”
beetroot.taskkill(task) ; I see a task and I E A T it. Pass tasks to it through the “task” argument.
beetroot.crash() ; Crashes pyth-
beetroot.admin() ; Requests UAC elevation on Windows.
beetroot.cython(file, pypath=<path>) ; Generates a cython extension and cleans up afterwards. Requires python installed on PATH to use. Or whatever the Unix equivalent of PATH is. Uses pypath to find your python installation, or you can not include it and it uses sys.executable instead.
beetroot.printn() ; Prints an object without a trailing newline at the end.
beetroot.getch() ; Input, but it only waits for one character.
Memory functions and stuff:
beetroot.mem.mem() ; Returns [All memory, currently used memory, available memory].
beetroot.mem.swapmem() ; Same thing as beetroot.mem(), except it’s Swap memory instead.
Youtube garbage:
beetroot.yt.search(search_term) ; Enter a search term, the function returns the link for the first hit on that search. Requires youtube-search, use pip install youtube-search or pip install beetroot[yt]
beetroot.yt.dl(url, filename, fileformat, playlist=<bool>) ; Downloads a video or playlist from url. Valid codecs include mp3, ogg, wav, m4a, aac, flac, mp4, webm, avi, opus, mkv, mov, flv, aiff and wma. Requires youtube-dl, use pip install youtube-dl or pip install beetroot[yt]
Text manipulation stuff:
beetroot.text.udown(text) ; Flips text upside-down
beetroot.text.zalgo(text, crazy=<int>) ; Adds zalgo to text, change crazy argument to modify craziness of zalgo text, default value is 1
beetroot.text.rouxls(sentence) ; Rouxls-ify text so it sounds stupid.
beetroot.text.spamton(text) ; Spamtonify text so you sound like [[Spamton G. Spamton]]
beetroot.text.greek(text) ; Replaces English alphabet with Greek alphabet.
beetroot.text.russian(text) ; Replaces English alphabet with Cyrillic alphabet.
beetroot.text.reverse(text) ; Self-explanatory. Reverses text.
beetroot.text.b65536encode(text) ; Encodes text into Base65536.
beetroot.text.base65536decode(text) ; Decodes Base65536.
beetroot.text.phoneencode(text) ; Encodes text using a cellphone keypad
beetroot.text.phonedecode(text) ; Reverses beetroot.text.phoneencode()
Compression class:
beetroot.comp.compress(string) ; Compress an object using hybrid zlib/lzma
beetroot.comp.decompress(string) ; Reverses beetroot.comp.compress().
M A T H .
beetroot.math.increment(n) ; Increments n.
beetroot.math.double(n) ; Doubles n.
beetroot.math.square(n) ; Squares n.
beetroot.math.sqrt(n) ; Square roots n.
beetroot.math.factorial(n) ; Calculates the factorial of a number.
PICKLES.
beetroot.pkl.pkl(pickle, file_path_to_output_delicious_pickle) ; pass data and it gets turned into a big green pickle.
beetroot.pkl.unpkl(file_path_to_load_delicious_pickle_from) ; load pickle from pickle to eat pickle loaded from pickle.
Amazing functions that should be called whenever possible
beetroot.beetroot() ; A great function that you should call whenever you can
beetroot.totally_not_a_rickroll() ; Totally not a rickroll.
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 Beetroot-1.1.6.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7923b45360c0102a498ad3d9e3a93732f4848142b1ca182121b083c524f4b491 |
|
MD5 | 8854254a6e37ec89da25a9c079be592a |
|
BLAKE2b-256 | 7edbf79fa6e7cc823697f54c69bc37877afd4377fe020debaa2b243866485521 |