Get sources, targets and delayed objects to separate lists from a
    list of results collected from (multiple) writer(s).
559130
def split_results(results):
    """"""
    from dask.delayed import Delayed

    def flatten(results):
        out = []
        if isinstance(results, (list, tuple)):
            for itm in results:
                out.extend(flatten(itm))
            return out
        return [results]

    sources = []
    targets = []
    delayeds = []

    for res in flatten(results):
        if isinstance(res, da.Array):
            sources.append(res)
        elif isinstance(res, Delayed):
            delayeds.append(res)
        else:
            targets.append(res)
    return sources, targets, delayeds
309468
@Override
  public List<List<O>> finish(Collection<? extends OutputWriter<O>> writers) {
    ImmutableList.Builder<List<O>> out = ImmutableList.builder();
    for (OutputWriter<O> w : writers) {
      InMemoryOutputWriter<O> writer = (InMemoryOutputWriter<O>) w;
      out.add(ImmutableList.copyOf(writer.getResult()));
    }
    return out.build();
  }
547138
def source(self):
        
        if len(self.sources) == 0:
            raise ValueError("No source associated with %s" % self.__class__.__name__)
        elif len(self.sources) > 1:
            raise ValueError("Multiple sources for %s" % self.__class__.__name__)
        return list(self.sources)[0]
337216
def retrieve_list(self, parsed_args):
        """"""
        neutron_client = self.get_client()
        _extra_values = parse_args_to_dict(self.values_specs)
        _merge_args(self, parsed_args, _extra_values,
                    self.values_specs)
        search_opts = self.args2search_opts(parsed_args)
        search_opts.update(_extra_values)
        if self.pagination_support:
            page_size = parsed_args.page_size
            if page_size:
                search_opts.update({'limit': page_size})
        if self.sorting_support:
            keys = parsed_args.sort_key
            if keys:
                search_opts.update({'sort_key': keys})
            dirs = parsed_args.sort_dir
            len_diff = len(keys) - len(dirs)
            if len_diff > 0:
                dirs += ['asc'] * len_diff
            elif len_diff < 0:
                dirs = dirs[:len(keys)]
            if dirs:
                search_opts.update({'sort_dir': dirs})
        data = self.call_server(neutron_client, search_opts, parsed_args)
        collection = _get_resource_plural(self.resource, neutron_client)
        return data.get(collection, [])
667464
def reflect_filter(sources, model, cache=None):
    '''
    '''
    targets = [reflect(source, model, cache=cache) for source in sources]
    # Some objects may not be available in target DB (not published), so we
    # have to exclude None from the list.
    return [target for target in targets if target is not None]
39672
private static Collection<Writer> getAllWriters(final Collection<Writer>[][] matrix) {
		Collection<Writer> writers = Collections.newSetFromMap(new IdentityHashMap<Writer, Boolean>());
		for (int i = 0; i < matrix.length; ++i) {
			for (int j = 0; j < matrix[i].length; ++j) {
				writers.addAll(matrix[i][j]);
			}
		}
		return writers;
	}
600336
def partial_results(self):
        '''
        '''
        results = []
        for r in self._results:
            if isinstance(r, Exception):
                results.append(type(r)(*deepcopy(r.args)))
            elif hasattr(r, "__iter__") and not hasattr(r, "__len__"):
                # pass generators straight through
                results.append(r)
            else:
                results.append(deepcopy(r))
        return results
171856
def get_for_targets(self, targets):
    
    products = OrderedSet()
    for target in targets:
      products.update(self._products_by_target[target])
    return products
161832
def _fetch_all(self):
        
        if self._result_cache is None:
            self._result_cache = list(self.iterator())
            # TODO: Do we have to test for ValuesListIterable, ValuesIterable,
            # and FlatValuesListIterable here?
            if self._iterable_class == ModelIterable:
                for x in self._result_cache:
                    self._set_item_querytime(x)
        if self._prefetch_related_lookups and not self._prefetch_done:
            self._prefetch_related_objects()
1267622
def getSourcePaths(self, makeGlyphs=True, makeKerning=True, makeInfo=True):
        
        paths = []
        for name in self.sources.keys():
            paths.append(self.sources[name][0].path)
        return paths
1209468
def get_source_files(target, build_context) -> list:
    """"""
    all_sources = list(target.props.sources)
    for proto_dep_name in target.props.protos:
        proto_dep = build_context.targets[proto_dep_name]
        all_sources.extend(proto_dep.artifacts.get(AT.gen_cc).keys())
    return all_sources
666672
private List<List<ConceptId>> getComputePathResultList(Multimap<ConceptId, ConceptId> resultGraph, ConceptId fromID) {
        List<List<ConceptId>> allPaths = new ArrayList<>();
        List<ConceptId> firstPath = new ArrayList<>();
        firstPath.add(fromID);

        Deque<List<ConceptId>> queue = new ArrayDeque<>();
        queue.addLast(firstPath);
        while (!queue.isEmpty()) {
            List<ConceptId> currentPath = queue.pollFirst();
            if (resultGraph.containsKey(currentPath.get(currentPath.size() - 1))) {
                Collection<ConceptId> successors = resultGraph.get(currentPath.get(currentPath.size() - 1));
                Iterator<ConceptId> iterator = successors.iterator();
                for (int i = 0; i < successors.size() - 1; i++) {
                    List<ConceptId> extendedPath = new ArrayList<>(currentPath);
                    extendedPath.add(iterator.next());
                    queue.addLast(extendedPath);
                }
                currentPath.add(iterator.next());
                queue.addLast(currentPath);
            } else {
                allPaths.add(currentPath);
            }
        }
        return allPaths;
    }
470225
@SuppressWarnings("unchecked")
	public <P extends ParaObject> List<P> getItemsFromList(List<?> result) {
		if (result != null && !result.isEmpty()) {
			// this isn't very efficient but there's no way to know what type of objects we're reading
			ArrayList<P> objects = new ArrayList<>(result.size());
			for (Object map : result) {
				P p = ParaObjectUtils.setAnnotatedFields((Map<String, Object>) map);
				if (p != null) {
					objects.add(p);
				}
			}
			return objects;
		}
		return Collections.emptyList();
	}
747086
def _list_getter(self, uri, headers, last_obj=None, spr=False):
        

        # Quote the file path.
        base_path = marked_path = ('%s?limit=10000&format=json' % uri.path)

        if last_obj:
            marked_path = self._last_marker(
                base_path=base_path,
                last_object=cloud_utils.quoter(last_obj)
            )

        file_list = self._obj_index(
            uri=uri,
            base_path=base_path,
            marked_path=marked_path,
            headers=headers,
            spr=spr
        )

        LOG.debug(
            'Found [ %d ] entries(s) at [ %s ]',
            len(file_list),
            uri.geturl()
        )

        if spr:
            return file_list
        else:
            return cloud_utils.unique_list_dicts(
                dlist=file_list, key='name'
            )
1077750
async def chain(*sources):
    
    for source in sources:
        async with streamcontext(source) as streamer:
            async for item in streamer:
                yield item
1074332
def link_sources(self):
        ""
        if isinstance(self, GenericOverlayPlot):
            zorders = []
        elif self.batched:
            zorders = list(range(self.zorder, self.zorder+len(self.hmap.last)))
        else:
            zorders = [self.zorder]

        if isinstance(self, GenericOverlayPlot) and not self.batched:
            sources = []
        elif not self.static or isinstance(self.hmap, DynamicMap):
            sources = [o for i, inputs in self.stream_sources.items()
                       for o in inputs if i in zorders]
        else:
            sources = [self.hmap.last]
        return sources
913854
private static Iterator<String> getPidIterator(ValidatorProcessParameters parms,
                                                   RemoteObjectSource objectSource)
            throws ObjectSourceException {
        if (parms.getIteratorType() == IteratorType.FS_QUERY) {
            return objectSource.findObjectPids(parms.getQuery());
        } else {
            return new PidfileIterator(parms.getPidfile());
        }
    }