U af@sdddlmZddlZddlmZddlmZmZeje dddZ d ejeej e e d d d ZdS) )OptionalN)utc)CANONICAL_TIMESTRING_FORMAT+CANONICAL_TIMESTRING_FORMAT_NO_MICROSECONDS)in_timereturncCst|tdddS)zu Return integer seconds since epoch. :param in_time: Datetime :returns: Integer seconds since epoch i)intdatetime total_seconds)rr E/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/primordial/timeutils.pydatetime_to_epoch_seconds srT)dttz microsecondsrcCsP|rtnt}|jdkr2|dkr&td|j|d}|jtk rF|t}||S)a Return a string representation of a datetime in ISO8601 format (YYYY-MM-DDTHH:MM:SS.ssssssZ) in the UTC (Z) timezone. :param dt: The datetime object. :param tz: The timezone to assume when coverting a naive datetime to UTC (Required if `dt` is naive). :param microseconds: Whether to include microseconds in the representation. Defaults to `True`. :returns: ISO8601-formatted string representation :raises ValueError: If the datetime is naive, and no tz is provided Nz7`tz` param must be provided if datetime object is naive)tzinfo)rrr ValueErrorreplaceUTC astimezonestrftime)rrrZtformatr r r iso8601_utcs     r)NT)typingrr ZpytzrrZprimordial.constantsrrr rrboolstrrr r r r s