
    1Vh{                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dZ	dZ
 ej                  g ej                  d	      Zd
ZdZdZd Zd Zd Zd Zd Zy)z%Constants used in the HParams plugin.    )summary_pb2)	types_pb2)error)plugin_data_pb2)tensor_utilhparams)r   )dtypeshapez_hparams_/experimentz_hparams_/session_start_infoz_hparams_/session_end_infoc                 R   t        | t        j                        st        dt	        |       z        t        j                         }|j                  |        t        |_        t        j                  t        j                  j                  t        |j                                     S )ak  Returns a summary metadata for the HParams plugin.

    Returns a summary_pb2.SummaryMetadata holding a copy of the given
    HParamsPluginData message in its plugin_data.content field.
    Sets the version field of the hparams_plugin_data_pb copy to
    PLUGIN_DATA_VERSION.

    Args:
      hparams_plugin_data_pb: the HParamsPluginData protobuffer to use.
    z@Needed an instance of plugin_data_pb2.HParamsPluginData. Got: %s)plugin_namecontent)plugin_data)
isinstancer   HParamsPluginData	TypeErrortypeCopyFromPLUGIN_DATA_VERSIONversionr   SummaryMetadata
PluginDataPLUGIN_NAMESerializeToString)hparams_plugin_data_pbr   s     T/home/dcms/DCMS/lib/python3.12/site-packages/tensorboard/plugins/hparams/metadata.pycreate_summary_metadatar   )   s      A A 456
 	
 //1G+,)GO&&//::#W-F-F-H ; 
     c                     t        | d      S )a,  Returns the experiment from HParam's
    SummaryMetadata.plugin_data.content.

    Raises HParamsError if the content doesn't have 'experiment' set or
    this file is incompatible with the version of the metadata stored.

    Args:
      content: The SummaryMetadata.plugin_data.content to use.
    
experiment_parse_plugin_data_asr   s    r   parse_experiment_plugin_datar#   E   s     !,77r   c                     t        | d      S )a  Returns session_start_info from the plugin_data.content.

    Raises HParamsError if the content doesn't have 'session_start_info' set or
    this file is incompatible with the version of the metadata stored.

    Args:
      content: The SummaryMetadata.plugin_data.content to use.
    session_start_infor    r"   s    r   $parse_session_start_info_plugin_datar&   R   s     !*>??r   c                     t        | d      S )a  Returns session_end_info from the plugin_data.content.

    Raises HParamsError if the content doesn't have 'session_end_info' set or
    this file is incompatible with the version of the metadata stored.

    Args:
      content: The SummaryMetadata.plugin_data.content to use.
    session_end_infor    r"   s    r   "parse_session_end_info_plugin_datar)   ^   s     !*<==r   c                 .   t         j                  j                  |       }|j                  t        k7  r,t        j                  dt        d|j                  d|      |j                  |      st        j                  d|d|      t        ||      S )ag  Returns a data oneof's field from plugin_data.content.

    Raises HParamsError if the content doesn't have 'data_oneof_field' set or
    this file is incompatible with the version of the metadata stored.

    Args:
      content: The SummaryMetadata.plugin_data.content to use.
      data_oneof_field: string. The name of the data oneof field to return.
    z#Only supports plugin_data version: z	; found: z in: zExpected plugin_data.z to be set. Got: )	r   r   
FromStringr   r   r   HParamsErrorHasFieldgetattr)r   data_oneof_fieldr   s      r   r!   r!   j   s     "33>>wGK11  "K$7$7F
 	
  01  .
 	
 ; 011r   N)__doc__tensorboard.compat.protor   r   tensorboard.plugins.hparamsr   r   tensorboard.utilr   r   r   make_tensor_protoDT_FLOATNULL_TENSOREXPERIMENT_TAGSESSION_START_INFO_TAGSESSION_END_INFO_TAGr   r#   r&   r)   r!    r   r   <module>r;      sv    , 1 . - 7 (   ,k++i   (7 3 8
8	@	>2r   