mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-10-10 20:29:37 +00:00

* Refactory code / object handling * Next step * fix lint * Step 2 * Cleanup API code * cleanup addons code * cleanup data handling * Cleanup addons data handling * Cleanup docker api * clean docker api p2 * next cleanup round * cleanup start on snapshots * update format strings * fix setup * fix lint * fix lint * fix lint * fix tox * Fix wrong import of datetime module * Fix bug with attributes * fix extraction * Update core * Update logs * Expand scheduler * add support for time interval objects * next updates on tasks * Fix some things * Cleanup code / supervisor * fix lint * Fix some code styles * rename stuff * cleanup api call reload * fix lock replacment * fix lint * fix lint * fix bug * fix wrong config links * fix bugs * fix bug * Update version on startup * Fix some bugs * fix bug * Fix snapshot * Add wait boot options * fix lint * fix default config * fix snapshot * fix snapshot * load snapshots on startup * add log message at the end * Some cleanups * fix bug * add logger * add logger for supervisor update * Add more logger
22 lines
565 B
Python
22 lines
565 B
Python
"""Util addons functions."""
|
|
import hashlib
|
|
import shutil
|
|
|
|
|
|
def create_slug(name, date_str):
|
|
"""Generate a hash from repository."""
|
|
key = "{} - {}".format(date_str, name).lower().encode()
|
|
return hashlib.sha1(key).hexdigest()[:8]
|
|
|
|
|
|
def remove_folder(folder):
|
|
"""Remove folder data but not the folder itself."""
|
|
for obj in folder.iterdir():
|
|
try:
|
|
if obj.is_dir():
|
|
shutil.rmtree(str(obj), ignore_errors=True)
|
|
else:
|
|
obj.unlink()
|
|
except (OSError, shutil.Error):
|
|
pass
|