class_docstr: A dict with special properties to support partial indexing.
  
  The main properties of NestedDict are::
      * The NestedDict gives access to nested elements as a sequence of
      strings.
      * These NestedDicts can also be used to filter a superset into a subset of
      nested elements with the filter function.
      * This can be instantiated with any mapping of strings, or an iterable of
      key value tuples where the values can themselves be recursively the values
      that a NestedDict can take.
      * The length of a NestedDict is the number of leaves in the tree, excluding
      empty leafs.
      * Iterating over a NestedDict yields the leaves of the tree, including empty
      leafs.
  
  Args:
      x: a representation of a NestedDict: it can be an iterable of `SeqStrType`
      to values. e.g. `[(("a", "b") , 1), ("b", 2)]` or a mapping of flattened
      keys to values. e.g. `{("a", "b"): 1, ("b",): 2}` or any nested mapping,
      e.g. `{"a": {"b": 1}, "b": {}}`.
  
  Basic Usage:
  .. testcode::
      :skipif: True
  
      foo_dict = NestedDict()
      # Setting elements, possibly nested:
      foo_dict['a'] = 100         # foo_dict = {'a': 100}
      foo_dict['b', 'c'] = 200    # foo_dict = {'a': 100, 'b': {'c': 200}}
      foo_dict['b', 'd'] = 300    # foo_dict = {'a': 100,
                                  #             'b': {'c': 200, 'd': 300}}
      foo_dict['b', 'e'] = {}     # foo_dict = {'a': 100,
                                  #            'b': {'c': 200, 'd': 300}}
      # Getting elements, possibly nested:
      print(foo_dict['b', 'c'])   # 200
      print(foo_dict['b'])        # {'c': 200, 'd': 300}
      print(foo_dict.get('b'))    # {'c': 200, 'd': 300}
      print(foo_dict) # {'a': 100, 'b': {'c': 200, 'd': 300}}
      # Converting to a dict:
      foo_dict.asdict()  # {'a': 100, 'b': {'c': 200, 'd': 300}}
      # len function:
      print(len(foo_dict))  # 3
      # Iterating:
      foo_dict.keys()  # dict_keys(['a', ('b', 'c'), ('b', 'd')])
      foo_dict.items() # dict_items([('a', 100), (('b', 'c'), 200), (('b', 'd'), 300)])
      foo_dict.shallow_keys()  # dict_keys(['a', 'b'])
  
      Filter:
      .. testcode::
          :skipif: True
  
          dict1 = NestedDict([
              (('foo', 'a'), 10), (('foo', 'b'), 11),
              (('bar', 'c'), 11), (('bar', 'a'), 110)])
          dict2 = NestedDict([('foo', NestedDict(dict(a=11)))])
          dict3 = NestedDict([('foo', NestedDict(dict(a=100))),
                              ('bar', NestedDict(dict(d=11)))])
          dict4 = NestedDict([('foo', NestedDict(dict(a=100))),
                              ('bar', NestedDict(dict(c=11)))])
          dict1.filter(dict2).asdict()   # {'foo': {'a': 10}}
          dict1.filter(dict4).asdict()   # {'bar': {'c': 11}, 'foo': {'a': 10}}
          dict1.filter(dict3).asdict()   # KeyError - ('bar', 'd') not in dict1
class_docstr_tok: ["A","dict","with","special","properties","to","support","partial","indexing",".","The","main","properties","of","NestedDict","are",":",":","*","The","NestedDict","gives","access","to","nested","elements","as","a","sequence","of","strings",".","*","These","NestedDicts","can","also","be","used","to","filter","a","superset","into","a","subset","of","nested","elements","with","the","filter","function",".","*","This","can","be","instantiated","with","any","mapping","of","strings",",","or","an","iterable","of","key","value","tuples","where","the","values","can","themselves","be","recursively","the","values","that","a","NestedDict","can","take",".","*","The","length","of","a","NestedDict","is","the","number","of","leaves","in","the","tree",",","excluding","empty","leafs",".","*","Iterating","over","a","NestedDict","yields","the","leaves","of","the","tree",",","including","empty","leafs",".","Args",":","x",":","a","representation","of","a","NestedDict",":","it","can","be","an","iterable","of","`","SeqStrType","`","to","values",".","e.g",".","`","[","(","(","``","a","''",",","``","b","''",")",",","1",")",",","(","``","b","''",",","2",")","]","`","or","a","mapping","of","flattened","keys","to","values",".","e.g",".","`","{","(","``","a","''",",","``","b","''",")",":","1",",","(","``","b","''",",",")",":","2","}","`","or","any","nested","mapping",",","e.g",".","`","{","``","a","''",":","{","``","b","''",":","1","}",",","``","b","''",":","{","}","}","`",".","Basic","Usage",":","..","testcode",":",":",":","skipif",":","True","foo_dict","=","NestedDict","(",")","#","Setting","elements",",","possibly","nested",":","foo_dict","[","'","a","'","]","=","100","#","foo_dict","=","{","'","a","'",":","100","}","foo_dict","[","'","b","'",",","'","c","'","]","=","200","#","foo_dict","=","{","'","a","'",":","100",",","'","b","'",":","{","'","c","'",":","200","}","}","foo_dict","[","'","b","'",",","'d","'","]","=","300","#","foo_dict","=","{","'","a","'",":","100",",","#","'","b","'",":","{","'","c","'",":","200",",","'d","'",":","300","}","}","foo_dict","[","'","b","'",",","'","e","'","]","=","{","}","#","foo_dict","=","{","'","a","'",":","100",",","#","'","b","'",":","{","'","c","'",":","200",",","'d","'",":","300","}","}","#","Getting","elements",",","possibly","nested",":","print","(","foo_dict","[","'","b","'",",","'","c","'","]",")","#","200","print","(","foo_dict","[","'","b","'","]",")","#","{","'","c","'",":","200",",","'d","'",":","300","}","print","(","foo_dict.get","(","'","b","'",")",")","#","{","'","c","'",":","200",",","'d","'",":","300","}","print","(","foo_dict",")","#","{","'","a","'",":","100",",","'","b","'",":","{","'","c","'",":","200",",","'d","'",":","300","}","}","#","Converting","to","a","dict",":","foo_dict.asdict","(",")","#","{","'","a","'",":","100",",","'","b","'",":","{","'","c","'",":","200",",","'d","'",":","300","}","}","#","len","function",":","print","(","len","(","foo_dict",")",")","#","3","#","Iterating",":","foo_dict.keys","(",")","#","dict_keys","(","[","'","a","'",",","(","'","b","'",",","'","c","'",")",",","(","'","b","'",",","'d","'",")","]",")","foo_dict.items","(",")","#","dict_items","(","[","(","'","a","'",",","100",")",",","(","(","'","b","'",",","'","c","'",")",",","200",")",",","(","(","'","b","'",",","'d","'",")",",","300",")","]",")","foo_dict.shallow_keys","(",")","#","dict_keys","(","[","'","a","'",",","'","b","'","]",")","Filter",":","..","testcode",":",":",":","skipif",":","True","dict1","=","NestedDict","(","[","(","(","'foo","'",",","'","a","'",")",",","10",")",",","(","(","'foo","'",",","'","b","'",")",",","11",")",",","(","(","'bar","'",",","'","c","'",")",",","11",")",",","(","(","'bar","'",",","'","a","'",")",",","110",")","]",")","dict2","=","NestedDict","(","[","(","'foo","'",",","NestedDict","(","dict","(","a=11",")",")",")","]",")","dict3","=","NestedDict","(","[","(","'foo","'",",","NestedDict","(","dict","(","a=100",")",")",")",",","(","'bar","'",",","NestedDict","(","dict","(","d=11",")",")",")","]",")","dict4","=","NestedDict","(","[","(","'foo","'",",","NestedDict","(","dict","(","a=100",")",")",")",",","(","'bar","'",",","NestedDict","(","dict","(","c=11",")",")",")","]",")","dict1.filter","(","dict2",")",".asdict","(",")","#","{","'foo","'",":","{","'","a","'",":","10","}","}","dict1.filter","(","dict4",")",".asdict","(",")","#","{","'bar","'",":","{","'","c","'",":","11","}",",","'foo","'",":","{","'","a","'",":","10","}","}","dict1.filter","(","dict3",")",".asdict","(",")","#","KeyError","-","(","'bar","'",",","'d","'",")","not","in","dict1"]
docstr: Returns a shallow copy of the NestedDict.
docstr_tok: ["Returns","a","shallow","copy","of","the","NestedDict","."]
code: def copy(self) -> "NestedDict[T]":
      """Returns a shallow copy of the NestedDict."""
      return NestedDict(self.items())
  
imports: from collections import abc
  import itertools
  from typing import AbstractSet, Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Tuple, TypeVar, Union
  from ray.rllib.utils.annotations import ExperimentalAPI
label_desc: Use image node_id 13 for calling the NestedDict obj's underlying member method code with example usage: obj.copy() and returns: NestedDict