class_docstr: Wandb class for arbitrary html.
  
  Arguments:
      data: (string or io object) HTML to display in wandb
      inject: (boolean) Add a stylesheet to the HTML object.  If set
          to False the HTML will pass through unchanged.
class_docstr_tok: ["Wandb","class","for","arbitrary","html",".","Arguments",":","data",":","(","string","or","io","object",")","HTML","to","display","in","wandb","inject",":","(","boolean",")","Add","a","stylesheet","to","the","HTML","object",".","If","set","to","False","the","HTML","will","pass","through","unchanged","."]
code: def __init__(
      self, data: Union[str, "TextIO"], inject: bool = True
  ) -> None:
      super().__init__()
      data_is_path = isinstance(data, str) and os.path.exists(data)
      data_path = ""
      if data_is_path:
          assert isinstance(data, str)
          data_path = data
          with open(data_path) as file:
              self.html = file.read()
      elif isinstance(data, str):
          self.html = data
      elif hasattr(data, "read"):
          if hasattr(data, "seek"):
              data.seek(0)
          self.html = data.read()
      else:
          raise ValueError("data must be a string or an io object")
  
      if inject:
          self.inject_head()
  
      if inject or not data_is_path:
          tmp_path = os.path.join(
              MEDIA_TMP.name, runid.generate_id() + ".html"
          )
          with open(tmp_path, "w", encoding="utf-8") as out:
              out.write(self.html)
  
          self._set_file(tmp_path, is_tmp=True)
      else:
          self._set_file(data_path, is_tmp=False)
  
file_path: wandb/wandb/sdk/data_types/html.py
imports: import os
  from typing import TYPE_CHECKING, Sequence, Type, Union
  from wandb.sdk.lib import filesystem, runid
  from .None import _dtypes
  from ._private import MEDIA_TMP
  from .base_types.media import BatchableMedia
label_desc: Use image node_id 1 to create a new Html object from inherited base classes: BatchableMedia with example: obj = Html(data, inject)