Save the suite to disk.

        Args:
            path (str): Path to save the suite to. If a suite is already saved
                at `path`, then it will be overwritten. Otherwise, if `path`
                exists, an error is raised.
167482
def save(self, path, verbose=False):
        
        path = os.path.realpath(path)
        if os.path.exists(path):
            if self.load_path and self.load_path == path:
                if verbose:
                    print "saving over previous suite..."
                for context_name in self.context_names:
                    self.context(context_name)  # load before dir deleted
                shutil.rmtree(path)
            else:
                raise SuiteError("Cannot save, path exists: %r" % path)

        contexts_path = os.path.join(path, "contexts")
        os.makedirs(contexts_path)

        # write suite data
        data = self.to_dict()
        filepath = os.path.join(path, "suite.yaml")
        with open(filepath, "w") as f:
            f.write(dump_yaml(data))

        # write contexts
        for context_name in self.context_names:
            context = self.context(context_name)
            context._set_parent_suite(path, context_name)
            filepath = self._context_path(context_name, path)
            if verbose:
                print "writing %r..." % filepath
            context.save(filepath)

        # create alias wrappers
        tools_path = os.path.join(path, "bin")
        os.makedirs(tools_path)
        if verbose:
            print "creating alias wrappers in %r..." % tools_path

        tools = self.get_tools()
        for tool_alias, d in tools.iteritems():
            tool_name = d["tool_name"]
            context_name = d["context_name"]

            data = self._context(context_name)
            prefix_char = data.get("prefix_char")

            if verbose:
                print ("creating %r -> %r (%s context)..."
                       % (tool_alias, tool_name, context_name))
            filepath = os.path.join(tools_path, tool_alias)

            create_forwarding_script(filepath,
                                     module="suite",
                                     func_name="_FWD__invoke_suite_tool_alias",
                                     context_name=context_name,
                                     tool_name=tool_name,
                                     prefix_char=prefix_char)
954279
def save_file_data(self, path):
        
        sm = self.model.state.get_state_machine()
        if sm.marked_dirty and not self.saved_initial:
            try:
                # Save the file before opening it to update the applied changes. Use option create_full_path=True
                # to assure that temporary state_machines' script files are saved to
                # (their path doesnt exist when not saved)
                filesystem.write_file(os.path.join(path, storage.SCRIPT_FILE),
                                      self.view.get_text(), create_full_path=True)
            except IOError as e:
                # Only happens if the file doesnt exist yet and would be written to the temp folder.
                # The method write_file doesnt create the path
                logger.error('The operating system raised an error: {}'.format(e))
            self.saved_initial = True
1306162
def path(self, path: str):
        

        path = path if path else ''
        self.pathName = os.path.join(path, self.name)
73316
def do_put(self, from_path, to_path):
        
        from_file = open(os.path.expanduser(from_path), "rb")

        self.n.put(self.current_path + "/" + from_path, to_path)
1124571
def save(path, cov)
      File.binwrite(path, Marshal.dump(sanitize(cov)))
    end
903020
def save(path)

      Dir.mkdir(path) unless File.exists?(path)
      project_filepath = "#{path}/project.pbxproj"

      # @toodo Save the workspace when the project is saved
      # FileUtils.cp_r "#{path}/project.xcworkspace", "#{path}/project.xcworkspace"

      Xcode::PLUTILProjectParser.save "#{path}/project.pbxproj", to_xcplist

    end
625512
def save(self, path="speech"):
        
        if self._data is None:
            raise Exception("There's nothing to save")

        extension = "." + self.__params["format"]
        if os.path.splitext(path)[1] != extension:
            path += extension

        with open(path, "wb") as f:
            for d in self._data:
                f.write(d)

        return path
146033
def save(self, path, key, format, data):
        
        thumbpath = self.get_thumbpath(path, key, format)
        fullpath = os.path.join(self.out_path, thumbpath)
        self.save_thumb(fullpath, data)
        url = self.get_url(thumbpath)
        thumb = Thumb(url, key, fullpath)
        return thumb
608559
def save_to_file(self, path):
        

        with open(path, 'w') as out:
            out.write(json.dumps(self.get_dict()))
846424
def save(self, path):
        
        path = os.path.expandvars(os.path.expanduser(path))
        with open(path, "wb") as f:
            pickle.dump(self.roots, f)
655016
def file_put_contents(self, path, data):
        

        path = self.get_full_file_path(path)

        # if file exists, create a temp copy to allow rollback
        if os.path.isfile(path):
            tmp_path = self.new_tmp()
            self.do_action({
                'do'   : ['copy', path, tmp_path],
                'undo' : ['move', tmp_path, path]})

        self.do_action(
            {'do'   : ['write', path, data],
             'undo' : ['backup', path]})
1312843
def to_file(self, path):
        
        with open(os.path.expanduser(path), "w") as ofile:
            ofile.write(self.__repr__())
1223188
def blockingSave(self, path):
        
        self.tmp_dir_save_session = self.tmp_dir_session.join('block').mkdir()
        state = {'session': dict(self.opts),
                 'dialogs': self.dialogs.saveState()}
        self.saveThread.prepare('0', path, self.tmp_dir_session, state)
        self.sigSave.emit(self)
        self.saveThread.run()
367491
def save(self, path):
        
        f = h5py.File(path, 'w')
        try:
            fm_group = f.create_group('Datamat')
            for field in self.fieldnames():
                try:
                    fm_group.create_dataset(field, data = self.__dict__[field])
                except (TypeError,) as e:
                    # Assuming field is an object array that contains dicts which
                    # contain numpy arrays as values
                    sub_group = fm_group.create_group(field)
                    for i, d in enumerate(self.__dict__[field]):
                        index_group = sub_group.create_group(str(i))
                        print((field, d))
                        for key, value in list(d.items()):
                            index_group.create_dataset(key, data=value)

            for param in self.parameters():
                fm_group.attrs[param]=self.__dict__[param]
        finally:
            f.close()
904246
def put_path(self, url, path):
        
        cache_path = self._url_to_path(url)

        # Ensure that cache directories exist
        try:
            dir = os.path.dirname(cache_path)
            os.makedirs(dir)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise Error('Failed to create cache directories for ' % cache_path)

        # Remove the resource already exist
        try:
            os.unlink(cache_path)
        except OSError:
            pass

        try:
            # First try hard link to avoid wasting disk space & overhead
            os.link(path, cache_path)
        except OSError:
            try:
                # Use file copy as fallaback
                shutil.copyfile(path, cache_path)
            except IOError:
                raise Error('Failed to cache %s as %s for %s' % (path, cache_path, url))
1167882
def save(path, prefix = '')
      FileUtils.mkdir_p(path)
      @edge_tab.save(File.expand_path(prefix + 'edges.tab', path))
      @node_tab.save(File.expand_path(prefix + 'nodes.tab', path))
    end
665254
def _copy_file(self, path):
        
        full_path = self.get_full_archive_path(path)
        # Try to make the dir, eat exception if it fails
        try:
            os.makedirs(os.path.dirname(full_path))
        except OSError:
            pass
        logger.debug("Copying %s to %s", path, full_path)
        shutil.copyfile(path, full_path)
        return path