Retrive first element in List.
974161
def head(self) -> Any:
        """"""

        lambda_list = self._get_value()
        return lambda_list(lambda head, _: head)
964285
def first(self):
        """"""
        self.open()
        seq = SeqIO.parse(self.handle, self.format).next()
        self.close()
        return seq
692487
def getFirstLevel(self) :
		""""""
		res = []
		if len(self.children) > 0 :
			for c in self.children:
				res.append((c.x1, c.x2)) 
		else :
			if self.x1 != None :
				res = [(self.x1, self.x2)]
			else :
				res = None
		return res
1006869
private static <T> T firstOf(final List<T> list) {
        return list.isEmpty()? null: list.get(0);
    }
1218023
def source(self, source):
        """"""
        if isinstance(source, list):
            # if source is a list, get first item or None
            source = source[0] if len(source) > 0 else None
        self._source = source
818616
def get_next_item(iterable):
    """"""
    try: x = iterable.next()
    except StopIteration: x = None
    except AttributeError: x = None
    return x
579000
def firsts(iterable, items=1, default=None):
    # type: (Iterable[T], int, T) -> Iterable[T]
    

    try:
        items = int(items)
    except (ValueError, TypeError):
        raise ValueError("items should be usable as an int but is currently "
                         "'{}' of type '{}'".format(items, type(items)))

    # TODO: replace this so that it returns lasts()
    if items < 0:
        raise ValueError(ww.f("items is {items} but should "
                              "be greater than 0. If you wish to get the last "
                              "items, use the lasts() function."))

    i = 0
    for i, item in zip(range(items), iterable):
        yield item

    for x in range(items - (i + 1)):
        yield default
500035
def first(self):
        
        if self.mode == 'local':
            return self.values[0]

        if self.mode == 'spark':
            return self.values.first().toarray()
719197
def first(self):
        

        if self.total and self.limit < self.total:
            return {'page[offset]': 0, 'page[limit]': self.limit}
        else:
            return None
306525
protected Elements getFirst(Elements elems) {
        @SuppressWarnings("unchecked")
        IterableElements<Elements> iterableElems = elems.as(IterableElements.class);
        return Iterables.getFirst(iterableElems, null);
    }
859495
def first(self, skipna=None, keep_attrs=None):
        
        return self._first_or_last(duck_array_ops.first, skipna, keep_attrs)
989795
def get_first(self, table=None):
        """"""
        if table is None: table = self.main_table
        query = 'SELECT * FROM "%s" LIMIT 1;' % table
        return self.own_cursor.execute(query).fetchone()
156368
def getlist(self, key):
        """"""
        try:
            vals = _dict_getitem(self, key.lower())
        except KeyError:
            return []
        else:
            if isinstance(vals, tuple):
                return [vals[1]]
            else:
                return vals[1:]
51001
def first(self):
        

        if not self._stream:
            raise InvalidUsage('first() is only available when stream=True')

        try:
            content = next(self.all())
        except StopIteration:
            raise NoResults("No records found")

        return content
311777
def first(self, rows: List[Row]) -> List[Row]:
        
        if not rows:
            logger.warning("Trying to get first row from an empty list")
            return []
        return [rows[0]]
1091477
def first_(self):
        
        try:
            val = self.df.iloc[0]
            return val
        except Exception as e:
            self.err(e, "Can not select first row")
680916
def first(self):
        
        self.params['limit'] = 1
        result = self.all()
        return result.items[0] if result.total > 0 else None