Skip to content

Commit 4c81e63

Browse files
committed
check if person if None on the base class
1 parent 993b714 commit 4c81e63

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

src/somesy/core/writer.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,15 @@ def description(self, description: str) -> None:
331331
@property
332332
def authors(self):
333333
"""Return the authors of the project."""
334-
return self._get_property(self._get_key("authors"))
334+
authors = self._get_property(self._get_key("authors"))
335+
if authors is None:
336+
return []
337+
338+
# only return authors that can be converted to Person
339+
authors_validated = [
340+
author for author in authors if self._to_person(author) is not None
341+
]
342+
return authors_validated
335343

336344
@authors.setter
337345
def authors(self, authors: List[Person]) -> None:
@@ -342,7 +350,17 @@ def authors(self, authors: List[Person]) -> None:
342350
@property
343351
def maintainers(self):
344352
"""Return the maintainers of the project."""
345-
return self._get_property(self._get_key("maintainers"))
353+
maintainers = self._get_property(self._get_key("maintainers"))
354+
if maintainers is None:
355+
return []
356+
357+
# only return maintainers that can be converted to Person
358+
maintainers_validated = [
359+
maintainer
360+
for maintainer in maintainers
361+
if self._to_person(maintainer) is not None
362+
]
363+
return maintainers_validated
346364

347365
@maintainers.setter
348366
def maintainers(self, maintainers: List[Person]) -> None:

0 commit comments

Comments
 (0)