def write_pyproject(self, show_message: bool = True) -> None: with atomic_open_for_write(self.pyproject_file.as_posix(), encoding="utf-8") as f: f.write(tomlkit.dumps(self.pyproject)) if show_message: stream.echo("Changes are written to pyproject.toml.") self._pyproject = None
def write_lockfile(self, toml_data: Container, show_message: bool = True) -> None: toml_data.update({"root": self.get_project_metadata()}) with atomic_open_for_write(self.lockfile_file) as fp: fp.write(tomlkit.dumps(toml_data)) if show_message: context.io.echo("Changes are written to pdm.lock.") self._lockfile = None
def write(self): open_kwargs = {"newline": self.newlines} with atomic_open_for_write(self.path.as_posix(), **open_kwargs) as f: super(Lockfile, self).dump(f, encoding="utf-8")