class_docstr: Traitlet class storing a JupyterChart's selections
docstr: Work around to make traits read-only, but still allow us to change
  them internally
docstr_tok: ["Work","around","to","make","traits","read-only",",","but","still","allow","us","to","change","them","internally"]
code: def _make_read_only(self, change):
      """
      Work around to make traits read-only, but still allow us to change
      them internally
      """
      if (
          change["name"] in self.traits()
          and change["old"] != change["new"]
      ):
          self._set_value(change["name"], change["old"])
      raise ValueError(
          "Selections may not be set from Python.\n"
          f"Attempted to set select: {change['name']}"
      )
  
imports: import json
  import anywidget
  import traitlets
  import pathlib
  from typing import Any, Set, Optional
  import altair
  from altair.utils._vegafusion_data import using_vegafusion, compile_to_vegafusion_chart_state
  from altair import TopLevelSpec
  from altair.utils.selection import IndexSelection, PointSelection, IntervalSelection
label_desc: Use image node_id 3 for calling the Selections obj's underlying member method code with example usage: obj._make_read_only(change) without return types