Save this command file as an ascii file.

        Agrs:
            outpath (str): The output path to save.
555827
def save(self, outpath):
        

        with open(outpath, "w") as outfile:
            outfile.write(self.dump())
953675
def saveAs(self, path):
        
        if not path:
            path = self._dialogs.getSaveFileName(filter='*.csv')
        if path:
            self._setPath(path)
            with open(str(self._path), 'wb') as stream:
                writer = csv.writer(stream)
                table = self.table()
                for row in table:
                    writer.writerow(row)
63943
def _output_path(self, input_path, to_format, archive=False):
        
        indirpath, fname = os.path.split(os.path.abspath(os.path.normpath(input_path)))

        commonprefix = os.path.commonprefix([os.path.abspath(self.file_generator.from_path),
                                             os.path.abspath(indirpath)])

        commonparts = commonprefix.split(os.sep)
        inparts = indirpath.split(os.sep)
        outparts = inparts[len(commonparts):]

        if archive:
            outdirpath = os.path.join(*outparts) if outparts else ""
        else:
            outdirpath = os.path.join(self.file_generator.to_path, *outparts)

        return os.path.join(outdirpath, fname + self.file_generator.file_extension[to_format])
389273
def dump(self):
        

        out = []

        out.append(self.filetype)
        out.append("Format: {}".format(self.version))
        out.append("Type: ASCII")
        out.append("")

        for cmd in self.commands:
            out.append(self.encode(cmd))

        return "\n".join(out) + "\n"
767213
def fs_encode(path):
    

    path = _get_path(path)
    if path is None:
        raise TypeError("expected a valid path to encode")
    if isinstance(path, six.text_type):
        if six.PY2:
            return b"".join(
                (
                    _byte(ord(c) - 0xDC00)
                    if 0xDC00 <= ord(c) <= 0xDCFF
                    else c.encode(_fs_encoding, _fs_encode_errors)
                )
                for c in path
            )
        return path.encode(_fs_encoding, _fs_encode_errors)
    return path
325688
def _get_result_paths(self,data):
        
        output_dir = self.Parameters['--out-dir'].Value
        result = {}
        result['json'] = ResultPath(Path=join(output_dir,
                                splitext(split(self._input_filename)[-1])[0] + \
                                '.jplace'))
        return result
1045290
def save(self, path=None, encoding=None, eol=None):
        
        path = path or self.path
        encoding = encoding or self.encoding

        save_file = codecs.open(path, 'w+', encoding=encoding)
        self.write_into(save_file, eol=eol)
        save_file.close()
484517
def serial_assimilate(self, rootpath):
        
        valid_paths = []
        for (parent, subdirs, files) in os.walk(rootpath):
            valid_paths.extend(self._drone.get_valid_paths((parent, subdirs,
                                                            files)))
        data = []
        count = 0
        total = len(valid_paths)
        for path in valid_paths:
            newdata = self._drone.assimilate(path)
            self._data.append(newdata)
            count += 1
            logger.info('{}/{} ({:.2f}%) done'.format(count, total,
                                                      count / total * 100))
        for d in data:
            self._data.append(json.loads(d, cls=MontyDecoder))
731291
def outputSaveCallback(self, at_data, **kwargs):
        
        path                = at_data[0]
        d_outputInfo        = at_data[1]
        other.mkdir(self.str_outputDir)
        filesSaved          = 0
        other.mkdir(path)
        if not self.testType:
            str_outfile         = '%s/file-ls.txt'      % path
        else:
            str_outfile         = '%s/file-count.txt'   % path

        with open(str_outfile, 'w') as f:
            self.dp.qprint("saving: %s" % (str_outfile), level = 5)
            if not self.testType:
                f.write('%s`' % self.pp.pformat(d_outputInfo['l_file']))
            else:
                f.write('%d\n' % d_outputInfo['filesAnalyzed'])
        filesSaved += 1
        
        return {
            'status':       True,
            'outputFile':   str_outfile,
            'filesSaved':   filesSaved
        }
353994
def save_outputs(outputs, output_fpath):
    
    df = pd.DataFrame(outputs)
    with pd.ExcelWriter(output_fpath) as writer:
        df.to_excel(writer)
1029242
def mkpath(*args)
      args[0] = {} unless args[0]
      args[0] = args[0].merge(mode: 0700) unless args[0][:mode]
      FileUtils.mkpath(self.to_s, *args)
    end
641674
def save_outputs(self, rootpath='.', raw=False):
        
        self.save_twi(rootpath, raw)
        self.save_uca(rootpath, raw)
        self.save_slope(rootpath, raw)
        self.save_direction(rootpath, raw)
908249
def save
      output_path = @options['output_path']
      staging_path = @options['staging_path']

      @assets.each do |asset|
        directory = File.join(@source, staging_path, output_path)
        write_asset_file(directory, asset)

        # Store output path of saved file
        asset.output_path = output_path
      end
    end
11978
def save_signal(self,filename=None):
        
        if filename is None:
            filename = os.path.join(self.folder,'trsig.pkl')
        self.trsig.save(filename)
1013930
def save_as(output_file_path, failure_list=[])
      @pdfreader     = Rjb::import('com.lowagie.text.pdf.PdfReader')
      @pdfcopyfields = Rjb::import('com.lowagie.text.pdf.PdfCopyFields')
      @filestream    = Rjb::import('java.io.FileOutputStream')

      filestream = @filestream.new(output_file_path)
      copy = @pdfcopyfields.new(filestream)
      
      @files_to_merge.each do |f|
        if File.exists?(f)
          begin
            copy.addDocument(@pdfreader.new(f))
          rescue => e
            failure_list << f
            log "PDF::Merger: Invalid PDF: #{f}"            
          end
        else
          failure_list << f
          log "PDF::Merger: File does not exist: #{f}"
        end
      end
      
      if @files_to_merge.size - failure_list.size > 0
        copy.addJavaScript(@js) if @js && !@js.empty?
        copy.close()
        @pdfreader.new(output_file_path).getNumberOfPages
      else
        0
      end
    end
70945
def mmi_to_ascii(self, force_flag=False):
        """"""
        ascii_path = os.path.join(
            self.output_dir, '%s.asc' % self.output_basename)
        # Short circuit if the tif is already created.
        if os.path.exists(ascii_path) and force_flag is not True:
            return ascii_path

        cell_size = (self.x_maximum - self.x_minimum) / (self.rows - 1)
        asc_file = open(ascii_path, 'w')
        asc_file.write('ncols %d\n' % self.columns)
        asc_file.write('nrows %d\n' % self.rows)
        asc_file.write('xllcorner %.3f\n' % self.x_minimum)
        asc_file.write('yllcorner %.3f\n' % self.y_minimum)
        asc_file.write('cellsize %.3f\n' % cell_size)
        asc_file.write('nodata_value -9999\n')

        cell_string = ''
        cell_values = np.reshape(
            [v[2] for v in self.mmi_data], (self.rows, self.columns))
        for i in range(self.rows):
            for j in range(self.columns):
                cell_string += '%.3f ' % cell_values[i][j]
            cell_string += '\n'

        asc_file.write(cell_string)

        asc_file.close()

        return ascii_path
578667
def wine_to_unix(self, in_path):
		

		if len(in_path) > MAX_PATH:
			raise # TODO

		in_path_buffer_p = ctypes.pointer(ctypes.create_unicode_buffer(in_path + '\0'))
		in_path_ustr_p = ctypes.pointer(UNICODE_STRING())

		self.__dos_to_nt__(in_path_buffer_p, in_path_ustr_p, None, None)

		out_path_astr_p = ctypes.pointer(ANSI_STRING())

		ntstatus = self.__wine_to_unix__(
			in_path_ustr_p, out_path_astr_p,
			self.FILE_OPEN_IF, int(False)
			)

		if ntstatus != 0:
			raise # TODO

		return self.__winastr_to_str__(out_path_astr_p.contents)