Returns a collection passages
346384
def of(cls, *passages: BioCPassage):
        
        if len(passages) <= 0:
            raise ValueError("There has to be at least one passage.")
        c = BioCDocument()
        for passage in passages:
            if passage is None:
                raise ValueError('Passage is None')
            c.add_passage(passage)
        return c
781802
def index():
    """"""
    collection_names = request.values.getlist('collection')

    # Validation of collection names.
    collections = Collection.query
    if collection_names:
        collections = collections.filter(
            Collection.name.in_(collection_names))
    assert len(collection_names) == collections.count()

    response = search.client.search(
        body={
            'query': {
                'filtered': {
                    'filter': {
                        'terms': {
                            '_collections': collection_names
                        }
                    }
                }
            }
        }
    )
    return jsonify(**response)
1269106
def get_items(self, sequence_id, gt=None, gte=None, lt=None, lte=None, limit=None,
                  query_ascending=True, results_ascending=True):
        
        records = self.get_records(
            sequence_id=sequence_id,
            gt=gt,
            gte=gte,
            lt=lt,
            lte=lte,
            limit=limit,
            query_ascending=query_ascending,
            results_ascending=results_ascending,

        )
        for item in map(self.from_record, records):
            yield item
38042
def _get_documents(self):
        """"""
        documents = self.tree.execute("$.documents")
        for doc in documents:
            sentences = {s['@id']: s['text'] for s in doc.get('sentences', [])}
            self.document_dict[doc['@id']] = {'sentences': sentences,
                                              'location': doc['location']}
1203635
def get_collection(cls):
        """"""

        # By default the collection returned will be the published collection,
        # however if the `draft` flag has been set against the global context
        # (e.g `g`) then the collection returned will contain draft documents.

        if g.get('draft'):
            return getattr(
                cls.get_db(),
                '{collection}_draft'.format(collection=cls._collection)
                )

        return getattr(cls.get_db(), cls._collection)
400397
def all(self):
        
        return self._client.get(
            url=self._client.get_full_url(
                self.get_path('collection', realm=self._realm_name)
            )
        )
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]
24987
function getAll(url, collection) {
    // Initialise array
    collection = typeof collection === 'undefined' ? [] : collection;

    return makeRequest(url).then(function (data) {
      // Add each item to array
      var length = data.results.length;
      for (var i = 0; i < length; ++i) {
        collection.push(data.results[i]);
      }

      if (data.next === null) {
        // Return on final page
        return collection;
      } else {
        return getAll(data.next, collection);
      }
    }).catch(function (err) {
      throw err;
    });
  }
1347230
def get(self):
        
        values = [e.get() for e in self._entries]
        if len(self._entries) == 1:
            return values[0]
        else:
            return values
29970
def collection(self):
        """"""
        if not self.include_collections:
            return None
        ctx = stack.top
        if ctx is not None:
            if not hasattr(ctx, 'redislite_collection'):
                ctx.redislite_collection = Collection(redis=self.connection)
            return ctx.redislite_collection
285860
def get_docs(self, vocab):
        """"""
        for string in self.strings:
            vocab[string]
        orth_col = self.attrs.index(ORTH)
        for tokens, spaces in zip(self.tokens, self.spaces):
            words = [vocab.strings[orth] for orth in tokens[:, orth_col]]
            doc = Doc(vocab, words=words, spaces=spaces)
            doc = doc.from_array(self.attrs, tokens)
            yield doc
1144836
def api_get_collection(path, collection, *args)
      Enumerator.new do |enum|
        args[0] = {} unless args[0]
        page_size = (args[0].delete(:page_size) { 100 }).to_i
        page_number = (args[0].delete(:page_number) { 1 }).to_i

        loop do
          uri = URI::HTTP.build(path: "/#{path}", query: URI.encode_www_form(pageSize: page_size, pageNumber: page_number)).request_uri

          res = api_get(uri, *args)
          raise TableauError, res if res.code.to_s != '200'

          # ensure the result is an array because it will not be an array if there is only one element
          [collection.split('.').reduce(res['tsResponse']) { |acc, elem| acc && acc[elem] }].flatten.compact.each do |obj|
            enum.yield obj
          end

          break if res['tsResponse']['pagination'].nil?
          break if page_number >= (res['tsResponse']['pagination']['totalAvailable'].to_i / page_size.to_f).ceil

          page_number += 1
        end
      end
    end
522536
def _pass_list(self) -> List[Dict[str, Any]]:
        """"""
        stops: List[Dict[str, Any]] = []
        for stop in self.journey.PassList.BasicStop:
            index = stop.get("index")
            station = stop.Location.Station.HafasName.Text.text
            station_id = stop.Location.Station.ExternalId.text
            stops.append({"index": index, "stationId": station_id, "station": station})
        return stops
950653
function(name) {
                var node, self = this,
                    collection = [];
                for (node = self.firstChild; node; node = walk(node, self)) {
                    node.name === name && collection.push(node);
                }
                return collection;
            }
657696
function getCollectionsCompact(forEntity, includeNew) {
  let associations = forEntity.getMeta().fetch('associations');
  let collections  = {};

  Object.getOwnPropertyNames(associations).forEach(index => {
    let association = associations[index];

    if (association.type !== 'collection') {
      return;
    }

    collections[index] = [];
    if (!Array.isArray(forEntity[index])) {
      return;
    }

    forEntity[index].forEach(entity => {
      if (typeof entity === 'number') {
        collections[index].push(entity);

        return;
      }

      if (!(entity instanceof Entity)) {
        return;
      }

      if (entity.getId()) {
        collections[index].push(entity.getId());

        return;
      }

      if (includeNew) {
        collections[index].push(entity);

        return;
      }
    });
  });

  return collections;
}
607392
def section(self, section, skip=['type', 'order']):
        
        return [(key, val) for key, val in self.parser.items(section)
                if key not in skip]
1332572
private function getBlacklistPasswords(): Generator
    {
        $fh = fopen($this->file, 'rb');

        while (($password = fgets($fh)) !== false) {
            yield trim($password);
        }

        fclose($fh);
    }