class_docstr: Implementation of TensorBoardServer using the Werkzeug dev server.
class_docstr_tok: ["Implementation","of","TensorBoardServer","using","the","Werkzeug","dev","server","."]
code: def __init__(self, wsgi_app, flags):
      self._flags = flags
      host = flags.host
      port = flags.port
  
      self._auto_wildcard = flags.bind_all
      if self._auto_wildcard:
          # Serve on all interfaces, and attempt to serve both IPv4 and IPv6
          # traffic through one socket.
          host = self._get_wildcard_address(port)
      elif host is None:
          host = "localhost"
  
      self._host = host
      self._url = None  # Will be set by get_url() below
  
      self._fix_werkzeug_logging()
  
      def is_port_in_use(port):
          with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
              return s.connect_ex(("localhost", port)) == 0
  
      try:
          if is_port_in_use(port):
              raise TensorBoardPortInUseError(
                  "TensorBoard could not bind to port %d, it was already in use"
                  % port
              )
          super().__init__(host, port, wsgi_app, _WSGIRequestHandler)
      except socket.error as e:
          if hasattr(errno, "EACCES") and e.errno == errno.EACCES:
              raise TensorBoardServerException(
                  "TensorBoard must be run as superuser to bind to port %d"
                  % port
              )
          elif (
              hasattr(errno, "EADDRINUSE")
              and e.errno == errno.EADDRINUSE
          ):
              if port == 0:
                  raise TensorBoardServerException(
                      "TensorBoard unable to find any open port"
                  )
              else:
                  raise TensorBoardPortInUseError(
                      "TensorBoard could not bind to port %d, it was already in use"
                      % port
                  )
          elif (
              hasattr(errno, "EADDRNOTAVAIL")
              and e.errno == errno.EADDRNOTAVAIL
          ):
              raise TensorBoardServerException(
                  "TensorBoard could not bind to unavailable address %s"
                  % host
              )
          elif (
              hasattr(errno, "EAFNOSUPPORT")
              and e.errno == errno.EAFNOSUPPORT
          ):
              raise TensorBoardServerException(
                  "Tensorboard could not bind to unsupported address family %s"
                  % host
              )
          # Raise the raw exception if it wasn't identifiable as a user error.
          raise
  
imports: from abc import ABCMeta
  from abc import abstractmethod
  import argparse
  import atexit
  from collections import defaultdict
  import errno
  import logging
  import mimetypes
  import os
  import shlex
  import signal
  import socket
  import sys
  import threading
  import time
  import urllib.parse
  from absl import flags
  from absl.flags import argparse_flags
  from werkzeug import serving
  from tensorboard import manager
  from tensorboard import version
  from tensorboard.backend import application
  from tensorboard.backend.event_processing import data_ingester
  from tensorboard.backend.event_processing import event_file_inspector
  from tensorboard.data import server_ingester
  from tensorboard.plugins.core import core_plugin
  from tensorboard.util import tb_logging
label_desc: Use image node_id 1 to create a new WerkzeugServer object from inherited base classes: serving, TensorBoardServer with example: obj = WerkzeugServer(wsgi_app, flags)