@@ -97,7 +97,9 @@ class ManifestDict(TypedDict, total=True): # pylint: disable=too-many-ancestors
9797
9898 version : Union [int , str ]
9999 remotes : NotRequired [Sequence [Union [RemoteDict , Remote ]]]
100- projects : Sequence [Union [ProjectEntryDict , ProjectEntry , dict [str , str ]]]
100+ projects : Sequence [
101+ Union [ProjectEntryDict , ProjectEntry , dict [str , Union [str , list [str ]]]]
102+ ]
101103
102104
103105class Manifest :
@@ -138,12 +140,17 @@ def __init__(
138140 self ._projects = self ._init_projects (manifest ["projects" ])
139141
140142 def _init_projects (
141- self , projects : Sequence [Union [ProjectEntryDict , ProjectEntry , dict [str , str ]]]
143+ self ,
144+ projects : Sequence [
145+ Union [ProjectEntryDict , ProjectEntry , dict [str , Union [str , list [str ]]]]
146+ ],
142147 ) -> dict [str , ProjectEntry ]:
143148 """Iterate over projects from manifest and initialize ProjectEntries from it.
144149
145150 Args:
146- projects (Sequence[Union[ProjectEntryDict, ProjectEntry, Dict[str, str]]]): Iterable with projects
151+ projects (Sequence[
152+ Union[ProjectEntryDict, ProjectEntry, Dict[str, Union[str, list[str]]]]
153+ ]): Iterable with projects
147154
148155 Raises:
149156 RuntimeError: Project unknown
@@ -157,6 +164,10 @@ def _init_projects(
157164 if isinstance (project , dict ):
158165 if "name" not in project :
159166 raise KeyError ("Missing name!" )
167+ if not isinstance (project ["name" ], str ):
168+ raise TypeError (
169+ f"Project name must be a string, got { type (project ['name' ]).__name__ } "
170+ )
160171 last_project = _projects [project ["name" ]] = ProjectEntry .from_yaml (
161172 project , self ._default_remote_name
162173 )
@@ -295,9 +306,9 @@ def _as_dict(self) -> dict[str, ManifestDict]:
295306 if len (remotes ) == 1 :
296307 remotes [0 ].pop ("default" , None )
297308
298- projects : list [dict [str , str ]] = []
309+ projects : list [dict [str , Union [ str , list [ str ]] ]] = []
299310 for project in self .projects :
300- project_yaml : dict [str , str ] = project .as_yaml ()
311+ project_yaml : dict [str , Union [ str , list [ str ]] ] = project .as_yaml ()
301312 if len (remotes ) == 1 :
302313 project_yaml .pop ("remote" , None )
303314 projects .append (project_yaml )
0 commit comments