Copy and iterate over the list of keys because this loop
    will alter the `initiator_transfers` list and this is not
    allowed if iterating over the original list.
427189
def subdispatch_to_all_initiatortransfer(
        payment_state: InitiatorPaymentState,
        state_change: StateChange,
        channelidentifiers_to_channels: ChannelMap,
        pseudo_random_generator: random.Random,
) -> TransitionResult[InitiatorPaymentState]:
    events = list()
    ''' 
    '''
    for secrethash in list(payment_state.initiator_transfers.keys()):
        initiator_state = payment_state.initiator_transfers[secrethash]
        sub_iteration = subdispatch_to_initiatortransfer(
            payment_state=payment_state,
            initiator_state=initiator_state,
            state_change=state_change,
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            pseudo_random_generator=pseudo_random_generator,
        )
        events.extend(sub_iteration.events)
    return TransitionResult(payment_state, events)
574566
function transfer( targetObj, ...sourceObjList ) {
    sourceObjList.forEach(sourceObj => {
        Object.keys(sourceObj).forEach(sourceObjKey => {
            targetObj[sourceObjKey] = sourceObj[sourceObjKey];
        })
    });
    return targetObj;
}
299736
def mget(self, *keys):
        
        return list(map(
            self._loads, self._client.hmget(self.key_prefix, *keys)))
635351
public final void chainInitialized() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "chainInitialized, chain: " + this.name);
        }
        // Clone the list in case one of the event listeners modifies
        // the chain during this iteration.
        for (ChainEventListener listener : chainEventListeners) {
            listener.chainInitialized(this);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "chainInitialized");
        }
    }
368443
def _updatecopy(orig, update_with, keys=None, override=False):
    
    d = orig.copy()
    if keys is None:
        keys = update_with.keys()
    for k in keys:
        if k in update_with:
            if k in d and not override:
                continue
            d[k] = update_with[k]
    return d
1162666
def transfer_all(cls, field_mappings, sources, destination_factory=None):
    """"""
    for index, source in enumerate(sources):
      try:
        yield cls.transfer(field_mappings, source, destination_factory or (lambda x: x))
      except Exception as ex:
        raise Exception("Error with source #{0}: {1}".format(index, ex)) from ex
303141
private void transferSemiUnique(SemiUniqueEntry[] src, SemiUniqueEntry[] dest) {
        for (int j = 0; j < src.length; ++j)
        {
            SemiUniqueEntry e = src[j];
            src[j] = null;
            while (e != null)
            {
                SemiUniqueEntry next = e.getSemiUniqueNext();
                int i = indexFor(e.getSemiUniqueHash(), dest.length);
                e.setSemiUniqueNext(dest[i]);
                dest[i] = e;
                e = next;
            }
        }
    }
153352
def take_column(self, keys, *extra_keys):
        
        import utool as ut
        keys = ut.ensure_iterable(keys) + list(extra_keys)
        key_to_list = ut.dict_subset(self._key_to_list, keys)
        newself = self.__class__(key_to_list, self._meta.copy())
        return newself
640599
public static StorageKey copy(StorageKey toCopy) {
    return new StorageKey(toCopy.strategy, Lists.newArrayList(toCopy.values));
  }
1138038
def initialize_copy(other)
      @trigger_group = other
      @triggers = nil
      @chained_calls = []
      @errors = []
      @warnings = []
      @options = @options.dup
      @options.delete(:name) # this will be inferred (or set further down the line)
      @options.each do |key, value|
        @options[key] = value.dup rescue value
      end
    end
695078
def iter_instances(self):
        
        for wrkey in set(self.keys()):
            obj = self.get(wrkey)
            if obj is None:
                continue
            yield wrkey, obj
1299308
public MigrateArgs<K> keys(Iterable<K> keys) {
        LettuceAssert.notNull(keys, "Keys must not be null");
        for (K key : keys) {
            this.keys.add(key);
        }
        return this;
    }
1077130
def copy(self):
        

        metadata = {}
        # grab all the keys into a list so if something is added
        # in another thread it probably doesn't stomp on our loop
        for key in list(self.metadata.keys()):
            try:
                metadata[key] = copy.deepcopy(self.metadata[key])
            except RuntimeError:
                # multiple threads
                log.warning('key {} changed during copy'.format(key))

        # copy the core data
        copied = type(self)(entities=copy.deepcopy(self.entities),
                            vertices=copy.deepcopy(self.vertices),
                            metadata=metadata)

        cache = {}
        # try to copy the cache over to the new object
        try:
            # save dict keys before doing slow iteration
            keys = list(self._cache.cache.keys())
            # run through each key and copy into new cache
            for k in keys:
                cache[k] = copy.deepcopy(self._cache.cache[k])
        except RuntimeError:
            # if we have multiple threads this may error and is NBD
            log.debug('unable to copy cache')
        except BaseException:
            # catch and log errors we weren't expecting
            log.error('unable to copy cache', exc_info=True)
        copied._cache.cache = cache
        copied._cache.id_set()

        return copied
188772
def copy_iterator(self):
        
        self.__udiff, iterator_copy = itertools.tee(self.__udiff)
        return iterator_copy
1130483
def chained_get(self, *keys):
        
        existing = self
        for i in range(0, len(keys)):
            if keys[i] in existing:
                existing = existing[keys[i]]
            else:
                return None
        return existing
1269289
function (key) {
                    this._initializeKeys();
                    var args = copyargs(arguments);
                    args[0] = this._keys.indexOf(key);
                    return this.splice.apply(this, args);
                }
1255531
def _copy(self):
        
        table = {}
        for existingState, existingOutputs in self.table.items():
            table[existingState] = {}
            for (existingInput, existingTransition) in existingOutputs.items():
                table[existingState][existingInput] = existingTransition
        return TransitionTable(table)