From f8567686fd196d36ef6dd6c2be6304bbef8b328c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 01:59:00 +0200 Subject: [PATCH] project/repr --- rwx/prj/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rwx/prj/__init__.py b/rwx/prj/__init__.py index 04f1cd9..f4a8acb 100644 --- a/rwx/prj/__init__.py +++ b/rwx/prj/__init__.py @@ -6,15 +6,21 @@ from pathlib import Path class Project: """Parent class for any type of project.""" - def __init__(self, file_path: str) -> None: + def __init__(self, file: Path) -> None: """Set file, root & name.""" - self.file: Path = Path(file_path).resolve() + self.raw = file + self.file = self.raw.resolve() self.root: Path = self.file.parent self.name: str = self.root.name + def __repr__(self) -> str: + """Represent project.""" + return f"Project(file={self.raw!r})" + def __str__(self) -> str: """Return file, root & name.""" return f"""\ + raw = {self.raw} file = {self.file} root = {self.root} name = {self.name}