Create the post states snapshot
505018
def _snapper_post(opts, jid, pre_num):
    '''
    
    '''
    try:
        if not opts['test'] and __opts__.get('snapper_states') and pre_num:
            # Run the snapper pre snapshot
            __salt__['snapper.create_snapshot'](
                    config=__opts__.get('snapper_states_config', 'root'),
                    snapshot_type='post',
                    pre_number=pre_num,
                    description='Salt State run for jid {0}'.format(jid),
                    __pub_jid=jid)
    except Exception:
        log.error('Failed to create snapper pre snapshot for jid: %s', jid)
98192
def make_snapshot(self):
        
        filename = join(self.output_dir, '{:010d}.pkl'.format(self.model.i))
        output_utils.model_to_file(self.model, filename)
982618
function (state, payload) {
        var entity = payload.entity;
        var data = payload.data;
        var options = OptionsBuilder.createPersistOptions(payload);
        var result = payload.result;
        result.data = (new Query(state, entity)).create(data, options);
    }
867797
def snapshot(ctx, board, done):
    
    ctx.obj['board_id'] = board
    ts = TrelloStats(ctx.obj)
    Snapshot.create_table(fail_silently=True)
    done_id = ts.get_list_id_from_name(done)
    ct = cycle_time(ts, board, done)
    env = get_env()
    print render_text(env, **dict(cycle_time=ct))

    # Create snapshot
    print Snapshot.create(board_id=board, done_id=done_id, cycle_time=ct)
435330
function addIdToSnapshot(snapshot) {
  var record = snapshot.record;
  record.get('store').updateId(record, { id: generateUniqueId() });
  return record._createSnapshot();
}
7750
def create_new_post(params)      
      post_title = params['post']['title']
      post_date  = (Time.now).strftime("%Y-%m-%d")

      content    = yaml_data(post_title).to_yaml + "---\n" + params[:post][:content]
      post_file  = (post_date + " " + post_title).to_url + '.md'
      file       = File.join(jekyll_site.source, *%w[_posts], post_file)
      File.open(file, 'w') { |file| file.write(content)}
      post_file
    end
1310714
function(store, type, snapshot) {
        var data = this._serializeData(store, type, snapshot);

        return this.ajax(this.buildURL(type.modelName), 'POST', {
          data: data
        });
      }
637838
function Snapshot (id, obj) {
  if (!id) {
    var errIdMsg = 'id not injected!';
    debug(errIdMsg);
    throw new Error(errIdMsg);
  }

  if (!obj) {
    var errObjMsg = 'object not injected!';
    debug(errObjMsg);
    throw new Error(errObjMsg);
  }

  if (!obj.aggregateId) {
    var errAggIdMsg = 'object.aggregateId not injected!';
    debug(errAggIdMsg);
    throw new Error(errAggIdMsg);
  }

  if (!obj.data) {
    var errDataMsg = 'object.data not injected!';
    debug(errDataMsg);
    throw new Error(errDataMsg);
  }

  this.id = id;
  this.streamId = obj.aggregateId;
  this.aggregateId = obj.aggregateId;
  this.aggregate = obj.aggregate || null;
  this.context = obj.context || null;
  this.commitStamp = null;
  this.revision = obj.revision;
  this.version = obj.version;
  this.data = obj.data;
}
710270
def update_snapshots(self, snapshots_data: List[Tuple[str, int]]):
        
        cursor = self.conn.cursor()
        cursor.executemany(
            'UPDATE state_snapshot SET data=? WHERE identifier=?',
            snapshots_data,
        )
        self.maybe_commit()
142408
def snapshot(self):
        
        with self._lock:
            current_state = self.state_manager.current_state
            state_change_id = self.state_change_id

            # otherwise no state change was dispatched
            if state_change_id:
                self.storage.write_state_snapshot(state_change_id, current_state)
1318199
def make_setup_state(
            self,
            app: 'Quart',
            first_registration: bool,
            *,
            url_prefix: Optional[str]=None,
    ) -> 'BlueprintSetupState':
        
        return BlueprintSetupState(self, app, first_registration, url_prefix=url_prefix)
713791
def make_snapshot_from_ops_hash( cls, record_root_hash, prev_consensus_hashes ):
        
        # mix into previous consensus hashes...
        all_hashes = prev_consensus_hashes[:] + [record_root_hash]
        all_hashes.sort()
        all_hashes_merkle_tree = MerkleTree( all_hashes )
        root_hash = all_hashes_merkle_tree.root()

        consensus_hash = StateEngine.calculate_consensus_hash( root_hash )
        return consensus_hash
94451
def savestate(self, state):
        """"""
        oldstate = np.get_printoptions()
        np.set_printoptions(threshold=1e6)
        try:
            with open(os.path.join(self._directory, 'state.txt'), 'w') as f:
                print_(state, file=f)
        finally:
            np.set_printoptions(**oldstate)
744496
public void snapshotState(StateSnapshotContext context) throws Exception {
		final KeyedStateBackend<?> keyedStateBackend = getKeyedStateBackend();
		//TODO all of this can be removed once heap-based timers are integrated with RocksDB incremental snapshots
		if (keyedStateBackend instanceof AbstractKeyedStateBackend &&
			((AbstractKeyedStateBackend<?>) keyedStateBackend).requiresLegacySynchronousTimerSnapshots()) {

			KeyedStateCheckpointOutputStream out;

			try {
				out = context.getRawKeyedOperatorStateOutput();
			} catch (Exception exception) {
				throw new Exception("Could not open raw keyed operator state stream for " +
					getOperatorName() + '.', exception);
			}

			try {
				KeyGroupsList allKeyGroups = out.getKeyGroupList();
				for (int keyGroupIdx : allKeyGroups) {
					out.startNewKeyGroup(keyGroupIdx);

					timeServiceManager.snapshotStateForKeyGroup(
						new DataOutputViewStreamWrapper(out), keyGroupIdx);
				}
			} catch (Exception exception) {
				throw new Exception("Could not write timer service of " + getOperatorName() +
					" to checkpoint state stream.", exception);
			} finally {
				try {
					out.close();
				} catch (Exception closeException) {
					LOG.warn("Could not close raw keyed operator state stream for {}. This " +
						"might have prevented deleting some state data.", getOperatorName(), closeException);
				}
			}
		}
	}
299409
def _snapshot(self) -> Dict[str, Any]:
        
        try:
            return {name: item._snapshot for name, item in self._nested_items.items()}
        except Exception as e:
            raise SnapshotError('Error while creating snapshot for {}'.format(self._name)) from e
505023
def snapshot(self):
        """"""
        data_item = self.__class__()
        # data format (temporary until moved to buffered data source)
        data_item.large_format = self.large_format
        data_item.set_data_and_metadata(copy.deepcopy(self.data_and_metadata), self.data_modified)
        # metadata
        data_item.created = self.created
        data_item.timezone = self.timezone
        data_item.timezone_offset = self.timezone_offset
        data_item.metadata = self.metadata
        data_item.title = self.title
        data_item.caption = self.caption
        data_item.description = self.description
        data_item.session_id = self.session_id
        data_item.session_data = copy.deepcopy(self.session_data)
        return data_item
64436
private void createSnapshot(final String name, final List<String> types) throws FrameworkException {

		// we want to create a sorted, human-readble, diffable representation of the schema
		final App app = StructrApp.getInstance();

		// isolate write output
		try (final Tx tx = app.tx()) {

			final File snapshotFile = locateFile(name, true);
			try (final Writer writer = new FileWriter(snapshotFile)) {

				final JsonSchema schema = StructrSchema.createFromDatabase(app, types);

				writer.append(schema.toString());
				writer.append("\n");    // useful newline

				writer.flush();
			}

			tx.success();

		} catch (IOException | URISyntaxException ioex) {
			logger.warn("", ioex);
		}
	}