o
    i e@                     @   sX   d Z ddlZddlZddlZddlmZ G dd dZG dd deZG dd	 d	ZdS )
zAHelpers that format the information about experiments as strings.    N)utilc                   @   s$   e Zd ZdZejZejdd ZdS )BaseExperimentFormatterzFAbstract base class for formatting experiment information as a string.c                 C   s   dS )a~  Format the information about an experiment as a representing string.

        Args:
          experiment: An `experiment_pb2.Experiment` protobuf message for the
            experiment to be formatted.
          experiment_url: The URL at which the experiment can be accessed via
            TensorBoard.

        Returns:
          A string that represents the experiment.
        N )self
experimentexperiment_urlr   r   N/var/www/myenv/lib/python3.10/site-packages/tensorboard/uploader/formatters.pyformat_experiment   s   z)BaseExperimentFormatter.format_experimentN)	__name__
__module____qualname____doc__abcABCMeta__metaclass__abstractmethodr	   r   r   r   r   r      s
    r   c                       ,   e Zd ZdZdZ fddZdd Z  ZS )ReadableFormatterz<A formatter implementation that outputs human-readable text.   c                       t    d S Nsuper__init__r   	__class__r   r   r   3      zReadableFormatter.__init__c                 C   s   g }| | d|jpdfd|jpdfd|jfdt|jfdt|jfdt|j	fd	t|j
fd
t|jfdt|jfdt|jfg
}|D ]\}}| d|| j|f  qGd|S )NNamez	[No Name]Descriptionz[No Description]IdCreatedUpdatedRunsTagsScalarszTensor byteszBinary object bytesz	%s %s
)appendnamedescriptionexperiment_idr   format_timecreate_timeupdate_timestrnum_runsnum_tagsnum_scalarstotal_tensor_bytestotal_blob_bytesljust_NAME_COLUMN_WIDTHjoin)r   r   r   outputdatar(   valuer   r   r   r	   6   s,   


z#ReadableFormatter.format_experiment)r
   r   r   r   r5   r   r	   __classcell__r   r   r   r   r   .   
    r   c                       r   )JsonFormatterz7A formatter implementation: outputs experiment as JSON.   c                    r   r   r   r   r   r   r   r   U   r   zJsonFormatter.__init__c                 C   s|   d|fd|j fd|jfd|jfdt|jfdt|jfd|jfd|jfd	|j	fd
|j
fd|jfg}tjt|| jdS )Nurlr(   r)   idcreatedupdatedrunstagsscalarstensor_bytesbinary_object_bytes)indent)r(   r)   r*   r   format_time_absoluter,   r-   r/   r0   r1   r2   r3   jsondumpscollectionsOrderedDict_JSON_INDENT)r   r   r   r8   r   r   r   r	   X   s    zJsonFormatter.format_experiment)r
   r   r   r   rM   r   r	   r:   r   r   r   r   r<   P   r;   r<   )	r   r   rK   rI   tensorboard.uploaderr   r   r   r<   r   r   r   r   <module>   s   "