@FeatureNew('structured_sources', '0.62.0')
@typed_pos_args('structured_sources', object, optargs=[dict])
@noKwargs
@noArgsFlattening
def func_structured_sources(self, node: mparser.BaseNode, args: T.Tuple[(object, T.Optional[T.Dict[(str, object)]])], kwargs: 'TYPE_kwargs') -> build.StructuredSources:
    valid_types = (str, mesonlib.File, build.GeneratedList, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)
    sources: T.Dict[(str, T.List[T.Union[(mesonlib.File, 'build.GeneratedTypes')]])] = collections.defaultdict(list)
    for arg in mesonlib.listify(args[0]):
        if (not isinstance(arg, valid_types)):
            raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
        if isinstance(arg, str):
            arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
        sources[''].append(arg)
    if args[1]:
        if ('' in args[1]):
            raise InvalidArguments('structured_sources: keys to dictionary argument may not be an empty string.')
        for (k, v) in args[1].items():
            for arg in mesonlib.listify(v):
                if (not isinstance(arg, valid_types)):
                    raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
                if isinstance(arg, str):
                    arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
                sources[k].append(arg)
    return build.StructuredSources(sources)
@FeatureNew('structured_sources', '0.62.0')
@typed_pos_args('structured_sources', object, optargs=[dict])
@noKwargs
@noArgsFlattening
def func_structured_sources(self, node: mparser.BaseNode, args: T.Tuple[(object, T.Optional[T.Dict[(str, object)]])], kwargs: 'TYPE_kwargs') -> build.StructuredSources:
    valid_types = (str, mesonlib.File, build.GeneratedList, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)
    sources: T.Dict[(str, T.List[T.Union[(mesonlib.File, 'build.GeneratedTypes')]])] = collections.defaultdict(list)
    for arg in mesonlib.listify(args[0]):
        if (not isinstance(arg, valid_types)):
            raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
        if isinstance(arg, str):
            arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
        sources[].append(arg)
    if args[1]:
        if ( in args[1]):
            raise InvalidArguments('structured_sources: keys to dictionary argument may not be an empty string.')
        for (k, v) in args[1].items():
            for arg in mesonlib.listify(v):
                if (not isinstance(arg, valid_types)):
                    raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
                if isinstance(arg, str):
                    arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
                sources[k].append(arg)
    return build.StructuredSources(sources)