Given a SourcesField, request a Snapshot for its path_globs and create an EagerFilesetWithSpec.
518064
def hydrate_sources(sources_field, glob_match_error_behavior):
  
  # TODO(#5864): merge the target's selection of --glob-expansion-failure (which doesn't exist yet)
  # with the global default!
  path_globs = sources_field.path_globs.copy(glob_match_error_behavior=glob_match_error_behavior)
  snapshot = yield Get(Snapshot, PathGlobs, path_globs)
  fileset_with_spec = _eager_fileset_with_spec(
    sources_field.address.spec_path,
    sources_field.filespecs,
    snapshot)
  sources_field.validate_fn(fileset_with_spec)
  yield HydratedField(sources_field.arg, fileset_with_spec)
455385
def db_exists(cls, impl, working_dir):
        
        path = config.get_snapshots_filename(impl, working_dir)
        return os.path.exists(path)
907704
@Override
    public ExtendedSnapshotWriter newSnapshotWriter() throws StorageException {
        checkInitialized();

        try {
            return new SnapshotFileWriter(snapshotsDirectory);
        } catch (Exception e) {
            throw new StorageException("fail create snapshot request", e);
        }
    }
313550
def execute_fields_serially(
        self,
        parent_type: GraphQLObjectType,
        source_value: Any,
        path: Optional[ResponsePath],
        fields: Dict[str, List[FieldNode]],
    ) -> AwaitableOrValue[Dict[str, Any]]:
        
        results: Dict[str, Any] = {}
        for response_name, field_nodes in fields.items():
            field_path = add_path(path, response_name)
            result = self.resolve_field(
                parent_type, source_value, field_nodes, field_path
            )
            if result is INVALID:
                continue
            if isawaitable(results):
                # noinspection PyShadowingNames
                async def await_and_set_result(results, response_name, result):
                    awaited_results = await results
                    awaited_results[response_name] = (
                        await result if isawaitable(result) else result
                    )
                    return awaited_results

                # noinspection PyTypeChecker
                results = await_and_set_result(
                    cast(Awaitable, results), response_name, result
                )
            elif isawaitable(result):
                # noinspection PyShadowingNames
                async def set_result(results, response_name, result):
                    results[response_name] = await result
                    return results

                # noinspection PyTypeChecker
                results = set_result(results, response_name, result)
            else:
                results[response_name] = result
        if isawaitable(results):
            # noinspection PyShadowingNames
            async def get_results():
                return await cast(Awaitable, results)

            return get_results()
        return results
374076
public Operation createSnapshot(String snapshot, String description, OperationOption... options) {
    SnapshotInfo snapshotInfo =
        SnapshotInfo.newBuilder(SnapshotId.of(snapshot), getDiskId())
            .setDescription(description)
            .build();
    return compute.create(snapshotInfo, options);
  }
402807
def create(self, subid, params=None):
        ''' 
        '''
        params = update_params(params, {'SUBID': subid})
        return self.request('/v1/snapshot/create', params, 'POST')
908534
def db_open(cls, impl, working_dir):
        
        path = config.get_snapshots_filename(impl, working_dir)
        return cls.db_connect(path)
1183107
public Operation createSnapshot(String snapshot, OperationOption... options) {
    return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options);
  }
136744
private Snapshot newSnapshot(SnapshotDescriptor descriptor, StorageLevel storageLevel) {
    if (storageLevel == StorageLevel.MEMORY) {
      return createMemorySnapshot(descriptor);
    } else {
      return createDiskSnapshot(descriptor);
    }
  }
462100
def _ProcessArtifactFilesSource(self, source):
    """"""

    if source.path_type != rdf_paths.PathSpec.PathType.OS:
      raise ValueError("Only supported path type is OS.")

    # TODO(user): Check paths for GlobExpressions.
    # If it contains a * then FileFinder will interpret it as GlobExpression and
    # expand it. FileFinderArgs needs an option to treat paths literally.

    paths = []
    pathspec_attribute = source.base_source.attributes.get("pathspec_attribute")

    for source_result_list in self._ProcessSources(
        source.artifact_sources, parser_factory=None):
      for response in source_result_list:
        path = _ExtractPath(response, pathspec_attribute)
        if path is not None:
          paths.append(path)

    file_finder_action = rdf_file_finder.FileFinderAction.Download()
    request = rdf_file_finder.FileFinderArgs(
        paths=paths, pathtype=source.path_type, action=file_finder_action)
    action = file_finder.FileFinderOSFromClient

    yield action, request
1030123
def entity_from_snapshot(snapshot):
    
    assert isinstance(snapshot, AbstractSnapshop), type(snapshot)
    if snapshot.state is not None:
        entity_class = resolve_topic(snapshot.topic)
        return reconstruct_object(entity_class, snapshot.state)
1360525
function(process) {

      function processField(referencingObject,
                            referencingObjectFieldName,
                            referencingObjectFieldValue,
                            containingSnapshot) {
        if (!referencingObjectFieldValue)
          return;

        if (referencingObjectFieldValue instanceof
            tr.model.ObjectSnapshot)
          return null;
        if (referencingObjectFieldValue.id === undefined)
          return;

        var implicitSnapshot = referencingObjectFieldValue;

        var rawId = implicitSnapshot.id;
        var m = /(.+)\/(.+)/.exec(rawId);
        if (!m)
          throw new Error('Implicit snapshots must have names.');
        delete implicitSnapshot.id;
        var name = m[1];
        var id = m[2];
        var res;

        var cat;
        if (implicitSnapshot.cat !== undefined)
          cat = implicitSnapshot.cat;
        else
          cat = containingSnapshot.objectInstance.category;

        var baseTypename;
        if (implicitSnapshot.base_type)
          baseTypename = implicitSnapshot.base_type;
        else
          baseTypename = undefined;

        try {
          res = process.objects.addSnapshot(
              id, cat,
              name, containingSnapshot.ts,
              implicitSnapshot, baseTypename);
        } catch (e) {
          this.model_.importWarning({
            type: 'object_snapshot_parse_error',
            message: 'While processing implicit snapshot of ' +
                rawId + ' at ts=' + containingSnapshot.ts + ': ' + e
          });
          return;
        }
        res.objectInstance.hasImplicitSnapshots = true;
        res.containingSnapshot = containingSnapshot;
        res.snapshottedOnThread = containingSnapshot.snapshottedOnThread;
        referencingObject[referencingObjectFieldName] = res;
        if (!(res instanceof tr.model.ObjectSnapshot))
          throw new Error('Created object must be instanceof snapshot');
        return res.args;
      }

      /**
       * Iterates over the fields in the object, calling func for every
       * field/value found.
       *
       * @return {object} If the function does not want the field's value to be
       * iterated, return null. If iteration of the field value is desired, then
       * return either undefined (if the field value did not change) or the new
       * field value if it was changed.
       */
      function iterObject(object, func, containingSnapshot, thisArg) {
        if (!(object instanceof Object))
          return;

        if (object instanceof Array) {
          for (var i = 0; i < object.length; i++) {
            var res = func.call(thisArg, object, i, object[i],
                                containingSnapshot);
            if (res === null)
              continue;
            if (res)
              iterObject(res, func, containingSnapshot, thisArg);
            else
              iterObject(object[i], func, containingSnapshot, thisArg);
          }
          return;
        }

        for (var key in object) {
          var res = func.call(thisArg, object, key, object[key],
                              containingSnapshot);
          if (res === null)
            continue;
          if (res)
            iterObject(res, func, containingSnapshot, thisArg);
          else
            iterObject(object[key], func, containingSnapshot, thisArg);
        }
      }

      // TODO(nduca): We may need to iterate the instances in sorted order by
      // creationTs.
      process.objects.iterObjectInstances(function(instance) {
        instance.snapshots.forEach(function(snapshot) {
          if (snapshot.args.id !== undefined)
            throw new Error('args cannot have an id field inside it');
          iterObject(snapshot.args, processField, snapshot, this);
        }, this);
      }, this);
    }
1117799
function createRequireFunc(customResolver) {
	return function (requestedPath) {
		var resolvedPath = null;
		try {
			resolvedPath = resolve.sync(requestedPath, {basedir: FIRBASE_DIR});
		} catch (e) {}
		return customResolver(requestedPath, resolvedPath);
	};
}
98192
def make_snapshot(self):
        
        filename = join(self.output_dir, '{:010d}.pkl'.format(self.model.i))
        output_utils.model_to_file(self.model, filename)
1134954
def assure_snapshot(fnc):
    
    @wraps(fnc)
    def _wrapped(self, snapshot, *args, **kwargs):
        if not isinstance(snapshot, CloudBlockStorageSnapshot):
            # Must be the ID
            snapshot = self._snapshot_manager.get(snapshot)
        return fnc(self, snapshot, *args, **kwargs)
    return _wrapped
102855
@SafeVarargs
  public static void
  takeSnapshot(DataSource... dataSources)  {
    ensureDistinctDataSources(dataSources, Function.identity());
    foreach(dataSources, 
           (callInfo, dataSource) -> dataSource.executeQuery(callInfo, true), 
           CallInfo.create());
  }
1336970
def snapshot(self, file_obj):
        
        snapshot_request = etcdrpc.SnapshotRequest()
        snapshot_response = self.maintenancestub.Snapshot(
            snapshot_request,
            self.timeout,
            credentials=self.call_credentials,
            metadata=self.metadata
        )

        for response in snapshot_response:
            file_obj.write(response.blob)