U
    VcK
                     @   sP   d Z ddlmZ ddlmZ dZdZdZdZdZ	dZ
d	ZdZd
d Zdd ZdS )z0Internal information about the pr_curves plugin.    )summary_pb2)plugin_data_pb2Z	pr_curves               c                 C   s2   t jt|d}| }tj| |tjjt|ddS )a[  Create a `summary_pb2.SummaryMetadata` proto for pr_curves plugin data.

    Arguments:
      display_name: The display name used in TensorBoard.
      description: The description to show in TensorBoard.
      num_thresholds: The number of thresholds to use for PR curves.

    Returns:
      A `summary_pb2.SummaryMetadata` protobuf object.
    )versionnum_thresholds)Zplugin_namecontent)display_nameZsummary_descriptionZplugin_data)r   PrCurvePluginDataPROTO_VERSIONZSerializeToStringr   ZSummaryMetadataZ
PluginDataPLUGIN_NAME)r   descriptionr
   Zpr_curve_plugin_datar    r   I/tmp/pip-unpacked-wheel-g8kmtpbc/tensorboard/plugins/pr_curve/metadata.pycreate_summary_metadata$   s      r   c                 C   s0   t | tstdtj| }|jdkr,|S |S )zParse summary metadata to a Python object.

    Arguments:
      content: The `content` field of a `SummaryMetadata` proto
        corresponding to the pr_curves plugin.

    Returns:
      A `PrCurvesPlugin` protobuf object.
    zContent type must be bytesr   )
isinstancebytes	TypeErrorr   r   Z
FromStringr	   )r   resultr   r   r   parse_plugin_metadata<   s    


r   N)__doc__Ztensorboard.compat.protor   Ztensorboard.plugins.pr_curver   r   ZTRUE_POSITIVES_INDEXZFALSE_POSITIVES_INDEXZTRUE_NEGATIVES_INDEXZFALSE_NEGATIVES_INDEXZPRECISION_INDEXZRECALL_INDEXr   r   r   r   r   r   r   <module>   s   