class_docstr: Base class to process rendering a Styler with a specified jinja2 template.
class_docstr_tok: ["Base","class","to","process","rendering","a","Styler","with","a","specified","jinja2","template","."]
docstr: Process Styler data and settings into a dict for template rendering.
  
  Convert data and settings from ``Styler`` attributes such as ``self.data``,
  ``self.tooltips`` including applying any methods in ``self._todo``.
  
  Parameters
  ----------
  sparse_index : bool
      Whether to sparsify the index or print all hierarchical index elements.
      Upstream defaults are typically to `pandas.options.styler.sparse.index`.
  sparse_cols : bool
      Whether to sparsify the columns or print all hierarchical column elements.
      Upstream defaults are typically to `pandas.options.styler.sparse.columns`.
  max_rows, max_cols : int, optional
      Specific max rows and cols. max_elements always take precedence in render.
  blank : str
      Entry to top-left blank cells.
  dxs : list[dict]
      The render dicts of the concatenated Stylers.
  
  Returns
  -------
  d : dict
      The following structure: {uuid, table_styles, caption, head, body,
      cellstyle, table_attributes}
docstr_tok: ["Process","Styler","data","and","settings","into","a","dict","for","template","rendering",".","Convert","data","and","settings","from","``","Styler","``","attributes","such","as","``","self.data","``",",","``","self.tooltips","``","including","applying","any","methods","in","``","self._todo","``",".","Parameters","--","--","--","--","--","sparse_index",":","bool","Whether","to","sparsify","the","index","or","print","all","hierarchical","index","elements",".","Upstream","defaults","are","typically","to","`","pandas.options.styler.sparse.index","`",".","sparse_cols",":","bool","Whether","to","sparsify","the","columns","or","print","all","hierarchical","column","elements",".","Upstream","defaults","are","typically","to","`","pandas.options.styler.sparse.columns","`",".","max_rows",",","max_cols",":","int",",","optional","Specific","max","rows","and","cols",".","max_elements","always","take","precedence","in","render",".","blank",":","str","Entry","to","top-left","blank","cells",".","dxs",":","list","[","dict","]","The","render","dicts","of","the","concatenated","Stylers",".","Returns","--","--","--","-","d",":","dict","The","following","structure",":","{","uuid",",","table_styles",",","caption",",","head",",","body",",","cellstyle",",","table_attributes","}"]
code: def _translate(
      self,
      sparse_index: bool,
      sparse_cols: bool,
      max_rows: int | None = None,
      max_cols: int | None = None,
      blank: str = "&nbsp;",
      dxs: list[dict] | None = None,
  ):
      """
      Process Styler data and settings into a dict for template rendering.
  
      Convert data and settings from ``Styler`` attributes such as ``self.data``,
      ``self.tooltips`` including applying any methods in ``self._todo``.
  
      Parameters
      ----------
      sparse_index : bool
          Whether to sparsify the index or print all hierarchical index elements.
          Upstream defaults are typically to `pandas.options.styler.sparse.index`.
      sparse_cols : bool
          Whether to sparsify the columns or print all hierarchical column elements.
          Upstream defaults are typically to `pandas.options.styler.sparse.columns`.
      max_rows, max_cols : int, optional
          Specific max rows and cols. max_elements always take precedence in render.
      blank : str
          Entry to top-left blank cells.
      dxs : list[dict]
          The render dicts of the concatenated Stylers.
  
      Returns
      -------
      d : dict
          The following structure: {uuid, table_styles, caption, head, body,
          cellstyle, table_attributes}
      """
      if dxs is None:
          dxs = []
      self.css["blank_value"] = blank
  
      # construct render dict
      d = {
          "uuid": self.uuid,
          "table_styles": format_table_styles(self.table_styles or []),
          "caption": self.caption,
      }
  
      max_elements = get_option("styler.render.max_elements")
      max_rows = (
          max_rows if max_rows else get_option("styler.render.max_rows")
      )
      max_cols = (
          max_cols
          if max_cols
          else get_option("styler.render.max_columns")
      )
      max_rows, max_cols = _get_trimming_maximums(
          len(self.data.index),
          len(self.data.columns),
          max_elements,
          max_rows,
          max_cols,
      )
  
      self.cellstyle_map_columns: DefaultDict[
          tuple[CSSPair, ...], list[str]
      ] = defaultdict(list)
      head = self._translate_header(sparse_cols, max_cols)
      d.update({"head": head})
  
      # for sparsifying a MultiIndex and for use with latex clines
      idx_lengths = _get_level_lengths(
          self.index, sparse_index, max_rows, self.hidden_rows
      )
      d.update({"index_lengths": idx_lengths})
  
      self.cellstyle_map: DefaultDict[
          tuple[CSSPair, ...], list[str]
      ] = defaultdict(list)
      self.cellstyle_map_index: DefaultDict[
          tuple[CSSPair, ...], list[str]
      ] = defaultdict(list)
      body: list = self._translate_body(idx_lengths, max_rows, max_cols)
      d.update({"body": body})
  
      ctx_maps = {
          "cellstyle": "cellstyle_map",
          "cellstyle_index": "cellstyle_map_index",
          "cellstyle_columns": "cellstyle_map_columns",
      }  # add the cell_ids styles map to the render dictionary in right format
      for k, attr in ctx_maps.items():
          map = [
              {"props": list(props), "selectors": selectors}
              for props, selectors in getattr(self, attr).items()
          ]
          d.update({k: map})
  
      for dx in dxs:  # self.concatenated is not empty
          d["body"].extend(dx["body"])  # type: ignore[union-attr]
          d["cellstyle"].extend(dx["cellstyle"])  # type: ignore[union-attr]
          d["cellstyle_index"].extend(  # type: ignore[union-attr]
              dx["cellstyle_index"]
          )
  
      table_attr = self.table_attributes
      if not get_option("styler.html.mathjax"):
          table_attr = table_attr or ""
          if 'class="' in table_attr:
              table_attr = table_attr.replace(
                  'class="', 'class="tex2jax_ignore '
              )
          else:
              table_attr += ' class="tex2jax_ignore"'
      d.update({"table_attributes": table_attr})
  
      if self.tooltips:
          d = self.tooltips._translate(self, d)
  
      return d
  
imports: from __future__ import annotations
  from collections import defaultdict
  from collections.abc import Sequence
  from functools import partial
  import re
  from typing import TYPE_CHECKING, Any, Callable, DefaultDict, Optional, TypedDict, Union
  from uuid import uuid4
  import numpy
  from pandas._config import get_option
  from pandas._libs import lib
  from pandas.compat._optional import import_optional_dependency
  from pandas.core.dtypes.common import is_complex, is_float, is_integer
  from pandas.core.dtypes.generic import ABCSeries
  from pandas import DataFrame, Index, IndexSlice, MultiIndex, Series, isna
  from pandas.api.types import is_list_like
  import pandas.core.common
  from markupsafe import escape
label_desc: Use image node_id 7 for calling the StylerRenderer obj's underlying member method code with example usage: obj._translate(sparse_index, sparse_cols, max_rows, max_cols, blank, dxs) and returns: d