
    WhY                     @    d Z ddlmZ dZ G d d          Zd Zd ZdS )	zRequest-scoped context.    )authztensorboard.request_contextc                       e Zd ZdZ	 	 	 	 d	dZed             Zed             Zed             Zed             Z	d Z
dS )
RequestContexta  Container of request-scoped values.

    This context is for cross-cutting concerns: authentication,
    authorization, auditing, internationalization, logging, and so on.
    It is not simply for passing commonly used parameters to functions.

    `RequestContext` values are to be treated as immutable.

    Fields:
      auth: An `AuthContext`, which may be empty but is never `None`.
      remote_ip: An `ipaddress.IPv4Address` or `ipaddress.IPv6Address` or None.
        Best guess of the IP Address of the end user.
      x_forwarded_for: A tuple of `ipaddress.IPv4Address` or `ipaddress.IPv6Address`,
        which may be empty but is never None. This should be parsed value of X-Forwarded-For
        HTTP header from the request.
      client_feature_flags: A dict of string to arbitrary type. These represent
        feature flag key/value pairs sent by the client application. Usage of
        client_feature_flags should know the name of the feature flag key and
        should know and validate the type of the value.
    Nc                     ||nt           j                                        | _        || _        |pd| _        |pi | _        dS )aY  Create a request context.

        The argument list is sorted and may be extended in the future;
        therefore, callers must pass only named arguments to this
        initializer.

        Args:
          See "Fields" on class docstring. All arguments are optional
          and will be replaced with default values if appropriate.
        N )auth_libAuthContextempty_auth
_remote_ip_x_forwarded_for_client_feature_flags)selfr   	remote_ipx_forwarded_forclient_feature_flagss        Y/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/tensorboard/context.py__init__zRequestContext.__init__.   sJ    " "-TT83G3M3M3O3O
# / 52%9%?R"""    c                     | j         S N)r   r   s    r   r   zRequestContext.authD   s
    zr   c                     | j         S r   )r   r   s    r   r   zRequestContext.remote_ipH   s
    r   c                     | j         S r   )r   r   s    r   r   zRequestContext.x_forwarded_forL   s    $$r   c                     | j         S r   )r   r   s    r   r   z#RequestContext.client_feature_flagsP   s    ))r   c                    |                     d| j                   |                     d| j                   |                     d| j                   |                     d| j                    t          |           di |S )ay  Create a copy of this context with updated key-value pairs.

        Analogous to `namedtuple._replace`. For example, to create a new
        request context like `ctx` but with auth context `auth`, call
        `ctx.replace(auth=auth)`.

        Args:
          As to `__init__`.

        Returns:
          A new context like this one but with the specified updates.
        r   r   r   r   r   )
setdefaultr   r   r   r   type)r   kwargss     r   replacezRequestContext.replaceT   s     	&$),,,+t~666+T-ABBB0$2KLLLtDzz##F###r   )NNNN)__name__
__module____qualname____doc__r   propertyr   r   r   r   r    r   r   r   r   r      s         . !@ @ @ @,   X   X % % X% * * X*$ $ $ $ $r   r   c                 Z    |                      t                    }||nt                      S )a  Get a `RequestContext` from a WSGI environment.

    See also `set_in_environ`.

    Args:
      environ: A WSGI environment (see PEP 3333).

    Returns:
      The `RequestContext` stored in the WSGI environment, or an empty
      `RequestContext` if none is stored.
    )get	_WSGI_KEYr   )environresults     r   from_environr+   h   s*     [[##F'66^-=-==r   c                     || t           <   dS )zSet the `RequestContext` in a WSGI environment.

    After `set_in_environ(e, ctx)`, `from_environ(e) is ctx`. The input
    environment is mutated.

    Args:
      environ: A WSGI environment to update.
      ctx: A new `RequestContext` value.
    N)r(   )r)   ctxs     r   set_in_environr.   x   s     GIr   N)r$   tensorboardr   r   r(   r   r+   r.   r   r   r   <module>r0      s      ( ( ( ( ( ( *	M$ M$ M$ M$ M$ M$ M$ M$`> > > 
 
 
 
 
r   