project/repr
This commit is contained in:
parent
63c179a0a4
commit
f8567686fd
1 changed files with 8 additions and 2 deletions
|
@ -6,15 +6,21 @@ from pathlib import Path
|
||||||
class Project:
|
class Project:
|
||||||
"""Parent class for any type of 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."""
|
"""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.root: Path = self.file.parent
|
||||||
self.name: str = self.root.name
|
self.name: str = self.root.name
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
"""Represent project."""
|
||||||
|
return f"Project(file={self.raw!r})"
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
"""Return file, root & name."""
|
"""Return file, root & name."""
|
||||||
return f"""\
|
return f"""\
|
||||||
|
raw = {self.raw}
|
||||||
file = {self.file}
|
file = {self.file}
|
||||||
root = {self.root}
|
root = {self.root}
|
||||||
name = {self.name}
|
name = {self.name}
|
||||||
|
|
Loading…
Reference in a new issue