Persist all subsets
437332
public function save()
    {
        $host = $this;
        array_map(function ($value) use ($host) {
            $host->saveSubset($value);
        }, $this->fileBasedSubsets);
    }
833968
def persist(self, key, value):
        
        encoded = self.encoding.encode(value)
        self.__set_or_create(key, encoded)
        self.__increment_last_updated()
602070
@Override
	public boolean retainAll(Collection<?> c) {
		combine();
		if(combined==null) combined = new HashSet<>();
		return combined.retainAll(c);
	}
978217
@Override
	public boolean retainAll(Collection<?> collection) {
		if (dao == null) {
			return false;
		}
		boolean changed = false;
		CloseableIterator<T> iterator = closeableIterator();
		try {
			while (iterator.hasNext()) {
				T data = iterator.next();
				if (!collection.contains(data)) {
					iterator.remove();
					changed = true;
				}
			}
			return changed;
		} finally {
			IOUtils.closeQuietly(iterator);
		}
	}
227347
@Override
   public boolean retainAll(Collection<?> c) {
      boolean modified = false;
      try (CloseableIterator<O> it = iterator()) {
         while (it.hasNext()) {
            if (!c.contains(it.next())) {
               it.remove();
               modified = true;
            }
         }
         return modified;
      }
   }
1028587
private boolean persistSet(@Nullable final Set<String> set) {
        if (set != null && shouldPersist()) {
            if (set.equals(getPersistedSet(null))) {
                return true;
            }

            Editor editor = getPreferenceManager().getSharedPreferences().edit();
            editor.putStringSet(getKey(), set);
            editor.apply();
            return true;
        }

        return false;
    }
279318
function(fs, subset) {
        for (var i = 0; i < fs.length; i++) {
            for (var j = 0; j < subset.length; j++) {
                if ((subset[j] !== undefined) && (fs[i].equivalentTo(subset[j]))) {
                    fs[i].causedBy = this.uniquesCausedBy(fs[i].causedBy, subset[j].causedBy);
                    fs[i].consequences = fs[i].consequences.concat(subset[j].consequences);
                    subset[j].doPropagate(fs[i]);                                                            
                    delete subset[j];
                }
            }
        }
        for (i = 0; i < subset.length; i++) {
            if (subset[i] !== undefined) fs.push(subset[i]);
        }
    }
934246
def _persist_inplace(self, **kwargs):
        
        # access .data to coerce everything to numpy or dask arrays
        lazy_data = {k: v._data for k, v in self.variables.items()
                     if isinstance(v._data, dask_array_type)}
        if lazy_data:
            import dask

            # evaluate all the dask arrays simultaneously
            evaluated_data = dask.persist(*lazy_data.values(), **kwargs)

            for k, data in zip(lazy_data, evaluated_data):
                self.variables[k].data = data

        return self
408424
def setsebools(pairs, persist=False):
    '''
    
    '''
    if not isinstance(pairs, dict):
        return {}
    if persist:
        cmd = 'setsebool -P '
    else:
        cmd = 'setsebool '
    for boolean, value in six.iteritems(pairs):
        cmd = '{0} {1}={2}'.format(cmd, boolean, value)
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
526601
private void batch_insert(Collection<Integer> set, boolean parallel)
    {
        for(int i : set)
            store[size++] = i;
        if(parallel)
            Arrays.parallelSort(store, 0, size);
        else
            Arrays.sort(store, 0, size);
    }
527039
def persist(self):
        """"""
        if self.hash:
            with open(self.file_name, 'wb') as f:
                pickle.dump(self.object_property, f)
            return True
        return False
1213127
def store_many(self, sql, values):
        """"""
        cursor = self.get_cursor()
        cursor.executemany(sql, values)
        self.conn.commit()
978882
def persist(name, value, config='/etc/sysctl.conf'):
    '''
    
    '''
    nlines = []
    edited = False
    value = six.text_type(value)

    # create /etc/sysctl.conf if not present
    if not os.path.isfile(config):
        try:
            with salt.utils.files.fopen(config, 'w+'):
                pass
        except (IOError, OSError):
            msg = 'Could not create {0}'
            raise CommandExecutionError(msg.format(config))

    with salt.utils.files.fopen(config, 'r') as ifile:
        for line in ifile:
            line = salt.utils.stringutils.to_unicode(line)
            m = re.match(r'{0}(\??=)'.format(name), line)
            if not m:
                nlines.append(line)
                continue
            else:
                key, rest = line.split('=', 1)
                if rest.startswith('"'):
                    _, rest_v, rest = rest.split('"', 2)
                elif rest.startswith('\''):
                    _, rest_v, rest = rest.split('\'', 2)
                else:
                    rest_v = rest.split()[0]
                    rest = rest[len(rest_v):]
                if rest_v == value:
                    return 'Already set'
                new_line = '{0}{1}{2}{3}'.format(name, m.group(1), value, rest)
                nlines.append(new_line)
                edited = True

    if not edited:
        newline = '{0}={1}'.format(name, value)
        nlines.append("{0}\n".format(newline))

    with salt.utils.files.fopen(config, 'wb') as ofile:
        ofile.writelines(
            salt.utils.data.encode(nlines)
        )

    assign(name, value)

    return 'Updated'
1232835
function persist(client, next) {
    var single = isModel(item)
      , data;

    switch (method) {
      case 'create':
        data = single ? [ item.clone() ] : item.clone().models;
        client.insert(pluck(data), config, function inserted(error, results) {
          if (error) return next(error);

          //
          // Set the _stored property for each model to true.
          //
          results.forEach(function each(model) {
            if (single) return item.stored = model._id;
            item.id(model._id).stored = model._id;
          });

          next(null, results);
        });
      break;

      case 'read':
        //
        // Models will be read by Model _id if no query was passed or if
        // the Model already exists in the database. This would otherwise
        // result in data ambiguity.
        //
        query = query || {};
        if (single && item.id) query._id = item.id;

        //
        // No query and Model has no ObjectId reference, return early.
        //
        if (single && !Object.keys(query).length) return next(null, null);

        //
        // Read the documents from the MongoDB database and process
        // the results, depending on the item being a Model or Collection.
        //
        client.find(query, config).toArray(function found(error, results) {
          if (error) return next(error);
          if (single) results = results[0];

          //
          // If the item is a model, parse first. After merge the results
          // of the read operation in the current item.
          //
          if (single && options.parse) results = item.parse(results, options);
          item.set(results);

          next(null, results);
        });
      break;

      case 'update':
      case 'patch':
        data = single ? [ item ] : item.models;
        async.reduce(data, 0, function loopModels(memo, model, fn) {
          model = model.clone();
          var update = { $set: pluck(model) };
          if (config.upsert) update = pluck(model);

          client.update({ _id: model.id }, update, config, function updated(error, results) {
            if (error) return next(error);

            model.stored = model.id;
            fn(null, memo + results);
          });
        }, next);
      break;

      case 'delete':
        data = single ? [ item ] : item.models;
        async.reduce(data, 0, function loopModels(memo, model, fn) {
          client.remove({ _id: model.id }, config, function updated(error, results) {
            if (error) return fn(error);

            //
            // Update the stored state properties to false.
            //
            model.stored = false;
            fn(null, memo + results);
          });
        }, next);
      break;
    }
  }
712943
public function persist() : void
    {
        if ($this->statements) {
            $this->loader->addOperation(static::DESCRIPTION, $this->statements);
            $this->statements = [];
        }
    }
114301
def _subset(self, subset):
        """"""
        pl = Pipeline(bundle=self.bundle)
        for group_name, pl_segment in iteritems(self):
            if group_name not in subset:
                continue
            pl[group_name] = pl_segment
        return pl
1019646
def persist(self, storageLevel):
        
        if not isinstance(storageLevel, StorageLevel):
            raise TypeError("`storageLevel` should be a StorageLevel, got %s" % type(storageLevel))
        javaStorageLevel = self._java_matrix_wrapper._sc._getJavaStorageLevel(storageLevel)
        self._java_matrix_wrapper.call("persist", javaStorageLevel)
        return self