Skip to content

Commit 3909e91

Browse files
committed
make init new file abstract method
1 parent 3c17cff commit 3909e91

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/somesy/core/writer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ def __init__(
4545
else:
4646
if self.create_if_not_exists:
4747
self._init_new_file()
48+
self._load()
4849
else:
4950
raise FileNotFoundError(f"The file {self.path} does not exist.")
5051

52+
@abstractmethod
5153
def _init_new_file(self) -> None:
5254
"""Create an new suitable target file.
5355
@@ -228,6 +230,8 @@ def _to_person(person_obj: Any) -> Person:
228230
@classmethod
229231
def _parse_people(cls, people: Optional[List[Any]]) -> List[Person]:
230232
"""Return a list of Persons parsed from list of format-specific people representations."""
233+
if not people:
234+
return []
231235
return list(map(cls._to_person, people or []))
232236

233237
# ----

0 commit comments

Comments
 (0)