MD Python Library
Project description
MD Python Library
This package contains high level functions for common Python use cases.
Compare Directories
from mdpython.fileutils import compare
cmp = compare.compare_dirs(r"C:\Users\Dell\OneDrive\Desktop\result_9th",
r"C:\Users\Dell\OneDrive\Desktop\result_9th_v2")
cmp.gen_html_report(r"C:\Users\Dell\OneDrive\Desktop\out.html", ["py", "txt",
"json"])
for fl in cmp.files_only_in_right:
if fl.name.endswith("py"):
print(fl.absolute())
Menu based app
from datetime import datetime
from random import randint, choice
from mdpython.uiutils import menu_based_app
def show_date():
print(datetime.now().strftime("%Y-%m-%d"))
def show_time():
print(datetime.now().strftime("%H:%M:%S"))
def show_date_and_time():
print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
def show_random_number():
print(randint(1, 100))
def show_random_color():
print(choice(['red', 'blue', 'green']))
ar = [
["Random", "Random Integer", show_random_number],
["Random", "Random Color", show_random_color],
["Date", "Show Date", show_date],
["Date", "Show Time", show_time],
["Date", "Show Date and Time", show_date_and_time]
]
menu_based_app.start(ar)
Disk cleanup
from mdpython.fileutils import cleanup
dr = r"C:\Users\Dell\OneDrive\Desktop\result_9th"
info = cleanup.retrieve_info(dr)
print("sorted by time")
for dtl in info.sort_by_time()[:5]:
print(dtl)
print("\nsorted by size")
for dtl in info.sort_by_size()[:5]:
print(dtl)
print("\nmodified in last 30 mins")
for dtl in info.modified_within(mins=30)[:5]:
print(dtl)
print("\nmodified more than 1 day ago")
for dtl in info.modified_before(mins=24 * 60)[:5]:
print(dtl)
print("\nsorted by number of files in directory")
for dtl in info.sort_by_file_count()[:5]:
print(dtl)
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
mdpython-0.0.4.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file mdpython-0.0.4.tar.gz
.
File metadata
- Download URL: mdpython-0.0.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6979f78a306ac105a9a5773175b36f53fca6db4a46b7a8b2428bf1e36d261bde |
|
MD5 | ebaada4cb09cc7bb46d6dc7af36bcf25 |
|
BLAKE2b-256 | 6c2b089d96d8935d71ca3b9332ca3ecdc54545b569000f15af4bfb83ef115434 |
File details
Details for the file mdpython-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: mdpython-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a26af2436c57df63016b204436f1cba9257563a0c2d0a063a271093e6d657b3 |
|
MD5 | f36a42ce5b852a5d6d61195d3dd0de74 |
|
BLAKE2b-256 | c4c603fa6660ee838ab22f39515f0f4c1e4f4dc6ed02e21af3fa956fe90f3210 |