diff --git a/src/poetry/pyproject/__init__.py b/src/poetry/pyproject/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/poetry/pyproject/toml.py b/src/poetry/pyproject/toml.py index afa3bbf8da8..3e9010b4c85 100644 --- a/src/poetry/pyproject/toml.py +++ b/src/poetry/pyproject/toml.py @@ -14,12 +14,15 @@ from pathlib import Path -# Enhanced version of poetry-core's PyProjectTOML which is capable of writing -# pyproject.toml -# -# The poetry-core class uses tomli to read the file, here we use tomlkit so as to -# preserve comments and formatting when writing. class PyProjectTOML(BasePyProjectTOML): + """ + Enhanced version of poetry-core's PyProjectTOML + which is capable of writing pyproject.toml + + The poetry-core class uses tomli to read the file, + here we use tomlkit to preserve comments and formatting when writing. + """ + def __init__(self, path: Path) -> None: super().__init__(path) self._toml_file = TOMLFile(path=path) @@ -32,7 +35,7 @@ def file(self) -> TOMLFile: # type: ignore[override] @property def data(self) -> TOMLDocument: if self._toml_document is None: - if not self._file.exists(): + if not self.file.exists(): self._toml_document = TOMLDocument() else: self._toml_document = self.file.read()