get collection named `name` from the given `source` that
    formatted accordingly to `collection_format`.
198115
def get_collection(source, name, collection_format, default):
    
    if collection_format in COLLECTION_SEP:
        separator = COLLECTION_SEP[collection_format]
        value = source.get(name, None)
        if value is None:
            return default
        return value.split(separator)
    if collection_format == 'brackets':
        return source.getall(name + '[]', default)
    else:                       # format: multi
        return source.getall(name, default)
989983
def _slugify_internal_collection_name(self, json_repr):
        """"""
        collection = self._coerce_json_to_collection(json_repr)
        if collection is None:
            return None
        internal_name = collection['name']
        return slugify(internal_name)
311768
def fetch_by_relname(self, name):
        

        ormclass = self._mapped[name]
        query = self.session.query(ormclass)

        if name != carr_ormclass:

            query = query.filter(
                ormclass.scn_name == self.scn_name)

        if self.version:
            query = query.filter(ormclass.version == self.version)

        # TODO: Naming is not consistent. Change in database required.
        if name == 'Transformer':
            name = 'Trafo'

        df = pd.read_sql(query.statement,
                         self.session.bind,
                         index_col=name.lower() + '_id')
        if name == 'Link':
            df['bus0'] = df.bus0.astype(int)
            df['bus1'] = df.bus1.astype(int)

        if 'source' in df:
            df.source = df.source.map(self.id_to_source())

        return df
438785
def get_collection(self, namespace):
        """"""
        database, coll = namespace.split(".", 1)
        return self.primary_client[database][coll]
1330977
def get_tok(self, source):
        
        if isinstance(source, str):
            return source

        if isinstance(source, CatalogEntry):
            return source._metadata.get('original_tok', source._tok)

        if isinstance(source, DataSource):
            return source.metadata.get('original_tok', source._tok)
        raise IndexError
969850
def read_collection(self, filename):
        
        with open(filename, 'rb') as fd:
            lines = fd.read().decode('utf-8-sig').splitlines()
        collection = list(filter(bool, [line.strip() for line in lines]))
        return collection
861671
def get_from_sources(self, index, doc_type, document_id):
        """"""
        return self.sources.get(index, {}).get(doc_type, {}).get(document_id, {})
531535
def from_name(cls, name):
        """"""
        result = cls.list({'items_per_page': 500})
        webaccs = {}
        for webacc in result:
            webaccs[webacc['name']] = webacc['id']
        return webaccs.get(name)
789968
def collection
      return Collection.find(source_id) if Collection.exists?(source_id)
      raise ActiveFedora::ObjectNotFoundError
    rescue ActiveFedora::ActiveFedoraError # TODO: remove the rescue when active_fedora issue #1276 is fixed
      raise ActiveFedora::ObjectNotFoundError
    end
246267
public Collection<Object> getAll(String name) {
    Object value = get(name);
    if (value == null) {
      return Collections.emptySet();
    }
    if (value instanceof Collection<?>) {
      @SuppressWarnings("unchecked")
      Collection<Object> collectionValue = (Collection<Object>) value;
      return Collections.unmodifiableCollection(collectionValue);
    }
    return Collections.singleton(value);
  }
1059737
def _get_name_from_url(self, request):
        

        format = request.GET.get('format', None)
        if not format:
            match = self._format_query_pattern.match(request.path)
            if match and match.group('format'):
                format = match.group('format')
        return format
621744
def get_collections(self, pattern="*", libtype="*"):
        """"""

        sql = """SELECT collection.collection_id, collection.name, collection.doc,
                        collection.type, collection.path
                 FROM collection_table as collection
                 WHERE name like ?
                 AND type like ?
                 ORDER BY collection.name
              """

        cursor = self._execute(sql, (self._glob_to_sql(pattern),
                                     self._glob_to_sql(libtype)))
        sql_result = cursor.fetchall()

        return [{"collection_id": result[0],
                 "name": result[1],
                 "synopsis": result[2].split("\n")[0],
                 "type": result[3],
                 "path": result[4]
             } for result in sql_result]
57391
def find_by_name(name):
    
    for format in FORMATS:
        if name == format.name:
            return format

    raise UnknownFormat('No format found with name "%s"' % name)
301233
def getDatasetByName(self, name):
        
        if name not in self._datasetNameMap:
            raise exceptions.DatasetNameNotFoundException(name)
        return self._datasetNameMap[name]
639864
def get_by_name(self, name):
        
        try:
            spec = self._dom.get('templates', {})[name]
        except KeyError:
            raise LagoMissingTemplateError(name, self._path)

        return Template(
            name=name,
            versions={
                ver_name: TemplateVersion(
                    name='%s:%s:%s' % (self.name, name, ver_name),
                    source=self._providers[ver_spec['source']],
                    handle=ver_spec['handle'],
                    timestamp=ver_spec['timestamp'],
                )
                for ver_name, ver_spec in spec['versions'].items()
            },
        )
681182
def cache_from_names(self):
        """"""
        cache_from = self.cache_from()

        if not cache_from or cache_from is NotSpecified:
            return

        if cache_from is True:
            yield self.image_name
            return

        for thing in cache_from:
            if not isinstance(thing, six.string_types):
                yield thing.image_name
            else:
                yield thing
843295
def get_formatter(name):
    
    for k in sorted(_FORMATTERS):
        if k.startswith(name):
            return _FORMATTERS[k]