mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
🎨 Format Python code with Black
This commit is contained in:
parent
27ccd2918e
commit
a0bc7926c4
1 changed files with 12 additions and 4 deletions
16
src/log.py
16
src/log.py
|
@ -85,7 +85,7 @@ BORING_LOG_LINES = [
|
||||||
|
|
||||||
def _update_log_parent_symlinks():
|
def _update_log_parent_symlinks():
|
||||||
|
|
||||||
one_year_ago = (time.time() - 365 * 24 * 3600)
|
one_year_ago = time.time() - 365 * 24 * 3600
|
||||||
|
|
||||||
logs = glob.iglob(OPERATIONS_PATH + "*" + METADATA_FILE_EXT)
|
logs = glob.iglob(OPERATIONS_PATH + "*" + METADATA_FILE_EXT)
|
||||||
for log_md in logs:
|
for log_md in logs:
|
||||||
|
@ -134,15 +134,23 @@ def log_list(limit=None, with_details=False, with_suboperations=False):
|
||||||
|
|
||||||
_update_log_parent_symlinks()
|
_update_log_parent_symlinks()
|
||||||
|
|
||||||
one_year_ago = (time.time() - 365 * 24 * 3600)
|
one_year_ago = time.time() - 365 * 24 * 3600
|
||||||
logs = [x for x in os.listdir(OPERATIONS_PATH) if x.endswith(METADATA_FILE_EXT) and os.path.getctime(x) > one_year_ago]
|
logs = [
|
||||||
|
x
|
||||||
|
for x in os.listdir(OPERATIONS_PATH)
|
||||||
|
if x.endswith(METADATA_FILE_EXT) and os.path.getctime(x) > one_year_ago
|
||||||
|
]
|
||||||
logs = list(reversed(sorted(logs)))
|
logs = list(reversed(sorted(logs)))
|
||||||
|
|
||||||
if not with_suboperations:
|
if not with_suboperations:
|
||||||
|
|
||||||
def parent_symlink_points_to_dev_null(log):
|
def parent_symlink_points_to_dev_null(log):
|
||||||
name = log[: -len(METADATA_FILE_EXT)]
|
name = log[: -len(METADATA_FILE_EXT)]
|
||||||
parent_symlink = os.path.join(OPERATIONS_PATH, f".{name}.parent.yml")
|
parent_symlink = os.path.join(OPERATIONS_PATH, f".{name}.parent.yml")
|
||||||
return os.path.islink(parent_symlink) and os.path.realpath(parent_symlink) == "/dev/null"
|
return (
|
||||||
|
os.path.islink(parent_symlink)
|
||||||
|
and os.path.realpath(parent_symlink) == "/dev/null"
|
||||||
|
)
|
||||||
|
|
||||||
logs = [log for log in logs if parent_symlink_points_to_dev_null(log)]
|
logs = [log for log in logs if parent_symlink_points_to_dev_null(log)]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue