docstr: Overwrites all or some of the data in this buffer with the provided data.
  
  Args:
      new_data: The new data to overwrite existing records with.
      at_indices: A single int is interpreted as an index, at which to overwrite
          the individual record stored at this index with `new_data`.
          A list of ints is interpreted as a list of indices, which to overwrite
          with `new_data`, which must be a batch of size `len(at_indices)`.
          A slice object is interpreted as a range, which to overwrite with
          `new_data`. Thereby, negative indices by default are interpreted as
          "before the end" unless the `neg_indices_left_of_zero=True` option is
          used, in which case negative indices are interpreted as
          "before ts=0", meaning going back into the lookback buffer.
      neg_indices_left_of_zero: If True, negative values in `at_indices` are
          interpreted as "before ts=0", meaning going back into the lookback
          buffer. For example, a buffer with data [4, 5, 6,  7, 8, 9],
          where [4, 5, 6] is the lookback buffer range (ts=0 item is 7), will
          handle a call `set(99, at_indices=-1, neg_indices_left_of_zero=True)`
          with `6` being replaced by 99 and to `set([98, 99, 100],
          at_indices=slice(-2, 1), neg_indices_left_of_zero=True)` with
          `[5, 6,  7]` being replaced by `[98, 99,  100]`.
docstr_tok: ["Overwrites","all","or","some","of","the","data","in","this","buffer","with","the","provided","data",".","Args",":","new_data",":","The","new","data","to","overwrite","existing","records","with",".","at_indices",":","A","single","int","is","interpreted","as","an","index",",","at","which","to","overwrite","the","individual","record","stored","at","this","index","with","`","new_data","`",".","A","list","of","ints","is","interpreted","as","a","list","of","indices",",","which","to","overwrite","with","`","new_data","`",",","which","must","be","a","batch","of","size","`","len","(","at_indices",")","`",".","A","slice","object","is","interpreted","as","a","range",",","which","to","overwrite","with","`","new_data","`",".","Thereby",",","negative","indices","by","default","are","interpreted","as","``","before","the","end","''","unless","the","`","neg_indices_left_of_zero=True","`","option","is","used",",","in","which","case","negative","indices","are","interpreted","as","``","before","ts=0","''",",","meaning","going","back","into","the","lookback","buffer",".","neg_indices_left_of_zero",":","If","True",",","negative","values","in","`","at_indices","`","are","interpreted","as","``","before","ts=0","''",",","meaning","going","back","into","the","lookback","buffer",".","For","example",",","a","buffer","with","data","[","4",",","5",",","6",",","7",",","8",",","9","]",",","where","[","4",",","5",",","6","]","is","the","lookback","buffer","range","(","ts=0","item","is","7",")",",","will","handle","a","call","`","set","(","99",",","at_indices=-1",",","neg_indices_left_of_zero=True",")","`","with","`","6","`","being","replaced","by","99","and","to","`","set","(","[","98",",","99",",","100","]",",","at_indices=slice","(","-2",",","1",")",",","neg_indices_left_of_zero=True",")","`","with","`","[","5",",","6",",","7","]","`","being","replaced","by","`","[","98",",","99",",","100","]","`","."]
code: def set(
      self,
      new_data,
      *,
      at_indices: Optional[Union[int, slice, List[int]]] = None,
      neg_indices_left_of_zero: bool = False,
  ) -> None:
      """Overwrites all or some of the data in this buffer with the provided data.
  
      Args:
          new_data: The new data to overwrite existing records with.
          at_indices: A single int is interpreted as an index, at which to overwrite
              the individual record stored at this index with `new_data`.
              A list of ints is interpreted as a list of indices, which to overwrite
              with `new_data`, which must be a batch of size `len(at_indices)`.
              A slice object is interpreted as a range, which to overwrite with
              `new_data`. Thereby, negative indices by default are interpreted as
              "before the end" unless the `neg_indices_left_of_zero=True` option is
              used, in which case negative indices are interpreted as
              "before ts=0", meaning going back into the lookback buffer.
          neg_indices_left_of_zero: If True, negative values in `at_indices` are
              interpreted as "before ts=0", meaning going back into the lookback
              buffer. For example, a buffer with data [4, 5, 6,  7, 8, 9],
              where [4, 5, 6] is the lookback buffer range (ts=0 item is 7), will
              handle a call `set(99, at_indices=-1, neg_indices_left_of_zero=True)`
              with `6` being replaced by 99 and to `set([98, 99, 100],
              at_indices=slice(-2, 1), neg_indices_left_of_zero=True)` with
              `[5, 6,  7]` being replaced by `[98, 99,  100]`.
      """
      # `at_indices` is None -> Override all our data (excluding the lookback buffer).
      if at_indices is None:
          self._set_all_data(new_data)
  
      elif isinstance(at_indices, slice):
          self._set_slice(
              new_data,
              slice_=at_indices,
              neg_indices_left_of_zero=neg_indices_left_of_zero,
          )
      elif isinstance(at_indices, list):
          for i, idx in enumerate(at_indices):
              self._set_int_index(
                  new_data[i],
                  idx=idx,
                  neg_indices_left_of_zero=neg_indices_left_of_zero,
              )
      else:
          assert isinstance(at_indices, int)
          self._set_int_index(
              new_data,
              idx=at_indices,
              neg_indices_left_of_zero=neg_indices_left_of_zero,
          )
  
imports: import logging
  from typing import List, Optional, Type, Union
  import gymnasium
  import numpy
  import tree
  from ray.rllib.env.env_context import EnvContext
  from ray.rllib.env.multi_agent_env import MultiAgentEnv
  from ray.rllib.env.wrappers.multi_agent_env_compatibility import MultiAgentEnvCompatibility
  from ray.rllib.utils.error import ERR_MSG_INVALID_ENV_DESCRIPTOR, ERR_MSG_OLD_GYM_API, EnvError
  from ray.rllib.utils.gym import check_old_gym_env
  from ray.rllib.utils.numpy import one_hot, one_hot_multidiscrete
  from ray.rllib.utils.spaces.space_utils import batch, get_dummy_batch_for_space, get_base_struct_from_space
  from ray.util import log_once
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 10 for calling the BufferWithInfiniteLookback obj's underlying member method code with example usage: obj.set(new_data) without return types