Tools for Python projects
Project description
mauztoolslib – Dokumentation
Dies ist die Dokumentation für die mauztoolslib-Bibliothek.
Aktuell enthält die Bibliothek disklib für Festplatten- und Speicherinformationen, die Path-Klasse, eine Export-Funktion sowie die HTML-Bibliothek zur Analyse und Manipulation von HTML-Inhalten.
Installation
pip install mauztoolslib
Hinweis:
mauztoolslibenthält aktuelldisklib, HTML-Tools (HTMLReader,Paragraph,Script,Image,Heading),Pathundexport.
Verwendung
DiskUsage
from mauztoolslib.disklib import DiskUsage
disk = DiskUsage("C:/", "GB")
disk.free_on()
disk.usage_on()
disk.total_on()
print(disk)
Export
Die Export-Funktion erlaubt das Speichern von DiskUsage-Instanzen in JSON, CSV oder Excel.
from mauztoolslib.disklib import DiskUsage, export
disk = DiskUsage("C:/", "GB")
disk.free_on()
disk.usage_on()
disk.total_on()
# Export als JSON
export(disk, format="json", filename="disk.json")
# Export als CSV
export(disk, format="csv", filename="disk.csv")
# Export als Excel
export(disk, format="excel", filename="disk.xlsx")
Wichtige Hinweise:
objmuss eine erlaubte Klasse sein (DiskUsage)formatkannjson,csvoderexcelseinfilenamekann ein String oderPath-Objekt sein
HTML-Bibliothek
from mauztoolslib.html import HTMLReader, Script, Paragraph, Image, Heading
html_content = """<html>
<head>
<script src="app.js"></script>
</head>
<body>
<p>Hello World</p>
<img src="logo.png" alt="Logo">
<h1>Main Heading</h1>
</body>
</html>"""
reader = HTMLReader(html_content)
scripts = reader["script"]
paragraphs = reader["p"]
images = reader["img"]
headings = reader["h1"]
Script, Paragraph, Image, Heading
Siehe vorherige Beispiele (Methoden: to_html(), write_to(target), save(path) für Image).
Path
from mauztoolslib.disklib import Path
p = Path("example.txt")
p.write_text("Hallo Welt")
print(p.read_text())
folder = Path("example_folder")
folder.mkdir(parents=True, exist_ok=True)
new_folder = Path("copy_folder")
folder.copy_to(new_folder)
Fehlerbehandlung
- HTMLReader wirft KeyError, wenn ein angefragtes Tag nicht existiert.
- Image wirft ValueError, wenn
save()ohne PIL-Image aufgerufen wird. - Path-Methoden werfen OSError, FileNotFoundError oder NotADirectoryError.
- Export-Funktion wirft TypeError, wenn die Klasse nicht erlaubt ist, und ValueError, wenn das Format unbekannt ist.
Lizenz
mauztoolslib ist unter der MIT-Lizenz lizenziert.
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 mauztoolslib-0.1.2.tar.gz.
File metadata
- Download URL: mauztoolslib-0.1.2.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5a240efc67abfb5b7c1ddfe8e5b9b15f7150d240f57ef63c46d7536b032382b
|
|
| MD5 |
576de7dc73237cd111effad0fbc92d0a
|
|
| BLAKE2b-256 |
96ada356726b4baf8043b54fe6b1cff8aa32fead68b97fabfd964ce29d9e4508
|
File details
Details for the file mauztoolslib-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mauztoolslib-0.1.2-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3229b61a72ef0beb7f9d8d09cfeb7f1c3304b0cda7bad57a5b2eeddc93c97829
|
|
| MD5 |
c66d494b3016079e3da37bcc523f8683
|
|
| BLAKE2b-256 |
cd3ed1b11c574781746475c03447c8ff767c034cdd76e9e78918d84326ed9553
|