Save an file to the specified path.
        :param data: binary data of the file
        :param path: path to save the file to
356203
def _save_file(self, data, path):
        
        with open(path, 'wb') as tfile:
            for chunk in data:
                tfile.write(chunk)
1014176
def save(self, file:PathLikeOrBinaryStream= 'data_save.pkl')->None:
        ""
        if not getattr(self, 'label_list', False):
            warn("Serializing the `DataBunch` only works when you created it using the data block API.")
            return
        try_save(self.label_list, self.path, file)
119539
def save_file_data(self, path):
        
        try:
            # just create file with empty text first; this command also creates the whole path to the file
            filesystem.write_file(os.path.join(path, storage.SCRIPT_FILE), "", create_full_path=True)
            storage_utils.write_dict_to_json(self.model.state.semantic_data, os.path.join(path, storage.SEMANTIC_DATA_FILE))
        except IOError as e:
            # Only happens if the file doesnt exist yet and would be written to the temp folder.
            # The method write_file doesn't create the path
            logger.error('The operating system raised an error: {}'.format(e))
1312768
def tar_files(self, path: Path) -> bytes:
        
        tarstream = BytesIO()
        tar = tarfile.TarFile(fileobj=tarstream, mode='w')
        tar.add(str(path), arcname="data", recursive=True)
        tar.close()
        return tarstream.getvalue()
1018488
def save(self, path=None):
        

        if path is None:
            path = self._PATH_API_CONTEXT_DEFAULT

        with open(path, self._FILE_MODE_WRITE) as file_:
            file_.write(self.to_json())
1127262
def write_json_to_file(path, data):
    
    with open(path, 'w', encoding='utf-8') as f:
        json.dump(data, f)
628055
def save(self, path):
        
        (folder, filename) = os.path.split(path)
        (name, extension) = os.path.splitext(filename)

        if not name:
            raise ValueError, "name is required"

        if extension:
            format = Image.image_format(extension)
        else:
            format = self.format
            filename = name + self.extension
            path = os.path.join(folder, filename)

        image = self.convert(format)
        if image._contents:
            f = open(path, "wb")
            f.write(image._contents)
            f.close()
        else:
            image.pil_image.save(path, format)

        return path
919174
public SetData set(String path, String data) {
        SetData command = new SetData();
        command.path(path);
        command.data(data);
        command.version(0);
        action.setCommand(command);
        return command;
    }
99914
def save_to_path(path: str, config: Config) -> None:
    
    LOG.debug(f"Saving config to {path}")
    with open(path, 'w') as cf:
        cf.write(json.dumps({k: v for k, v in config._asdict().items()
                             if k != 'path'}))
583854
def write_to_file(self, file_path: str) -> None:
        
        data = self.encode()
        with open(file_path, "w") as f:
            json.dump(data, f, indent=1)
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
950492
public static void saveFile(String path, String content, boolean append) throws IOException {
        saveFile(new File(path), content, append);
    }
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()
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]})
70180
def save(self, file_path):
        
        # load data if it's  not loaded convert to SI if it is in IP
        if not self.is_data_loaded:
            self._import_data()
        originally_ip = False
        if self.is_ip is True:
            self.convert_to_si()
            originally_ip = True

        # write the file
        lines = self.header
        try:
            # if the first value is at 1AM, move first item to end position
            for field in xrange(0, self._num_of_fields):
                point_in_time = self._data[field].header.data_type.point_in_time
                if point_in_time is True:
                    first_hour = self._data[field]._values.pop(0)
                    self._data[field]._values.append(first_hour)

            annual_a_per = AnalysisPeriod(is_leap_year=self.is_leap_year)
            for hour in xrange(0, len(annual_a_per.datetimes)):
                line = []
                for field in xrange(0, self._num_of_fields):
                    line.append(str(self._data[field]._values[hour]))
                lines.append(",".join(line) + "\n")
        except IndexError:
            # cleaning up
            length_error_msg = 'Data length is not for a full year and cannot be ' + \
                'saved as an EPW file.'
            raise ValueError(length_error_msg)
        else:
            file_data = ''.join(lines)
            write_to_file(file_path, file_data, True)
        finally:
            del(lines)
            # move last item to start position for fields on the hour
            for field in xrange(0, self._num_of_fields):
                point_in_time = self._data[field].header.data_type.point_in_time
                if point_in_time is True:
                    last_hour = self._data[field]._values.pop()
                    self._data[field]._values.insert(0, last_hour)

        if originally_ip is True:
            self.convert_to_ip()

        return file_path
1373409
def save_metadata(self, file_path):
    
    data = self.metadata
    with open(file_path, 'w')  as out_file:
      json.dump(data, out_file)
174453
def save(self, path):
        
        for relative_path_and_filename, content in self.files.items():
            full_path_and_filename = os.path.join(path, relative_path_and_filename)
            full_path = os.path.dirname(full_path_and_filename)

            if not os.path.isdir(full_path):
                os.makedirs(full_path)

            with open(full_path_and_filename, 'wb') as handle:
                handle.write(b64decode(content))