class_docstr: Abstract interface for data aggregation functionality for plotly figures.
class_docstr_tok: ["Abstract","interface","for","data","aggregation","functionality","for","plotly","figures","."]
docstr: Parse and capture the possibly high-frequency trace-props in a datacontainer.
  
  Parameters
  ----------
  trace : BaseTraceType
      The trace which will be parsed.
  hf_x : Iterable, optional
      High-frequency trace "x" data, overrides the current trace its x-data.
  hf_y : Iterable, optional
      High-frequency trace "y" data, overrides the current trace its y-data.
  hf_text : Iterable, optional
      High-frequency trace "text" data, overrides the current trace its text-data.
  hf_hovertext : Iterable, optional
      High-frequency trace "hovertext" data, overrides the current trace its
      hovertext data.
  check_nans: bool, optional
      Whether the `hf_y` should be checked for NaNs, by default True.
      As checking for NaNs is expensive, this can be disabled when the `hf_y` is
      already known to contain no NaNs (or when the downsampler can handle NaNs,
      e.g., EveryNthPoint).
  
  Returns
  -------
  _hf_data_container
      A namedtuple which serves as a datacontainer.
docstr_tok: ["Parse","and","capture","the","possibly","high-frequency","trace-props","in","a","datacontainer",".","Parameters","--","--","--","--","--","trace",":","BaseTraceType","The","trace","which","will","be","parsed",".","hf_x",":","Iterable",",","optional","High-frequency","trace","``","x","''","data",",","overrides","the","current","trace","its","x-data",".","hf_y",":","Iterable",",","optional","High-frequency","trace","``","y","''","data",",","overrides","the","current","trace","its","y-data",".","hf_text",":","Iterable",",","optional","High-frequency","trace","``","text","''","data",",","overrides","the","current","trace","its","text-data",".","hf_hovertext",":","Iterable",",","optional","High-frequency","trace","``","hovertext","''","data",",","overrides","the","current","trace","its","hovertext","data",".","check_nans",":","bool",",","optional","Whether","the","`","hf_y","`","should","be","checked","for","NaNs",",","by","default","True",".","As","checking","for","NaNs","is","expensive",",","this","can","be","disabled","when","the","`","hf_y","`","is","already","known","to","contain","no","NaNs","(","or","when","the","downsampler","can","handle","NaNs",",","e.g.",",","EveryNthPoint",")",".","Returns","--","--","--","-","_hf_data_container","A","namedtuple","which","serves","as","a","datacontainer","."]
code: def _parse_get_trace_props(
      self,
      trace: BaseTraceType,
      hf_x: Iterable = None,
      hf_y: Iterable = None,
      hf_text: Iterable = None,
      hf_hovertext: Iterable = None,
      hf_marker_size: Iterable = None,
      hf_marker_color: Iterable = None,
      check_nans: bool = True,
  ) -> _hf_data_container:
      """Parse and capture the possibly high-frequency trace-props in a datacontainer.
  
      Parameters
      ----------
      trace : BaseTraceType
          The trace which will be parsed.
      hf_x : Iterable, optional
          High-frequency trace "x" data, overrides the current trace its x-data.
      hf_y : Iterable, optional
          High-frequency trace "y" data, overrides the current trace its y-data.
      hf_text : Iterable, optional
          High-frequency trace "text" data, overrides the current trace its text-data.
      hf_hovertext : Iterable, optional
          High-frequency trace "hovertext" data, overrides the current trace its
          hovertext data.
      check_nans: bool, optional
          Whether the `hf_y` should be checked for NaNs, by default True.
          As checking for NaNs is expensive, this can be disabled when the `hf_y` is
          already known to contain no NaNs (or when the downsampler can handle NaNs,
          e.g., EveryNthPoint).
  
      Returns
      -------
      _hf_data_container
          A namedtuple which serves as a datacontainer.
  
      """
      hf_x: np.ndarray = (
          # fmt: off
              (np.asarray(trace["x"]) if trace["x"] is not None else None)
              if hasattr(trace, "x") and hf_x is None
              # If we cast a tz-aware datetime64 array to `.values` we lose the tz-info 
              # and the UTC time will be displayed instead of the tz-localized time, 
              # hence we cast to a pd.DatetimeIndex, which preserves the tz-info
              # As a matter of fact, to resolve #231, we also convert non-tz-aware 
              # datetime64 arrays to an pd.Index
              else pd.Index(hf_x) if pd.core.dtypes.common.is_datetime64_any_dtype(hf_x)
              else hf_x.values if isinstance(hf_x, pd.Series)
              else hf_x if isinstance(hf_x, pd.Index)
              else np.asarray(hf_x)
          # fmt: on
      )
  
      hf_y = (
          trace["y"]
          if hasattr(trace, "y") and hf_y is None
          else hf_y.values
          if isinstance(hf_y, (pd.Series, pd.Index))
          else hf_y
      )
      # NOTE: the if will not be triggered for a categorical series its values
      if not hasattr(hf_y, "dtype"):
          hf_y: np.ndarray = np.asarray(hf_y)
  
      hf_text = (
          hf_text
          if hf_text is not None
          else trace["text"]
          if hasattr(trace, "text") and trace["text"] is not None
          else None
      )
  
      hf_hovertext = (
          hf_hovertext
          if hf_hovertext is not None
          else trace["hovertext"]
          if hasattr(trace, "hovertext")
          and trace["hovertext"] is not None
          else None
      )
  
      hf_marker_size = (
          trace["marker"]["size"]
          if (
              hf_marker_size is None
              and hasattr(trace, "marker")
              and "size" in trace["marker"]
          )
          else hf_marker_size
      )
  
      hf_marker_color = (
          trace["marker"]["color"]
          if (
              hf_marker_color is None
              and hasattr(trace, "marker")
              and "color" in trace["marker"]
          )
          else hf_marker_color
      )
  
      hf_customdata = (
          trace["customdata"] if hasattr(trace, "customdata") else None
      )
  
      if trace["type"].lower() in self._high_frequency_traces:
          if hf_x is None:  # if no data as x or hf_x is passed
              if hf_y.ndim != 0:  # if hf_y is an array
                  hf_x = pd.RangeIndex(
                      0, len(hf_y)
                  )  # np.arange(len(hf_y))
              else:  # if no data as y or hf_y is passed
                  hf_x = np.asarray(None)
  
          assert hf_y.ndim == np.ndim(hf_x), (
              "plotly-resampler requires scatter data "
              "(i.e., x and y, or hf_x and hf_y) to have the same dimensionality!"
          )
          # When the x or y of a trace has more than 1 dimension, it is not at all
          # straightforward how it should be resampled.
          assert hf_y.ndim <= 1 and np.ndim(hf_x) <= 1, (
              "plotly-resampler requires scatter data "
              "(i.e., x and y, or hf_x and hf_y) to be <= 1 dimensional!"
          )
  
          # Note: this converts the hf property to a np.ndarray
          if isinstance(hf_text, (tuple, list, np.ndarray, pd.Series)):
              hf_text = np.asarray(hf_text)
          if isinstance(
              hf_hovertext, (tuple, list, np.ndarray, pd.Series)
          ):
              hf_hovertext = np.asarray(hf_hovertext)
          if isinstance(
              hf_marker_size, (tuple, list, np.ndarray, pd.Series)
          ):
              hf_marker_size = np.asarray(hf_marker_size)
          if isinstance(
              hf_marker_color, (tuple, list, np.ndarray, pd.Series)
          ):
              hf_marker_color = np.asarray(hf_marker_color)
  
          # Remove NaNs for efficiency (storing less meaningless data)
          # NaNs introduce gaps between enclosing non-NaN data points & might distort
          # the resampling algorithms
          if check_nans and pd.isna(hf_y).any():
              not_nan_mask = ~pd.isna(hf_y)
              hf_x = hf_x[not_nan_mask]
              hf_y = hf_y[not_nan_mask]
              if isinstance(hf_text, np.ndarray):
                  hf_text = hf_text[not_nan_mask]
              if isinstance(hf_hovertext, np.ndarray):
                  hf_hovertext = hf_hovertext[not_nan_mask]
              if isinstance(hf_marker_size, np.ndarray):
                  hf_marker_size = hf_marker_size[not_nan_mask]
              if isinstance(hf_marker_color, np.ndarray):
                  hf_marker_color = hf_marker_color[not_nan_mask]
  
          # Try to parse the hf_x data if it is of object type or
          if len(hf_x) and (
              hf_x.dtype.type is np.str_ or hf_x.dtype == "object"
          ):
              try:
                  # Try to parse to numeric
                  hf_x = pd.to_numeric(hf_x, errors="raise")
              except (ValueError, TypeError):
                  try:
                      # Try to parse to datetime
                      hf_x = pd.to_datetime(
                          hf_x, utc=False, errors="raise"
                      )
                      # Will be cast to object array if it contains multiple timezones.
                      if hf_x.dtype == "object":
                          raise ValueError(
                              "The x-data contains multiple timezones, which is not "
                              "supported by plotly-resampler!"
                          )
                  except (ValueError, TypeError):
                      raise ValueError(
                          "plotly-resampler requires the x-data to be numeric or "
                          "datetime-like \nMore details in the stacktrace above."
                      )
  
          # If the categorical or string-like hf_y data is of type object (happens
          # when y argument is used for the trace constructor instead of hf_y), we
          # transform it to type string as such it will be sent as categorical data
          # to the downsampling algorithm
          if hf_y.dtype == "object" or hf_y.dtype.type == np.str_:
              # But first, we try to parse to a numeric dtype (as this is the
              # behavior that plotly supports)
              # Note that a bool array of type object will remain a bool array (and
              # not will be transformed to an array of ints (0, 1))
              try:
                  hf_y = pd.to_numeric(hf_y, errors="raise")
              except ValueError:
                  hf_y = pd.Categorical(hf_y)  # TODO: ordered=True?
          assert len(hf_x) == len(
              hf_y
          ), "x and y have different length!"
      else:
          self._print(
              f"trace {trace['type']} is not a high-frequency trace"
          )
  
          # hf_x and hf_y have priority over the traces' data
          if hasattr(trace, "x"):
              trace["x"] = hf_x
  
          if hasattr(trace, "y"):
              trace["y"] = hf_y
  
          if hasattr(trace, "text"):
              trace["text"] = hf_text
  
          if hasattr(trace, "hovertext"):
              trace["hovertext"] = hf_hovertext
          if hasattr(trace, "marker"):
              if hasattr(trace.marker, "size"):
                  trace.marker.size = hf_marker_size
              if hasattr(trace.marker, "color"):
                  trace.marker.color = hf_marker_color
  
      return _hf_data_container(
          hf_x,
          hf_y,
          hf_text,
          hf_hovertext,
          hf_marker_size,
          hf_marker_color,
          hf_customdata,
      )
  
imports: from __future__ import annotations
  import itertools
  import re
  from abc import ABC
  from collections import namedtuple
  from copy import copy
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  from uuid import uuid4
  import dash
  import numpy
  import pandas
  import plotly.graph_objects
  from pandas.io.json._normalize import nested_to_record
  from plotly.basedatatypes import BaseFigure, BaseTraceType
  from ..aggregation import AbstractAggregator, MedDiffGapHandler, MinMaxLTTB
  from ..aggregation.aggregation_interface import DataPointSelector
  from ..aggregation.gap_handler_interface import AbstractGapHandler
  from ..aggregation.plotly_aggregator_parser import PlotlyAggregatorParser
  from .utils import round_number_str, round_td_str
label_desc: Use image node_id 11 for calling the AbstractFigureAggregator obj's underlying member method code with example usage: obj._parse_get_trace_props(trace, hf_x, hf_y, hf_text, hf_hovertext, hf_marker_size, hf_marker_color, check_nans) and returns: _hf_data_container