Initialize PROV graph with all we know at the start of the recording
331081
def init_prov_graph(self):
        

        try:
            # Use git2prov to get prov on the repo
            repo_prov = check_output(
                ['node_modules/git2prov/bin/git2prov', 'https://github.com/{}/{}/'.format(self.user, self.repo),
                 'PROV-O']).decode("utf-8")
            repo_prov = repo_prov[repo_prov.find('@'):]
            # glogger.debug('Git2PROV output: {}'.format(repo_prov))
            glogger.debug('Ingesting Git2PROV output into RDF graph')
            with open('temp.prov.ttl', 'w') as temp_prov:
                temp_prov.write(repo_prov)

            self.prov_g.parse('temp.prov.ttl', format='turtle')
        except Exception as e:
            glogger.error(e)
            glogger.error("Couldn't parse Git2PROV graph, continuing without repo PROV")
            pass

        self.prov_g.add((self.agent, RDF.type, self.prov.Agent))
        self.prov_g.add((self.entity_d, RDF.type, self.prov.Entity))
        self.prov_g.add((self.activity, RDF.type, self.prov.Activity))

        # entity_d
        self.prov_g.add((self.entity_d, self.prov.wasGeneratedBy, self.activity))
        self.prov_g.add((self.entity_d, self.prov.wasAttributedTo, self.agent))
        # later: entity_d genereated at time (when we know the end time)

        # activity
        self.prov_g.add((self.activity, self.prov.wasAssociatedWith, self.agent))
        self.prov_g.add((self.activity, self.prov.startedAtTime, Literal(datetime.now())))
562943
def _initialize(self):
        """"""

        self.log.debug("Start initializing data from %s",
                       self.url)
        resp = self.get(self.url,
                        verify=False,
                        proxies=self.rtc_obj.proxies,
                        headers=self.rtc_obj.headers)
        self.__initialize(resp)
        self.log.info("Finish the initialization for <%s %s>",
                      self.__class__.__name__, self)
321983
function initReplay() {
  const replayOption = ['record', 'replay'].find(opt => program[opt] === true)
  if (replayOption) process.env.REPLAY = replayOption

  process.env.REPLAY =
    replayOption || (process.env.REPLAY ? process.env.REPLAY : 'bloody')

  if (process.env.REPLAY !== 'bloody') require('replay')
}
571874
function savePrettyGraphSON(graph, filename, callback) {
        var ByteArrayOutputStream = Tinkerpop.autoImport('ByteArrayOutputStream');
        var stream = new ByteArrayOutputStream();
        return Tinkerpop.GraphSONWriter.buildP()
            .then(function (builder) {
            return _newGraphSONMapper()
                .then(function (mapper) { return builder.mapperP(mapper); });
        })
            .then(function (builder) { return builder.createP(); })
            .then(function (writer) { return writer.writeGraphP(stream, graph); })
            .then(function () { return stream.toStringP(); })
            .then(function (ugly) {
            var prettyString = _prettyGraphSONString(ugly);
            var writeFileP = BluePromise.promisify(fs.writeFile);
            return writeFileP(filename, prettyString);
        })
            .then(function () { return graph; })
            .nodeify(callback);
    }
195678
def start_recording(self):
        """"""
        self._recording = True
        self._stop_recording.clear()
        self._source.start()
1125464
def build_graph(self):
        """"""
        self.global_step = tf.Variable(0, trainable=False)
        self._build_model()
        if self.mode == "train":
            self._build_train_op()
        else:
            # Additional initialization for the test network.
            self.variables = ray.experimental.tf_utils.TensorFlowVariables(
                self.cost)
            self.summaries = tf.summary.merge_all()
1127453
def _update_recording(self, frame, config):
    ''''''
    # pylint: disable=redefined-variable-type
    should_record = config['is_recording']

    if should_record:
      if not self.is_recording:
        self.is_recording = True
        logger.info(
            'Starting recording using %s',
            self.video_writer.current_output().name())
      self.video_writer.write_frame(frame)
    elif self.is_recording:
      self.is_recording = False
      self.video_writer.finish()
      logger.info('Finished recording')
1278891
private void startPerformanceSnapshot() {
        // Create new snapshot
        mPerfSnapshot = new Bundle();

        // Add initial binder counts
        Bundle binderCounts = getBinderCounts();
        for (String key : binderCounts.keySet()) {
            mPerfSnapshot.putLong("pre_" + key, binderCounts.getLong(key));
        }

        // Force a GC and zero out the performance counters. Do this
        // before reading initial CPU/wall-clock times so we don't include
        // the cost of this setup in our final metrics.
        startAllocCounting();

        // Record CPU time up to this point, and start timing. Note: this
        // must happen at the end of this method, otherwise the timing will
        // include noise.
        mSnapshotExecTime = SystemClock.uptimeMillis();
        mSnapshotCpuTime = Process.getElapsedCpuTime();
    }
549824
protected void initTopLevelState(APMSpan topSpan, TraceRecorder recorder, ContextSampler sampler) {
        nodeBuilder = new NodeBuilder();
        traceContext = new TraceContext(topSpan, nodeBuilder, recorder, sampler);
    }
478761
def initialize_processing():
    

    need_initialize = False

    needed_algorithms = [
        'native:clip',
        'gdal:cliprasterbyextent',
        'native:union',
        'native:intersection'
    ]

    if not QgsApplication.processingRegistry().algorithms():
        need_initialize = True

    if not need_initialize:
        for needed_algorithm in needed_algorithms:
            if not QgsApplication.processingRegistry().algorithmById(
                    needed_algorithm):
                need_initialize = True
                break

    if need_initialize:
        QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
        processing.Processing.initialize()
306327
function initialize() {
  var scene = ds = exports.ds = {
    "time": 0,
    "song": null,
    "graph": null,
    "shaders": {},
    "textures": {},
    "texturesToLoad": 0,
    "audio": { "loaded": false, "playing": false },
    "isLoaded": function() {
      return this.graph !== null && this.texturesToLoad === 0 && this.audio.loaded === true;
    },
    "next": null
  };
  scene.gl = initializeWebGL();
  initAudio(scene.audio);
  initUI(scene);

  scene.shaders.sprite = createGlslProgram(scene.gl, "vertexShaderSprite", "fragmentShaderSprite");
  scene.shaders.particle = createGlslProgram(scene.gl, "vertexShaderParticle", "fragmentShaderParticle");

  window.requestAnimationFrame(animationFrame.bind(null, scene));
}
37462
@SuppressWarnings("unused")
  final void startRecording() {
    if (firstTime) {
      Object obj;
      doStartRecording();
      obj = new Object();
      AllocationStats stats = stopRecording(1);
      if (stats.getAllocationCount() != 1 || stats.getAllocationSize() < 1) {
        throw new IllegalStateException(
            String.format("The allocation recording infrastructure appears to be broken. "
                + "Expected to find exactly one allocation of a java/lang/Object instead found %s",
                stats));
      }
      firstTime = false;
    }
    doStartRecording();
  }
89877
def start(self):
        
        try:
            self._depth_align = False
            if self._registration_mode == RealSenseRegistrationMode.DEPTH_TO_COLOR:
                self._depth_align = True

            self._config_pipe()
            self._profile = self._pipe.start(self._cfg)

            # store intrinsics and depth scale
            self._set_depth_scale()
            self._set_intrinsics()

            # skip few frames to give auto-exposure a chance to settle
            for _ in range(5):
                self._pipe.wait_for_frames()

            self._running = True
        except RuntimeError as e:
            print(e)
1254617
def OnInit(self):
        """"""

        # Get command line options and arguments
        cmdp = Commandlineparser()
        options, filename = cmdp.parse()

        kwargs = {
            "title": "pyspread",
            "S": self.S
        }

        # Store command line input in config if no file is provided
        if filename is None:
            kwargs["dimensions"] = options.dimensions

        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, **kwargs)

        # Initialize file loading via event

        if gnupg is not None and options.new_gpgkey:
            # Create GPG key if not present

            try:
                from src.lib.gpg import genkey
                self.config["gpg_key_fingerprint"] = repr("")
                genkey()

            except ImportError:
                pass

            except ValueError:
                # python-gnupg is installed but gnupg is not installed
                pass

        # Show application window
        self.SetTopWindow(self.main_window)
        self.main_window.Show()

        # Load filename if provided
        if filename is not None:
            post_command_event(self.main_window, self.GridActionOpenMsg,
                               attr={"filepath": filename})
            self.main_window.filepath = filename

        return True
1234961
def start_recording(self, output_file):
        
        if not self._started:
            raise Exception("Must start the video recorder first by calling .start()!")
        if self._recording:
            raise Exception("Cannot record a video while one is already recording!")
        self._recording = True
        self._cmd_q.put(('start', output_file))
269219
def initialize_snapshot(self):
        
        logger.debug('Initializing DAG snapshot for job {0}'.format(self.name))
        if self.snapshot is not None:
            logging.warn("Attempting to initialize DAG snapshot without " +
                         "first destroying old snapshot.")

        snapshot_to_validate = deepcopy(self.graph)

        is_valid, reason = self.validate(snapshot_to_validate)
        if not is_valid:
            raise DagobahError(reason)

        self.snapshot = snapshot_to_validate
5931
def _init(self):
        """"""
        group_stack = [self]
        clip_stack = []
        last_layer = None

        for record, channels in self._record._iter_layers():
            current_group = group_stack[-1]

            blocks = record.tagged_blocks
            end_of_group = False
            divider = blocks.get_data('SECTION_DIVIDER_SETTING', None)
            divider = blocks.get_data('NESTED_SECTION_DIVIDER_SETTING',
                                      divider)
            if divider is not None:
                if divider.kind == SectionDivider.BOUNDING_SECTION_DIVIDER:
                    layer = Group(self, None, None, current_group)
                    group_stack.append(layer)
                elif divider.kind in (SectionDivider.OPEN_FOLDER,
                                      SectionDivider.CLOSED_FOLDER):
                    layer = group_stack.pop()
                    assert layer is not self

                    layer._record = record
                    layer._channels = channels
                    for key in (
                        'ARTBOARD_DATA1', 'ARTBOARD_DATA2', 'ARTBOARD_DATA3'
                    ):
                        if key in blocks:
                            layer = Artboard._move(layer)
                    end_of_group = True
            elif (
                'TYPE_TOOL_OBJECT_SETTING' in blocks or
                'TYPE_TOOL_INFO' in blocks
            ):
                layer = TypeLayer(self, record, channels, current_group)
            elif (
                record.flags.pixel_data_irrelevant and (
                    'VECTOR_ORIGINATION_DATA' in blocks or
                    'VECTOR_MASK_SETTING1' in blocks or
                    'VECTOR_MASK_SETTING2' in blocks or
                    'VECTOR_STROKE_DATA' in blocks or
                    'VECTOR_STROKE_CONTENT_DATA' in blocks
                )
            ):
                layer = ShapeLayer(self, record, channels, current_group)
            elif (
                'SMART_OBJECT_LAYER_DATA1' in blocks or
                'SMART_OBJECT_LAYER_DATA2' in blocks or
                'PLACED_LAYER1' in blocks or
                'PLACED_LAYER2' in blocks
            ):
                layer = SmartObjectLayer(self, record, channels,
                                         current_group)
            else:
                layer = None
                for key in adjustments.TYPES.keys():
                    if key in blocks:
                        layer = adjustments.TYPES[key](
                            self, record, channels, current_group
                        )
                        break
                # If nothing applies, this is a pixel layer.
                if layer is None:
                    layer = PixelLayer(
                        self, record, channels, current_group
                    )

            if record.clipping == Clipping.NON_BASE:
                clip_stack.append(layer)
            else:
                if clip_stack:
                    last_layer._clip_layers = clip_stack
                clip_stack = []
                if not end_of_group:
                    current_group._layers.append(layer)
                last_layer = layer

        if clip_stack and last_layer:
            last_layer._clip_layers = clip_stack