o
    ez                     @   s\   d Z ddlZddlZddlZddlmZ G dd deZG dd deZG dd	 d	e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   OD:\Projects\ConvertPro\env\Lib\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 t|   d S N)superr   __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]ZIdCreatedZUpdatedZRunsZTagsZScalarszTensor byteszBinary object bytesz	%s %s
)appendnamedescriptionexperiment_idr   Z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   r.   r   r	   __classcell__r   r   r   r   r   .   
    r   c                       r   )JsonFormatterz7A formatter implementation: outputs experiment as JSON.   c                    r   r   )r   r5   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tagsZscalarsZtensor_bytesZbinary_object_bytes)indent)r"   r#   r$   r   Zformat_time_absoluter%   r&   r(   r)   r*   r+   r,   jsondumpscollectionsOrderedDict_JSON_INDENT)r   r   r   r1   r   r   r   r	   X   s    zJsonFormatter.format_experiment)r
   r   r   r   rB   r   r	   r3   r   r   r   r   r5   P   r4   r5   )
r   r   r@   r>   Ztensorboard.uploaderr   objectr   r   r5   r   r   r   r   <module>   s   "