Writes self.gs to self.grindstone_path.
341174
def write_grindstone(self):
        
        with open(self.grindstone_path, 'w') as f:
            # Write the JSON dump of the file
            f.write(json.dumps(self.grindstone))
637264
def rapid_to_gssha(self):
        
        # if no streamflow given, download forecast
        if self.path_to_rapid_qout is None and self.connection_list_file:
            rapid_qout_directory = os.path.join(self.gssha_directory, 'rapid_streamflow')
            try:
                os.mkdir(rapid_qout_directory)
            except OSError:
                pass
            self.path_to_rapid_qout = self.download_spt_forecast(rapid_qout_directory)

        # prepare input for GSSHA if user wants
        if self.path_to_rapid_qout is not None and self.connection_list_file:
            self.event_manager.prepare_rapid_streamflow(self.path_to_rapid_qout,
                                                        self.connection_list_file)
            self.simulation_modified_input_cards.append('CHAN_POINT_INPUT')
808345
def write_path(self, path_value):
        
        parent_dir = os.path.dirname(self.path)
        try:
            os.makedirs(parent_dir)
        except OSError:
            pass
        with open(self.path, "w") as fph:
            fph.write(path_value.value)
1241328
def write(self, s):
        
        should_write_s = os.getenv('PROGRESSIVE_NOWRITE') != "True"
        if should_write_s:
            self._stream.write(s)
560220
public void write(WeightedGraph<? extends WeightedEdge> g, File gexfFile) 
            throws IOException {
        write(g, gexfFile, null);
    }
94562
def WritePathInfos(self, client_id, path_infos):
    """"""
    try:
      self._MultiWritePathInfos({client_id: path_infos})
    except MySQLdb.IntegrityError as error:
      raise db.UnknownClientError(client_id=client_id, cause=error)
1018596
def write_to_path(self, path=None):
        """"""
        if path is None:
            path = self.path
        f = GitFile(path, 'wb')
        try:
            self.write_to_file(f)
        finally:
            f.close()
288993
def open_grindstone(self):
        
        try:
            with open(self.grindstone_path, 'r') as f:
                # Try opening the file
                return json.loads(f.read())
        # If the file is empty
        except json.decoder.JSONDecodeError:
            # Default return empty object with empty tasks list
            return {'tasks': []}
        # The file does not yet exist
        except FileNotFoundError:
            # Default return empty object with empty tasks list
            return {'tasks': []}
276347
def _write(self, session, openFile, replaceParamFile):
        
        # Write lines
        openFile.write('GSSHA_CHAN\n')

        alpha = vwp(self.alpha, replaceParamFile)
        try:
            openFile.write('ALPHA%s%.6f\n' % (' ' * 7, alpha))
        except:
            openFile.write('ALPHA%s%s\n' % (' ' * 7, alpha))

        beta = vwp(self.beta, replaceParamFile)
        try:
            openFile.write('BETA%s%.6f\n' % (' ' * 8, beta))
        except:
            openFile.write('BETA%s%s\n' % (' ' * 8, beta))

        theta = vwp(self.theta, replaceParamFile)
        try:
            openFile.write('THETA%s%.6f\n' % (' ' * 7, theta))
        except:
            openFile.write('THETA%s%s\n' % (' ' * 7, theta))

        openFile.write('LINKS%s%s\n' % (' ' * 7, self.links))
        openFile.write('MAXNODES%s%s\n' % (' ' * 4, self.maxNodes))

        # Retrieve StreamLinks
        links = self.getOrderedLinks(session)

        self._writeConnectivity(links=links,
                                fileObject=openFile)
        self._writeLinks(links=links,
                         fileObject=openFile,
                         replaceParamFile=replaceParamFile)
445542
def write(self):
        """"""
        if self._path is None:
            raise ValueError("Instance was not initialized with a path, use to_file(...) instead")
        # END assert path
        self.to_file(self._path)
        return self
78465
function(cfg, callback) {
  // Input files
  var files = cfg.input_files;

  // Output dir
  var outputPath = cfg.output_dir;

  if (files.length > 0) {
    new gear.Queue({registry: taskRegistry}) // register tasks
    .log(formatLog('Copying files:', files))
    .copyFiles({input: files, output: outputPath}, callback)
    .log(formatLog('Copied files to: ', outputPath))
    .run(callback);
  } else {
    callback();
  }
}
985633
def _MultiWritePathInfos(self, path_infos, connection=None):
    """"""
    query = ""

    path_info_count = 0
    path_info_values = []

    parent_path_info_count = 0
    parent_path_info_values = []

    has_stat_entries = False
    has_hash_entries = False

    for client_id, client_path_infos in iteritems(path_infos):
      for path_info in client_path_infos:
        path = mysql_utils.ComponentsToPath(path_info.components)

        path_info_values.append(db_utils.ClientIDToInt(client_id))
        path_info_values.append(int(path_info.path_type))
        path_info_values.append(path_info.GetPathID().AsBytes())
        path_info_values.append(path)
        path_info_values.append(bool(path_info.directory))
        path_info_values.append(len(path_info.components))

        if path_info.HasField("stat_entry"):
          path_info_values.append(path_info.stat_entry.SerializeToString())
          has_stat_entries = True
        else:
          path_info_values.append(None)
        if path_info.HasField("hash_entry"):
          path_info_values.append(path_info.hash_entry.SerializeToString())
          path_info_values.append(path_info.hash_entry.sha256.AsBytes())
          has_hash_entries = True
        else:
          path_info_values.append(None)
          path_info_values.append(None)

        path_info_count += 1

        # TODO(hanuszczak): Implement a trie in order to avoid inserting
        # duplicated records.
        for parent_path_info in path_info.GetAncestors():
          path = mysql_utils.ComponentsToPath(parent_path_info.components)

          parent_path_info_values.append(db_utils.ClientIDToInt(client_id))
          parent_path_info_values.append(int(parent_path_info.path_type))
          parent_path_info_values.append(parent_path_info.GetPathID().AsBytes())
          parent_path_info_values.append(path)
          parent_path_info_values.append(len(parent_path_info.components))

          parent_path_info_count += 1

    query += """
    CREATE TEMPORARY TABLE client_path_infos(
      client_id BIGINT UNSIGNED NOT NULL,
      path_type INT UNSIGNED NOT NULL,
      path_id BINARY(32) NOT NULL,
      path TEXT NOT NULL,
      directory BOOLEAN NOT NULL,
      depth INT NOT NULL,
      stat_entry MEDIUMBLOB NULL,
      hash_entry MEDIUMBLOB NULL,
      sha256 BINARY(32) NULL,
      timestamp TIMESTAMP(6) NOT NULL DEFAULT now(6)
    );"""

    if path_info_count > 0:
      query += """
      INSERT INTO client_path_infos(client_id, path_type, path_id,
                                    path, directory, depth,
                                    stat_entry, hash_entry, sha256)
      VALUES {};
      """.format(mysql_utils.Placeholders(num=9, values=path_info_count))

      query += """
      INSERT INTO client_paths(client_id, path_type, path_id, path,
                               directory, depth)
           SELECT client_id, path_type, path_id, path, directory, depth
             FROM client_path_infos
      ON DUPLICATE KEY UPDATE
        client_paths.directory = client_paths.directory OR VALUES(client_paths.directory),
        client_paths.timestamp = now(6);
      """

    if parent_path_info_count > 0:
      placeholders = ["(%s, %s, %s, %s, TRUE, %s)"] * parent_path_info_count

      query += """
      INSERT INTO client_paths(client_id, path_type, path_id, path,
                               directory, depth)
      VALUES {}
      ON DUPLICATE KEY UPDATE
        directory = TRUE,
        timestamp = now();
      """.format(", ".join(placeholders))

    if has_stat_entries:
      query += """
      INSERT INTO client_path_stat_entries(client_id, path_type, path_id,
                                           stat_entry, timestamp)
           SELECT client_id, path_type, path_id, stat_entry, timestamp
             FROM client_path_infos
            WHERE stat_entry IS NOT NULL;
      """

      query += """
      UPDATE client_paths, client_path_infos
         SET client_paths.last_stat_entry_timestamp = client_path_infos.timestamp
       WHERE client_paths.client_id = client_path_infos.client_id
         AND client_paths.path_type = client_path_infos.path_type
         AND client_paths.path_id = client_path_infos.path_id
         AND client_path_infos.stat_entry IS NOT NULL;
      """

    if has_hash_entries:
      query += """
      INSERT INTO client_path_hash_entries(client_id, path_type, path_id,
                                           hash_entry, sha256, timestamp)
           SELECT client_id, path_type, path_id, hash_entry, sha256, timestamp
             FROM client_path_infos
            WHERE hash_entry IS NOT NULL;
      """

      query += """
      UPDATE client_paths, client_path_infos
         SET client_paths.last_hash_entry_timestamp = client_path_infos.timestamp
       WHERE client_paths.client_id = client_path_infos.client_id
         AND client_paths.path_type = client_path_infos.path_type
         AND client_paths.path_id = client_path_infos.path_id
         AND client_path_infos.hash_entry IS NOT NULL;
      """

    try:
      with contextlib.closing(connection.cursor()) as cursor:
        cursor.execute(query, path_info_values + parent_path_info_values)
    finally:
      # Drop the temporary table in a separate cursor. This ensures that
      # even if the previous cursor.execute fails mid-way leaving the
      # temporary table created (as table creation can't be rolled back), the
      # table would still be correctly dropped.
      #
      # This is important since connections are reused in the MySQL connection
      # pool.
      with contextlib.closing(connection.cursor()) as cursor:
        cursor.execute("DROP TEMPORARY TABLE IF EXISTS client_path_infos")
92930
public void writeTo(Writer target, boolean flushTarget, boolean emptyAfter)
            throws IOException
    {
        //if (target instanceof GrailsWrappedWriter) {
        //    target = ((GrailsWrappedWriter)target).unwrap();
        //}
        if (target instanceof StreamCharBufferWriter)
        {
            if (target == writer)
            {
                throw new IllegalArgumentException(
                        "Cannot write buffer to itself.");
            }
            ((StreamCharBufferWriter) target).write(this);
            return;
        }
        writeToImpl(target, flushTarget, emptyAfter);
    }
729844
def write(settings_path, settings_data, **kwargs):
    """"""
    for key, value in settings_data.items():
        dotenv_cli.set_key(str(settings_path), key.upper(), str(value))
96745
def build(self, input_path, output_paths):
        """"""
        for output in output_paths:
            shutil.copy(input_path, output_paths)
1066744
def _write(self, session, openFile, replaceParamFile=None, writeIndexMaps=True):
        
        # Extract directory
        directory = os.path.split(openFile.name)[0]

        # Derive a Unique Set of Contaminants
        for mapTable in self.getOrderedMapTables(session):
            if mapTable.name == 'CONTAMINANT_TRANSPORT':
                contaminantList = []
                for mtValue in mapTable.values:
                    if mtValue.contaminant not in contaminantList:
                        contaminantList.append(mtValue.contaminant)

                contaminants = sorted(contaminantList, key=lambda x: (x.indexMap.name, x.name))

        # Write first line to file
        openFile.write('GSSHA_INDEX_MAP_TABLES\n')

        # Write list of index maps
        for indexMap in self.indexMaps:
            # Write to map table file
            openFile.write('INDEX_MAP%s"%s" "%s"\n' % (' ' * 16, indexMap.filename, indexMap.name))

            if writeIndexMaps:
                # Initiate index map write
                indexMap.write(directory, session=session)

        for mapTable in self.getOrderedMapTables(session):
            if mapTable.name == 'SEDIMENTS':
                self._writeSedimentTable(session=session,
                                         fileObject=openFile,
                                         mapTable=mapTable,
                                         replaceParamFile=replaceParamFile)
            elif mapTable.name == 'CONTAMINANT_TRANSPORT':
                self._writeContaminantTable(session=session,
                                            fileObject=openFile,
                                            mapTable=mapTable,
                                            contaminants=contaminants,
                                            replaceParamFile=replaceParamFile)
            else:
                self._writeMapTable(session=session,
                                    fileObject=openFile,
                                    mapTable=mapTable,
                                    replaceParamFile=replaceParamFile)
798152
def write(self, path=None):
        
        if not self._path and not path:
            raise ConfigException('no config path given')
        if path:
            self._path = path
        if '~' in self._path:
            self._path = os.path.expanduser(self._path)
        f = open(self._path, 'w')
        f.write(json.dumps(self._data))
        f.close()