class_docstr: Raw summary example plugin for TensorBoard.
class_docstr_tok: ["Raw","summary","example","plugin","for","TensorBoard","."]
docstr: Returns a resource file from the static asset directory.
  
  Requests from the frontend have a path in this form:
  /data/plugin/example_raw_scalars/static/foo
  This serves the appropriate asset: ./static/foo.
  
  Checks the normpath to guard against path traversal attacks.
docstr_tok: ["Returns","a","resource","file","from","the","static","asset","directory",".","Requests","from","the","frontend","have","a","path","in","this","form",":","\/data\/plugin\/example_raw_scalars\/static\/foo","This","serves","the","appropriate","asset",":",".\/static\/foo",".","Checks","the","normpath","to","guard","against","path","traversal","attacks","."]
code: def _serve_static_file(self, request):
      """Returns a resource file from the static asset directory.
  
      Requests from the frontend have a path in this form:
      /data/plugin/example_raw_scalars/static/foo
      This serves the appropriate asset: ./static/foo.
  
      Checks the normpath to guard against path traversal attacks.
      """
      static_path_part = request.path[
          len(_PLUGIN_DIRECTORY_PATH_PART) :
      ]
      resource_name = os.path.normpath(
          os.path.join(*static_path_part.split("/"))
      )
      if not resource_name.startswith("static" + os.path.sep):
          return http_util.Respond(
              request, "Not found", "text/plain", code=404
          )
  
      resource_path = os.path.join(
          os.path.dirname(__file__), resource_name
      )
      with open(resource_path, "rb") as read_file:
          mimetype = mimetypes.guess_type(resource_path)[0]
          return http_util.Respond(
              request, read_file.read(), content_type=mimetype
          )
  
file_path: tensorboard/tensorboard/examples/plugins/example_raw_scalars/tensorboard_plugin_example_raw_scalars/plugin.py
imports: import mimetypes
  import os
  from werkzeug import wrappers
  from tensorboard import errors
  from tensorboard import plugin_util
  from tensorboard.backend import http_util
  from tensorboard.data import provider
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.scalar import metadata
label_desc: Use image node_id 4 for calling the ExampleRawScalarsPlugin obj's underlying member method code with example usage: obj._serve_static_file(request) and returns: http_util, http_util