Skip to content

Commit

Permalink
add missing __init__.py, cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Apr 3, 2023
1 parent e1ec6ae commit 68eaa17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Empty file.
15 changes: 9 additions & 6 deletions src/poetry/pyproject/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 68eaa17

Please sign in to comment.