Выбор образа при создании машины карточками: название системы, размер, дата загрузки и поиск, когда образов много
Этот коммит содержится в:
@@ -242,6 +242,17 @@ def port_service(port: int) -> str:
|
||||
return WELL_KNOWN_PORTS.get(int(port or 0), "")
|
||||
|
||||
|
||||
MONTHS_GENITIVE = ("января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря")
|
||||
|
||||
|
||||
def short_date(timestamp: float, now: datetime | None = None) -> str:
|
||||
"""«27 сентября», для прошлых лет — «27 сентября 2025»."""
|
||||
moment = datetime.fromtimestamp(timestamp)
|
||||
now = now or datetime.now()
|
||||
text = f"{moment.day} {MONTHS_GENITIVE[moment.month - 1]}"
|
||||
return text if moment.year == now.year else f"{text} {moment.year}"
|
||||
|
||||
|
||||
def format_bytes(value: int | float) -> str:
|
||||
value = float(value or 0)
|
||||
for unit in ("Б", "КБ", "МБ", "ГБ", "ТБ"):
|
||||
|
||||
Ссылка в новой задаче
Block a user