Skip to content

Commit

Permalink
PyProjectTOML.toml_file -> PyProjectTOML.file
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Apr 2, 2023
1 parent aa235b8 commit 08b1fce
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/poetry/console/commands/self/self_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def generate_system_pyproject(self) -> None:
content["tool"]["poetry"][key] = preserved[key] # type: ignore[index]

pyproject = PyProjectTOML(self.system_pyproject)
pyproject.toml_file.write(content)
pyproject.file.write(content)

def reset_poetry(self) -> None:
with directory(self.system_pyproject.parent):
Expand Down
5 changes: 2 additions & 3 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,8 @@ def _prepare_git_archive(self, operation: Install | Update) -> Path:
def _install_directory_without_wheel_installer(
self, operation: Install | Update
) -> int:
from poetry.core.pyproject.toml import PyProjectTOML

from poetry.factory import Factory
from poetry.pyproject.toml import PyProjectTOML

package = operation.package
operation_message = self.get_operation_message(operation)
Expand All @@ -663,7 +662,7 @@ def _install_directory_without_wheel_installer(
package_poetry = None
if pyproject.is_poetry_project():
with contextlib.suppress(RuntimeError):
package_poetry = Factory().create_poetry(pyproject.file.parent)
package_poetry = Factory().create_poetry(pyproject.file.path.parent)

if package_poetry is not None:
# Even if there is a build system specified
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/installation/pip_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from typing import Any

from poetry.core.constraints.version import Version
from poetry.core.pyproject.toml import PyProjectTOML

from poetry.installation.base_installer import BaseInstaller
from poetry.pyproject.toml import PyProjectTOML
from poetry.repositories.http_repository import HTTPRepository
from poetry.utils._compat import encode
from poetry.utils.helpers import remove_directory
Expand Down Expand Up @@ -226,7 +226,7 @@ def install_directory(self, package: Package) -> str | int:
package_poetry = None
if pyproject.is_poetry_project():
with contextlib.suppress(RuntimeError):
package_poetry = Factory().create_poetry(pyproject.file.parent)
package_poetry = Factory().create_poetry(pyproject.file.path.parent)

if package_poetry is not None:
# Even if there is a build system specified
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def pyproject(self) -> PyProjectTOML:

@property
def file(self) -> TOMLFile: # type: ignore[override]
return self.pyproject.toml_file
return self.pyproject.file

@property
def locker(self) -> Locker:
Expand Down
6 changes: 3 additions & 3 deletions src/poetry/pyproject/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, path: Path) -> None:
self._toml_document: TOMLDocument | None = None

@property
def toml_file(self) -> TOMLFile:
def file(self) -> TOMLFile: # type: ignore[override]
return self._toml_file

@property
Expand All @@ -35,7 +35,7 @@ def data(self) -> TOMLDocument:
if not self._file.exists():
self._toml_document = TOMLDocument()
else:
self._toml_document = self.toml_file.read()
self._toml_document = self.file.read()

return self._toml_document

Expand All @@ -52,7 +52,7 @@ def save(self) -> None:
build_system["requires"] = self._build_system.requires
build_system["build-backend"] = self._build_system.build_backend

self.toml_file.write(data=data)
self.file.write(data=data)

def reload(self) -> None:
self._toml_document = None
Expand Down

0 comments on commit 08b1fce

Please sign in to comment.