class_docstr: Base class for LIT datasets.
docstr: Base class constructor.
  
  This can derive from another dataset by passing the 'base' argument;
  if so it will pre-populate with those fields, and override only those
  specified individually as arguments.
  
  Args:
    spec: dataset spec
    examples: data examples (datapoints)
    description: optional human-readable description of this component
    base: optional base dataset to derive from
docstr_tok: ["Base","class","constructor",".","This","can","derive","from","another","dataset","by","passing","the","'base","'","argument",";","if","so","it","will","pre-populate","with","those","fields",",","and","override","only","those","specified","individually","as","arguments",".","Args",":","spec",":","dataset","spec","examples",":","data","examples","(","datapoints",")","description",":","optional","human-readable","description","of","this","component","base",":","optional","base","dataset","to","derive","from"]
code: def __init__(
      self,
      spec: Optional[Spec] = None,
      examples: Optional[list[JsonDict]] = None,
      description: Optional[str] = None,
      base: Optional["Dataset"] = None,
  ):
      """Base class constructor.
  
      This can derive from another dataset by passing the 'base' argument;
      if so it will pre-populate with those fields, and override only those
      specified individually as arguments.
  
      Args:
        spec: dataset spec
        examples: data examples (datapoints)
        description: optional human-readable description of this component
        base: optional base dataset to derive from
      """
      self._base = base
      if self._base is not None:
          self._examples = self._base.examples
          self._spec = self._base.spec()
          self._description = self._base.description()
          # In case user child class requires the instance to convert examples
          # this makes sure the user class is preserved. We cannot do this below
          # as the default method is static and does not require instance.
          self.bytes_from_lit_example = (
              self._base.bytes_from_lit_example
          )
          self.lit_example_from_bytes = (
              self._base.lit_example_from_bytes
          )
  
      # Override from direct arguments.
      self._examples = (
          examples if examples is not None else self._examples
      )
      self._spec = spec or self._spec
      self._description = description or self._description
  
imports: from collections.abc import Callable, Mapping, Sequence
  import hashlib
  import glob
  import inspect
  import os
  import random
  import types
  from typing import Optional, Union, cast
  from absl import logging
  from lit_nlp.api import types
  from lit_nlp.lib import serialize
  from lit_nlp.lib import utils
label_desc: Use image node_id 1 to create a new Dataset object from inherited base classes: object with example: obj = Dataset(spec, examples, description, base)