Return the set of keys which have changed.
558096
def _compare_rows(from_recs, to_recs, keys):
    ""
    return set(
        k for k in keys
        if sorted(from_recs[k].items()) != sorted(to_recs[k].items())
    )
618993
def get_keys_to_action(self):
        """"""
        # get the old mapping of keys to actions
        old_keys_to_action = self.env.unwrapped.get_keys_to_action()
        # invert the keys to action mapping to lookup key combos by action
        action_to_keys = {v: k for k, v in old_keys_to_action.items()}
        # create a new mapping of keys to actions
        keys_to_action = {}
        # iterate over the actions and their byte values in this mapper
        for action, byte in self._action_map.items():
            # get the keys to press for the action
            keys = action_to_keys[byte]
            # set the keys value in the dictionary to the current discrete act
            keys_to_action[keys] = action

        return keys_to_action
622633
def when_change(
        self,
        *keys: Hashable,
        exclude: bool = False,
        live: bool = False,
        timeout: float = None,
        identical_okay: bool = False,
        start_time: bool = None,
        count: int = None,
    ) -> StateWatcher:
        
        if not keys:

            def callback(update: StateUpdate) -> dict:
                return update.after

        else:
            if identical_okay:
                raise ValueError(
                    "Passing both `identical_okay` and `keys` is not possible. "
                    "(Hint: Omit `keys`)"
                )

            key_set = set(keys)

            def select(before, after):
                selected = {*before.keys(), *after.keys()}
                if exclude:
                    return selected - key_set
                else:
                    return selected & key_set

            def callback(update: StateUpdate) -> dict:
                before, after = update.before, update.after
                try:
                    if not any(before[k] != after[k] for k in select(before, after)):
                        raise _SkipStateUpdate
                except KeyError:  # this indirectly implies that something has changed
                    pass
                return update.after

        return StateWatcher(
            state=self,
            live=live,
            timeout=timeout,
            identical_okay=identical_okay,
            start_time=start_time,
            count=count,
            callback=callback,
        )
371266
def keys_to_values(self, keys):
        ""
        return dict((k, v) for k, v in self.data.items() if k in keys)
533543
def re_get(self, pattern):
        
        return {k: self[k] for k in self.re_keys(pattern)}
998546
public function keyDataChanged($key)
    {
        $data           = $this->toArray($key);
        $originalData   = $this->returnOriginalData($key);

        return $data !== $originalData;
    }
733960
def keys(self, key=None, reverse=False):
        """"""
        ks = sorted(list(dict.keys(self)), key=key, reverse=reverse)
        return ks
286788
def deleted_keys(self) -> Iterable[bytes]:
        
        for key, value in self._changes.items():
            if value is DELETED:
                yield key
953672
def check_for_changes(name=nil)
      changed = []
      if name == nil
        self.cache_hash.keys.dup.each do |name|
          if reload_on_change(name)
            changed << name
          end
        end
      else
        name = name.to_s
        if reload_on_change(name)
          changed << name
        end
      end
      logger.debug "check_for_changes(#{name.inspect}) => #{changed.inspect}"
      changed
    end
358707
def difference(self, key, *others):
        """"""
        if not isinstance(key, str):
            raise ValueError("String expected.")
        self.db.sdiffstore(key, [self.key] + [o.key for o in others])
        return Set(key)
1011217
def keys(self, prefix=None):
        """"""
        query = Setting.query
        if prefix:
            query = query.filter(Setting.key.startswith(prefix))

        # don't use iteritems: 'value' require little processing whereas we only
        # want 'key'
        return [i[0] for i in query.yield_per(1000).values(Setting.key)]
172167
public function calculateChangeSet()
    {
        $set = [];
        foreach ($this->current as $key => $current) {
            $original = isset($this->original[$key]) ? $this->original[$key] : null;
            $set[$key]['old'] = $original;
            $set[$key]['new'] = $current;
        }
        foreach ($this->remove as $key) {
            $set[$key]['old'] = $this->original[$key];
            $set[$key]['new'] = null;
        }
        ksort($set);
        return $set;
    }
765404
def get_used_key_frames(self):
        """"""

        skl = self.key_frame_list.sorted_key_list()
        # each element in used_key_frames is a tuple (key_name, key_dict)
        used_key_frames = []
        for kf in skl:
            if kf in self.dct['keys']:
                used_key_frames.append((kf, self.dct['keys'][kf]))
        return used_key_frames
1323482
def lastKey(self, key):
        """"""
        update = self._updateList(key)[0]
        return (update[0].key
                if update
                else None)
796721
def diff(self):
        """"""
        done = set(self.done)
        return [name for name in self.todo if name not in done]
1087410
public function getChanged()
    {
        $values = [];

        foreach (array_keys($this->changed) as $key) {
            $values[$key] = array_key_exists($key, $this->attributes) ? $this->attributes[$key] : null;
        }

        return $values;
    }
1268330
def _rebuild_key_ids(self):
        """"""
        self._key_ids = collections.defaultdict(list)
        for i, x in enumerate(self._pairs):
            self._key_ids[x[0]].append(i)