a
    d=ic؉                     @   s   d Z ddlZddlZG dd dejdZG dd deZG dd	 d	eZG d
d deZ	G dd de	Z
G dd deZG dd de	ZG dd deZG dd de	ZG dd deZG dd deZG dd deZdS )z>Experimental framework for generic TensorBoard data providers.    Nc                   @   s   e Zd ZdZdddZdddZejdddZejddd	d
dZ	ejddddddZ
ddd	ddZddddddZd dd	ddZd!dddddZd"ddZdS )#DataProvidera!  Interface for reading TensorBoard scalar, tensor, and blob data.

    These APIs are under development and subject to change. For instance,
    providers may be asked to implement more filtering mechanisms, such as
    downsampling strategies or domain restriction by step or wall time.

    The data provider interface specifies three *data classes*: scalars,
    tensors, and blob sequences. All data is stored in *time series* for
    one of these data classes. A time series is identified by run name and
    tag name (each a non-empty text string), as well as an experiment ID
    and plugin name (see below). Points in a time series are uniquely
    indexed by *step*, an arbitrary non-negative integer. Each point in a
    time series also has an associated wall time, plus its actual value,
    which is drawn from the corresponding data class.

    Each point in a scalar time series contains a single scalar value, as
    a 64-bit floating point number. Scalars are "privileged" rather than
    being subsumed under tensors because there are useful operations on
    scalars that don't make sense in the general tensor case: e.g., "list
    all scalar time series with tag name `accuracy` whose exponentially
    weighted moving average is at least 0.999".

    Each point in a tensor time series contains a tensor of arbitrary
    dtype (including byte strings and text strings) and shape (including
    rank-0 tensors, a.k.a. scalars). Each tensor is expected to be
    "reasonably small" to accommodate common database cell size limits.
    For instance, a histogram with a bounded number of buckets (say, 30)
    occupies about 500 bytes, and a PR curve with a bounded number of
    thresholds (say, 201) occupies about 5000 bytes. These are both well
    within typical database tolerances (Google Cloud Spanner: 10 MiB;
    MySQL: 64 KiB), and would be appropriate to store as tensors. By
    contrast, image, audio, or model graph data may easily be multiple
    megabytes in size, and so should be stored as blobs instead. The
    tensors at each step in a time series need not have the same dtype or
    shape.

    Each point in a blob sequence time series contains an ordered sequence
    of zero or more blobs, which are arbitrary data with no tensor
    structure. These might represent PNG-encoded image data, protobuf wire
    encodings of TensorFlow graphs, or PLY-format 3D mesh data, for some
    examples. This data class provides blob *sequences* rather than just
    blobs because it's common to want to take multiple homogeneous samples
    of a given time series: say, "show me the bounding box classifications
    for 3 random inputs from this batch". A single blob can of course be
    represented as a blob sequence that always has exactly one element.

    When reading time series, *downsampling* refers to selecting a
    subset of the points in each time series. Downsampling only occurs
    across the step axis (rather than, e.g., the blobs in a single blob
    sequence datum), and occurs individually within each time series.
    When downsampling, the latest datum should always be included in the
    sample, so that clients have a view of metrics that is maximally up
    to date. Implementations may choose to force the first (oldest)
    datum to be included in each sample as well, but this is not
    required; clients should not make assumptions either way. The
    remainder of the points in the sample should be selected uniformly
    at random from available points. Downsampling should be
    deterministic within a time series. It is also useful for the
    downsampling behavior to depend only on the set of step values
    within a time series, such that two "parallel" time series with data
    at exactly the same steps also retain the same steps after
    downsampling.

    Every time series belongs to a specific experiment and is owned by a
    specific plugin. (Thus, the "primary key" for a time series has four
    components: experiment, plugin, run, tag.) The experiment ID is an
    arbitrary URL-safe non-empty text string, whose interpretation is at
    the discretion of the data provider. As a special case, the empty
    string as an experiment ID denotes that no experiment was given. Data
    providers may or may not fully support an empty experiment ID. The
    plugin name should correspond to the `plugin_data.plugin_name` field
    of the `SummaryMetadata` proto passed to `tf.summary.write`.

    All methods on this class take a `RequestContext` parameter as the
    first positional argument. This argument is temporarily optional to
    facilitate migration, but will be required in the future.

    Unless otherwise noted, any methods on this class may raise errors
    defined in `tensorboard.errors`, like `tensorboard.errors.NotFoundError`.

    If not implemented, optional methods may return `None`.
    Nc                C   s   t  S )a  Retrieve metadata of a given experiment.

        The metadata may include fields such as name and description
        of the experiment, as well as a timestamp for the experiment.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id:  ID of the experiment in question.

        Returns:
          An `ExperimentMetadata` object containing metadata about the
          experiment.
        )ExperimentMetadataselfctxexperiment_id r   j/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/tensorboard/data/provider.pyexperiment_metadatak   s    z DataProvider.experiment_metadatac                C   s   dS )a  List all plugins that own data in a given experiment.

        This should be the set of all plugin names `p` such that calling
        `list_scalars`, `list_tensors`, or `list_blob_sequences` for the
        given `experiment_id` and plugin name `p` gives a non-empty
        result.

        This operation is optional, but may later become required.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.

        Returns:
          A collection of strings representing plugin names, or `None`
          if this operation is not supported by this data provider.
        Nr   r   r   r   r	   list_plugins{   s    zDataProvider.list_pluginsc                C   s   dS )a>  List all runs within an experiment.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.

        Returns:
          A collection of `Run` values.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r	   	list_runs   s    zDataProvider.list_runs)run_tag_filterc                C   s   dS )a  List metadata about scalar time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created
            the data to be queried. Required.
          run_tag_filter: Optional `RunTagFilter` value. If omitted, all
            runs and tags will be included.

        The result will only contain keys for run-tag combinations that
        actually exist, which may not include all entries in the
        `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a `ScalarTimeSeries`
          value.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   plugin_namer   r   r   r	   list_scalars   s    zDataProvider.list_scalars)
downsampler   c                C   s   dS )a]  Read values from scalar time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created
            the data to be queried. Required.
          downsample: Integer number of steps to which to downsample the
            results (e.g., `1000`). See `DataProvider` class docstring
            for details about this parameter. Required.
          run_tag_filter: Optional `RunTagFilter` value. If provided, a time
            series will only be included in the result if its run and tag
            both pass this filter. If `None`, all time series will be
            included.

        The result will only contain keys for run-tag combinations that
        actually exist, which may not include all entries in the
        `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a list of
          `ScalarDatum` values sorted by step.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r   r   r   r   r   r	   read_scalars   s    $zDataProvider.read_scalarsc                C   s   dS )a  List metadata about tensor time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created
            the data to be queried. Required.
          run_tag_filter: Optional `RunTagFilter` value. If omitted, all
            runs and tags will be included.

        The result will only contain keys for run-tag combinations that
        actually exist, which may not include all entries in the
        `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a `TensorTimeSeries`
          value.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r	   list_tensors   s    zDataProvider.list_tensorsc                C   s   dS )a]  Read values from tensor time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created
            the data to be queried. Required.
          downsample: Integer number of steps to which to downsample the
            results (e.g., `1000`). See `DataProvider` class docstring
            for details about this parameter. Required.
          run_tag_filter: Optional `RunTagFilter` value. If provided, a time
            series will only be included in the result if its run and tag
            both pass this filter. If `None`, all time series will be
            included.

        The result will only contain keys for run-tag combinations that
        actually exist, which may not include all entries in the
        `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a list of
          `TensorDatum` values sorted by step.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r	   read_tensors   s    #zDataProvider.read_tensorsc                C   s   dS )a  List metadata about blob sequence time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created the data
            to be queried. Required.
          run_tag_filter: Optional `RunTagFilter` value. If omitted, all runs and
            tags will be included. The result will only contain keys for run-tag
            combinations that actually exist, which may not include all entries in
            the `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a `BlobSequenceTimeSeries`
          value.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r	   list_blob_sequences  s    z DataProvider.list_blob_sequencesc                C   s   dS )a]  Read values from blob sequence time series.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          experiment_id: ID of enclosing experiment.
          plugin_name: String name of the TensorBoard plugin that created the data
            to be queried. Required.
          downsample: Integer number of steps to which to downsample the
            results (e.g., `1000`). See `DataProvider` class docstring
            for details about this parameter. Required.
          run_tag_filter: Optional `RunTagFilter` value. If provided, a time series
            will only be included in the result if its run and tag both pass this
            filter. If `None`, all time series will be included. The result will
            only contain keys for run-tag combinations that actually exist, which
            may not include all entries in the `run_tag_filter`.

        Returns:
          A nested map `d` such that `d[run][tag]` is a list of
          `BlobSequenceDatum` values sorted by step.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   r   r   r   r	   read_blob_sequences7  s     z DataProvider.read_blob_sequencesc                C   s   dS )ao  Read data for a single blob.

        Args:
          ctx: A TensorBoard `RequestContext` value.
          blob_key: A key identifying the desired blob, as provided by
            `read_blob_sequences(...)`.

        Returns:
          Raw binary data as `bytes`.

        Raises:
          tensorboard.errors.PublicError: See `DataProvider` class docstring.
        Nr   )r   r   blob_keyr   r   r	   	read_blobY  s    zDataProvider.read_blob)N)N)N)N)N)N)N)N)N)N)__name__
__module____qualname____doc__r
   r   abcabstractmethodr   r   r   r   r   r   r   r   r   r   r   r	   r      sF   S

  &  &  "r   )	metaclassc                   @   st   e Zd ZdZdddddddZedd Zed	d
 Zedd Zedd Z	dd Z
dd Zdd Zdd ZdS )r   aI  Metadata about an experiment.

    All fields have default values: i.e., they will always be present on
    the object, but may be omitted in a constructor call.

    Attributes:
      data_location: A human-readable description of the data source, such as a
        path to a directory on disk.
      experiment_name: A user-facing name for the experiment (as a `str`).
      experiment_description: A user-facing description for the experiment
        (as a `str`).
      creation_time: A timestamp for the creation of the experiment, as `float`
        seconds since the epoch.
     r   )data_locationexperiment_nameexperiment_descriptioncreation_timec                C   s   || _ || _|| _|| _d S N_data_location_experiment_name_experiment_description_creation_time)r   r"   r#   r$   r%   r   r   r	   __init__z  s    zExperimentMetadata.__init__c                 C   s   | j S r&   )r(   r   r   r   r	   r"     s    z ExperimentMetadata.data_locationc                 C   s   | j S r&   )r)   r-   r   r   r	   r#     s    z"ExperimentMetadata.experiment_namec                 C   s   | j S r&   )r*   r-   r   r   r	   r$     s    z)ExperimentMetadata.experiment_descriptionc                 C   s   | j S r&   )r+   r-   r   r   r	   r%     s    z ExperimentMetadata.creation_timec                 C   s   | j | j| j| jfS )z#Helper for `__eq__` and `__hash__`.r'   r-   r   r   r	   	_as_tuple  s
    zExperimentMetadata._as_tuplec                 C   s   t |tsdS |  | kS )NF)
isinstancer   r.   r   otherr   r   r	   __eq__  s    
zExperimentMetadata.__eq__c                 C   s   t |  S r&   )hashr.   r-   r   r   r	   __hash__  s    zExperimentMetadata.__hash__c                 C   s6   dd d| jf d| jf d| jf d| jf f S )NzExperimentMetadata(%s), zdata_location=%rzexperiment_name=%rzexperiment_description=%rzcreation_time=%r)joinr"   r)   r*   r+   r-   r   r   r	   __repr__  s    



zExperimentMetadata.__repr__N)r   r   r   r   r,   propertyr"   r#   r$   r%   r.   r2   r4   r7   r   r   r   r	   r   j  s$   



	r   c                   @   sX   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	dd Z
dd Zdd ZdS )RunaQ  Metadata about a run.

    Attributes:
      run_id: A unique opaque string identifier for this run.
      run_name: A user-facing name for this run (as a `str`).
      start_time: The wall time of the earliest recorded event in this
        run, as `float` seconds since epoch, or `None` if this run has no
        recorded events.
    _run_id	_run_name_start_timec                 C   s   || _ || _|| _d S r&   r:   )r   run_idrun_name
start_timer   r   r	   r,     s    zRun.__init__c                 C   s   | j S r&   )r;   r-   r   r   r	   r>     s    z
Run.run_idc                 C   s   | j S r&   )r<   r-   r   r   r	   r?     s    zRun.run_namec                 C   s   | j S r&   )r=   r-   r   r   r	   r@     s    zRun.start_timec                 C   sB   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS dS NFT)r/   r9   r;   r<   r=   r0   r   r   r	   r2     s    
z
Run.__eq__c                 C   s   t | j| j| jfS r&   )r3   r;   r<   r=   r-   r   r   r	   r4     s    zRun.__hash__c                 C   s,   dd d| jf d| jf d| jf f S )NzRun(%s)r5   z	run_id=%rzrun_name=%rzstart_time=%r)r6   r;   r<   r=   r-   r   r   r	   r7     s    


zRun.__repr__N)r   r   r   r   	__slots__r,   r8   r>   r?   r@   r2   r4   r7   r   r   r   r	   r9     s   



r9   c                   @   sX   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	edd Z
edd ZdS )_TimeSerieszMetadata about time series data for a particular run and tag.

    Superclass of `ScalarTimeSeries`, `TensorTimeSeries`, and
    `BlobSequenceTimeSeries`.
    	_max_step_max_wall_time_plugin_content_description_display_namec                C   s"   || _ || _|| _|| _|| _d S r&   rD   )r   max_stepmax_wall_timeplugin_contentdescriptiondisplay_namer   r   r	   r,     s
    	z_TimeSeries.__init__c                 C   s   | j S r&   )rE   r-   r   r   r	   rJ     s    z_TimeSeries.max_stepc                 C   s   | j S r&   )rF   r-   r   r   r	   rK     s    z_TimeSeries.max_wall_timec                 C   s   | j S r&   )rG   r-   r   r   r	   rL     s    z_TimeSeries.plugin_contentc                 C   s   | j S r&   )rH   r-   r   r   r	   rM     s    z_TimeSeries.descriptionc                 C   s   | j S r&   )rI   r-   r   r   r	   rN     s    z_TimeSeries.display_nameN)r   r   r   r   rB   r,   r8   rJ   rK   rL   rM   rN   r   r   r   r	   rC     s   



rC   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	ScalarTimeSeriesa/  Metadata about a scalar time series for a particular run and tag.

    Attributes:
      max_step: The largest step value of any datum in this scalar time series; a
        nonnegative integer.
      max_wall_time: The largest wall time of any datum in this time series, as
        `float` seconds since epoch.
      plugin_content: A bytestring of arbitrary plugin-specific metadata for this
        time series, as provided to `tf.summary.write` in the
        `plugin_data.content` field of the `metadata` argument.
      description: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified.
      display_name: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified. Deprecated; may be removed soon.
    c                 C   sb   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS | j|jkrNdS | j|jkr^dS dS rA   )r/   rO   rE   rF   rG   rH   rI   r0   r   r   r	   r2   -  s    
zScalarTimeSeries.__eq__c                 C   s   t | j| j| j| j| jfS r&   r3   rE   rF   rG   rH   rI   r-   r   r   r	   r4   <  s    zScalarTimeSeries.__hash__c              	   C   s@   dd d| jf d| jf d| jf d| jf d| jf f S )NzScalarTimeSeries(%s)r5   max_step=%rmax_wall_time=%rplugin_content=%rdescription=%rdisplay_name=%rr6   rE   rF   rG   rH   rI   r-   r   r   r	   r7   G  s    




zScalarTimeSeries.__repr__Nr   r   r   r   r2   r4   r7   r   r   r   r	   rO     s   rO   c                   @   sX   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	dd Z
dd Zdd ZdS )ScalarDatumav  A single datum in a scalar time series for a run and tag.

    Attributes:
      step: The global step at which this datum occurred; an integer. This
        is a unique key among data of this time series.
      wall_time: The real-world time at which this datum occurred, as
        `float` seconds since epoch.
      value: The scalar value for this datum; a `float`.
    _step
_wall_time_valuec                 C   s   || _ || _|| _d S r&   rY   )r   step	wall_timevaluer   r   r	   r,   `  s    zScalarDatum.__init__c                 C   s   | j S r&   rZ   r-   r   r   r	   r]   e  s    zScalarDatum.stepc                 C   s   | j S r&   r[   r-   r   r   r	   r^   i  s    zScalarDatum.wall_timec                 C   s   | j S r&   )r\   r-   r   r   r	   r_   m  s    zScalarDatum.valuec                 C   sB   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS dS rA   )r/   rX   rZ   r[   r\   r0   r   r   r	   r2   q  s    
zScalarDatum.__eq__c                 C   s   t | j| j| jfS r&   )r3   rZ   r[   r\   r-   r   r   r	   r4   |  s    zScalarDatum.__hash__c                 C   s,   dd d| jf d| jf d| jf f S )NzScalarDatum(%s)r5   step=%rwall_time=%rzvalue=%r)r6   rZ   r[   r\   r-   r   r   r	   r7     s    


zScalarDatum.__repr__N)r   r   r   r   rB   r,   r8   r]   r^   r_   r2   r4   r7   r   r   r   r	   rX   S  s   



rX   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TensorTimeSeriesa/  Metadata about a tensor time series for a particular run and tag.

    Attributes:
      max_step: The largest step value of any datum in this tensor time series; a
        nonnegative integer.
      max_wall_time: The largest wall time of any datum in this time series, as
        `float` seconds since epoch.
      plugin_content: A bytestring of arbitrary plugin-specific metadata for this
        time series, as provided to `tf.summary.write` in the
        `plugin_data.content` field of the `metadata` argument.
      description: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified.
      display_name: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified. Deprecated; may be removed soon.
    c                 C   sb   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS | j|jkrNdS | j|jkr^dS dS rA   )r/   rd   rE   rF   rG   rH   rI   r0   r   r   r	   r2     s    
zTensorTimeSeries.__eq__c                 C   s   t | j| j| j| j| jfS r&   rP   r-   r   r   r	   r4     s    zTensorTimeSeries.__hash__c              	   C   s@   dd d| jf d| jf d| jf d| jf d| jf f S )NzTensorTimeSeries(%s)r5   rQ   rR   rS   rT   rU   rV   r-   r   r   r	   r7     s    




zTensorTimeSeries.__repr__NrW   r   r   r   r	   rd     s   rd   c                   @   sT   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	dd Z
dZdd ZdS )TensorDatuma  A single datum in a tensor time series for a run and tag.

    Attributes:
      step: The global step at which this datum occurred; an integer. This
        is a unique key among data of this time series.
      wall_time: The real-world time at which this datum occurred, as
        `float` seconds since epoch.
      numpy: The `numpy.ndarray` value with the tensor contents of this
        datum.
    rZ   r[   _numpyc                 C   s   || _ || _|| _d S r&   rf   )r   r]   r^   numpyr   r   r	   r,     s    zTensorDatum.__init__c                 C   s   | j S r&   r`   r-   r   r   r	   r]     s    zTensorDatum.stepc                 C   s   | j S r&   ra   r-   r   r   r	   r^     s    zTensorDatum.wall_timec                 C   s   | j S r&   )rg   r-   r   r   r	   rh     s    zTensorDatum.numpyc                 C   sF   t |tsdS | j|jkrdS | j|jkr.dS t| j|jsBdS dS rA   )r/   re   rZ   r[   npZarray_equalrg   r0   r   r   r	   r2     s    
zTensorDatum.__eq__Nc                 C   s,   dd d| jf d| jf d| jf f S )NzTensorDatum(%s)r5   rb   rc   znumpy=%r)r6   rZ   r[   rg   r-   r   r   r	   r7     s    


zTensorDatum.__repr__)r   r   r   r   rB   r,   r8   r]   r^   rh   r2   r4   r7   r   r   r   r	   re     s   


re   c                       sH   e Zd ZdZdZ fddZedd Zdd Zd	d
 Z	dd Z
  ZS )BlobSequenceTimeSeriesa  Metadata about a blob sequence time series for a particular run and tag.

    Attributes:
      max_step: The largest step value of any datum in this scalar time series; a
        nonnegative integer.
      max_wall_time: The largest wall time of any datum in this time series, as
        `float` seconds since epoch.
      max_length: The largest length (number of blobs) of any datum in
        this scalar time series, or `None` if this time series is empty.
      plugin_content: A bytestring of arbitrary plugin-specific metadata for this
        time series, as provided to `tf.summary.write` in the
        `plugin_data.content` field of the `metadata` argument.
      description: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified.
      display_name: An optional long-form Markdown description, as a `str` that is
        empty if no description was specified. Deprecated; may be removed soon.
    _max_lengthc                   s$   t t| j|||||d || _d S )N)rJ   rK   rL   rM   rN   )superrj   r,   rl   )r   rJ   rK   
max_lengthrL   rM   rN   	__class__r   r	   r,     s    

zBlobSequenceTimeSeries.__init__c                 C   s   | j S r&   rk   r-   r   r   r	   rn     s    z!BlobSequenceTimeSeries.max_lengthc                 C   sr   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS | j|jkrNdS | j|jkr^dS | j|jkrndS dS rA   )r/   rj   rE   rF   rl   rG   rH   rI   r0   r   r   r	   r2   #  s    
zBlobSequenceTimeSeries.__eq__c                 C   s    t | j| j| j| j| j| jfS r&   )r3   rE   rF   rl   rG   rH   rI   r-   r   r   r	   r4   4  s    zBlobSequenceTimeSeries.__hash__c              
   C   sJ   dd d| jf d| jf d| jf d| jf d| jf d| jf f S )	NzBlobSequenceTimeSeries(%s)r5   rQ   rR   zmax_length=%rrS   rT   rU   )r6   rE   rF   rl   rG   rH   rI   r-   r   r   r	   r7   @  s    





zBlobSequenceTimeSeries.__repr__)r   r   r   r   rB   r,   r8   rn   r2   r4   r7   __classcell__r   r   ro   r	   rj     s   
rj   c                   @   sN   e Zd ZdZdZdddZedd Zedd	 Zd
d Z	dd Z
dd ZdS )BlobReferenceaA  A reference to a blob.

    Attributes:
      blob_key: A string containing a key uniquely identifying a blob, which
        may be dereferenced via `provider.read_blob(blob_key)`.

        These keys must be constructed such that they can be included directly in
        a URL, with no further encoding. Concretely, this means that they consist
        exclusively of "unreserved characters" per RFC 3986, namely
        [a-zA-Z0-9._~-]. These keys are case-sensitive; it may be wise for
        implementations to normalize case to reduce confusion. The empty string
        is not a valid key.

        Blob keys must not contain information that should be kept secret.
        Privacy-sensitive applications should use random keys (e.g. UUIDs), or
        encrypt keys containing secret fields.
      url: (optional) A string containing a URL from which the blob data may be
        fetched directly, bypassing the data provider. URLs may be a vector
        for data leaks (e.g. via browser history, web proxies, etc.), so these
        URLs should not expose secret information.
    )_url	_blob_keyNc                 C   s   || _ || _d S r&   )rt   rs   )r   r   urlr   r   r	   r,   f  s    zBlobReference.__init__c                 C   s   | j S )a;  Provide a key uniquely identifying a blob.

        Callers should consider these keys to be opaque-- i.e., to have
        no intrinsic meaning. Some data providers may use random IDs;
        but others may encode information into the key, in which case
        callers must make no attempt to decode it.
        )rt   r-   r   r   r	   r   j  s    	zBlobReference.blob_keyc                 C   s   | j S )aB  Provide the direct-access URL for this blob, if available.

        Note that this method is *not* expected to construct a URL to
        the data-loading endpoint provided by TensorBoard. If this
        method returns None, then the caller should proceed to use
        `blob_key()` to build the URL, as needed.
        )rs   r-   r   r   r	   ru   u  s    	zBlobReference.urlc                 C   s2   t |tsdS | j|jkrdS | j|jkr.dS dS rA   )r/   rr   rt   rs   r0   r   r   r	   r2     s    
zBlobReference.__eq__c                 C   s   t | j| jfS r&   )r3   rt   rs   r-   r   r   r	   r4     s    zBlobReference.__hash__c                 C   s"   dd d| jf d| jf f S )NzBlobReference(%s)r5   zblob_key=%rzurl=%r)r6   rt   rs   r-   r   r   r	   r7     s    zBlobReference.__repr__)N)r   r   r   r   rB   r,   r8   r   ru   r2   r4   r7   r   r   r   r	   rr   M  s   




	rr   c                   @   sX   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	dd Z
dd Zdd ZdS )BlobSequenceDatuma  A single datum in a blob sequence time series for a run and tag.

    Attributes:
      step: The global step at which this datum occurred; an integer. This is a
        unique key among data of this time series.
      wall_time: The real-world time at which this datum occurred, as `float`
        seconds since epoch.
      values: A tuple of `BlobReference` objects, providing access to elements of
        this sequence.
    rZ   r[   _valuesc                 C   s   || _ || _|| _d S r&   rw   )r   r]   r^   valuesr   r   r	   r,     s    zBlobSequenceDatum.__init__c                 C   s   | j S r&   r`   r-   r   r   r	   r]     s    zBlobSequenceDatum.stepc                 C   s   | j S r&   ra   r-   r   r   r	   r^     s    zBlobSequenceDatum.wall_timec                 C   s   | j S r&   )rx   r-   r   r   r	   ry     s    zBlobSequenceDatum.valuesc                 C   sB   t |tsdS | j|jkrdS | j|jkr.dS | j|jkr>dS dS rA   )r/   rv   rZ   r[   rx   r0   r   r   r	   r2     s    
zBlobSequenceDatum.__eq__c                 C   s   t | j| j| jfS r&   )r3   rZ   r[   rx   r-   r   r   r	   r4     s    zBlobSequenceDatum.__hash__c                 C   s,   dd d| jf d| jf d| jf f S )NzBlobSequenceDatum(%s)r5   rb   rc   z	values=%r)r6   rZ   r[   rx   r-   r   r   r	   r7     s    


zBlobSequenceDatum.__repr__N)r   r   r   r   rB   r,   r8   r]   r^   ry   r2   r4   r7   r   r   r   r	   rv     s   


rv   c                   @   sB   e Zd ZdZdddZdd Zedd Zed	d
 Zdd Z	dS )RunTagFilterz"Filters data by run and tag names.Nc                 C   s    |  d|| _|  d|| _dS )a  Construct a `RunTagFilter`.

        A time series passes this filter if both its run *and* its tag are
        included in the corresponding whitelists.

        Order and multiplicity are ignored; `runs` and `tags` are treated as
        sets.

        Args:
          runs: Collection of run names, as strings, or `None` to admit all
            runs.
          tags: Collection of tag names, as strings, or `None` to admit all
            tags.
        runstagsN)_parse_optional_string_set_runs_tags)r   r{   r|   r   r   r	   r,     s    zRunTagFilter.__init__c                 C   sb   |d u rd S t |tr,td|t||f t|}|D ]$}t |ts8td|t||f q8|S )Nz8%s: expected `None` or collection of strings; got %r: %rzE%s: expected `None` or collection of strings; got item of type %r: %r)r/   str	TypeErrortype	frozenset)r   namer_   itemr   r   r	   r}     s"    

z'RunTagFilter._parse_optional_string_setc                 C   s   | j S r&   )r~   r-   r   r   r	   r{     s    zRunTagFilter.runsc                 C   s   | j S r&   )r   r-   r   r   r	   r|     s    zRunTagFilter.tagsc                 C   s"   dd d| jf d| jf f S )NzRunTagFilter(%s)r5   zruns=%rztags=%r)r6   r~   r   r-   r   r   r	   r7     s
    

zRunTagFilter.__repr__)NN)
r   r   r   r   r,   r}   r8   r{   r|   r7   r   r   r   r	   rz     s   


rz   )r   r   rh   ri   ABCMetar   objectr   r9   rC   rO   rX   rd   re   rj   rr   rv   rz   r   r   r   r	   <module>   s      UI637677VE7