class_docstr: Non permanent document
  
  This document is meant for debugging purposes within the EphemeralDB.
  
  .. seealso:: :class:`orion.core.io.database.ephemeraldb.EphemeralDB` for database object.
class_docstr_tok: ["Non","permanent","document","This","document","is","meant","for","debugging","purposes","within","the","EphemeralDB",".","..","seealso",":",":",":","class",":","`","orion.core.io.database.ephemeraldb.EphemeralDB","`","for","database","object","."]
docstr: Only select or only drop the specified keys
  
  For a pair (key, value) in the dictionary, value=0 means the key will not be included
  while value=1 means it will.
  
  All specified keys should be 0 or 1. They cannot have different values with the exception
  of _id which can be specified to 0 while the others are at 1. The _id field is always
  returned unless specified with 0.
  
  Parameters
  ----------
  keys: dict
      Pairs of keys and 0 or 1s. When a key is associated with 1, it is kept in the selection,
      otherwise it is dropped.
docstr_tok: ["Only","select","or","only","drop","the","specified","keys","For","a","pair","(","key",",","value",")","in","the","dictionary",",","value=0","means","the","key","will","not","be","included","while","value=1","means","it","will",".","All","specified","keys","should","be","0","or","1",".","They","can","not","have","different","values","with","the","exception","of","_id","which","can","be","specified","to","0","while","the","others","are","at","1",".","The","_id","field","is","always","returned","unless","specified","with","0",".","Parameters","--","--","--","--","--","keys",":","dict","Pairs","of","keys","and","0","or","1s",".","When","a","key","is","associated","with","1",",","it","is","kept","in","the","selection",",","otherwise","it","is","dropped","."]
code: def select(self, keys):
      """Only select or only drop the specified keys
  
      For a pair (key, value) in the dictionary, value=0 means the key will not be included
      while value=1 means it will.
  
      All specified keys should be 0 or 1. They cannot have different values with the exception
      of _id which can be specified to 0 while the others are at 1. The _id field is always
      returned unless specified with 0.
  
      Parameters
      ----------
      keys: dict
          Pairs of keys and 0 or 1s. When a key is associated with 1, it is kept in the selection,
          otherwise it is dropped.
  
      """
      if not keys:
          return unflatten(self._data)
  
      keys = flatten(keys)
      keys = self._validate_keys(keys)
  
      selection = {}
  
      def key_is_match(key, selected_key):
          """Test if key matches the selected key
  
          key_is_match(abc.def.ghi, abc.def.ghi) -> True
          key_is_match(abc.def.ghi, abc.def) -> True
          key_is_match(abc.def.ghi, abc.de) -> False
          key_is_match(abc.def.ghi, xyz) -> False
          """
          return key == selected_key or (
              key.startswith(selected_key)
              and key.replace(selected_key, "")[0] == "."
          )
  
      for selected_key, include in filter(
          lambda item: item[1], keys.items()
      ):
          match = False
          for key, value in self._data.items():
              if include and key_is_match(key, selected_key):
                  match = True
                  selection[key] = value
  
          if not match:
              selection[selected_key] = None
  
      return unflatten(selection)
  
imports: import copy
  from collections import defaultdict
  from orion.core.io.database import Database, DatabaseError, DuplicateKeyError
  from orion.core.utils.flatten import flatten, unflatten
label_desc: Use image node_id 7 for calling the EphemeralDocument obj's underlying member method code with example usage: obj.select(keys) and returns: unflatten, unflatten, unknown