
    1Vh
                     (    d Z ddlmZ  G d d      Zy)zInternal path prefix support for TensorBoard.

Using a path prefix of `/foo/bar` enables TensorBoard to serve from
`http://localhost:6006/foo/bar/` rather than `http://localhost:6006/`.
See the `--path_prefix` flag docs for more details.
    )errorsc                       e Zd ZdZd Zd Zy)PathPrefixMiddlewareaX  WSGI middleware for path prefixes.

    All requests to this middleware must begin with the specified path
    prefix (otherwise, a 404 will be returned immediately). Requests
    will be forwarded to the underlying application with the path prefix
    stripped and appended to `SCRIPT_NAME` (see the WSGI spec, PEP 3333,
    for details).
    c                     |j                  d      rt        d|z        |r|j                  d      st        d|z        || _        || _        | j                  dz   | _        y)ax  Initializes this middleware.

        Args:
          application: The WSGI application to wrap (see PEP 3333).
          path_prefix: A string path prefix to be stripped from incoming
            requests. If empty, this middleware is a no-op. If non-empty,
            the path prefix must start with a slash and not end with one
            (e.g., "/tensorboard").
        /z'Path prefix must not end with slash: %rz/Non-empty path prefix must start with slash: %rN)endswith
ValueError
startswith_application_path_prefix_strict_prefix)selfapplicationpath_prefixs      O/home/dcms/DCMS/lib/python3.12/site-packages/tensorboard/backend/path_prefix.py__init__zPathPrefixMiddleware.__init__$   ss     $9KG  {55c:AKO  ('"//#5    c                 @   |j                  dd      }|| j                  k7  r/|j                  | j                        st	        j
                         |t        | j                        d  |d<   |j                  dd      | j                  z   |d<   | j                  ||      S )N	PATH_INFO SCRIPT_NAME)getr   r
   r   r   NotFoundErrorlenr   )r   environstart_responsepaths       r   __call__zPathPrefixMiddleware.__call__:   s    {{;+4$$$T__.
 &&((#C(9(9$:$<=KKr*T->->> 	   .99r   N)__name__
__module____qualname____doc__r   r    r   r   r   r      s    6,
:r   r   N)r"   tensorboardr   r   r#   r   r   <module>r%      s    *: *:r   