bundle.core.utils ================= .. py:module:: bundle.core.utils Attributes ---------- .. autoapisummary:: bundle.core.utils.logger Functions --------- .. autoapisummary:: bundle.core.utils.ensure_path bundle.core.utils.format_duration_ns bundle.core.utils.format_date_ns Module Contents --------------- .. py:data:: logger .. py:function:: ensure_path(path: pathlib.Path | str) -> pathlib.Path Ensures existence of a path's directories. For file paths, creates missing parent directories. For directory paths, creates the directory if missing. Logs creation actions. :param path: Target file or directory path. :type path: Path :returns: Verified path :rtype: Path .. py:function:: format_duration_ns(ns: int) -> str Formats a duration in nanoseconds to a human-readable string. Converts nanoseconds to days, hours, minutes, seconds, milliseconds, and microseconds, displaying only the non-zero units. :param ns: The duration in nanoseconds. :type ns: int :returns: The formatted duration string. :rtype: str .. py:function:: format_date_ns(ns: int) -> str Converts a timestamp in nanoseconds to a formatted UTC date string. Formats the timestamp to include year, month, day, hour, minute, second, and extends to show milliseconds, microseconds, and nanoseconds. :param ns: The timestamp in nanoseconds since the Unix epoch. :type ns: int :returns: The formatted date string in UTC. :rtype: str