Return the first element.
432663
def first(self):
        
        if self.mode == 'spark':
            return self.values.tordd().values().first()

        if self.mode == 'local':
            return self.values.first
776358
def element(self, inp=None):
        """"""
        if inp is not None:
            s = str(inp)[:self.length]
            s += ' ' * (self.length - len(s))
            return s
        else:
            return ' ' * self.length
1372287
def element(self):
        """"""
        #We assume here that the entire operation is associated with a single
        #code element. Since the sequence matcher groups operations by contiguous
        #lines of code to change, this is a safe assumption.
        if self._element is None:
            line = self.icached[0]
            #If we are inserting a new line, the location at the start of the line
            #that used to be there interferes with the element finder.
            if self.mode == "insert":
                line -= 1
            self._element = self.context.module.get_element(line, 0)

        return self._element
271269
def get_term(self, term, value=False):
        """"""
        return self.doc.find_first(term, value=value, section=self.name)
815838
def first_element
      check_section!('first_element')
      range = dom_nodes
      nodes = `range.startContainer.childNodes`

      start_index = `range.startOffset`
      end_index = `range.endOffset`

      start_index.upto(end_index) do |index|
        node = `nodes[index]`

        # Return if an element
        if `node.nodeType === 1`
          return node
        end
      end

      return nil
    end
1001217
def get_first_of_element(element, sub, contype=None):
    
    content = element.xpath(sub)
    return list_or_empty(content, contype)
600090
def select_first(root)
      stack = [root]
      while node = stack.pop
        if node.tag? && subset = match(node, true)
          return subset.first if !subset.empty?
        elsif children = node.children
          stack.concat children.reverse
        end
      end
      nil
    end
669386
def popfirst(self):
        """"""

        with self.lock:

            try:
                tup = self.data.popleft()
            except IndexError as ex:
                ex.args = ('DEPQ is already empty',)
                raise

            self_items = self.items

            try:
                self_items[tup[0]] -= 1
                if self_items[tup[0]] == 0:
                    del self_items[tup[0]]
            except TypeError:
                r = repr(tup[0])
                self_items[r] -= 1
                if self_items[r] == 0:
                    del self_items[r]

            return tup
585485
function getFirstChildElement(parent) {
  var cursor = parent.firstChild;

  while (cursor && cursor.nodeType !== 1) {
    cursor = cursor.nextSibling;
  }
  return cursor;
}
367970
public int first() {
    assertNonEmpty();
    short firstKey = keys[0];
    Container container = values[0];
    return firstKey << 16 | container.first();
  }
915995
def get_first(self):
		""""""
		try: # Nested try..except because of Python 2.4
			self.lock.acquire()
			try:
				return self.get(self.data_idx[0])
			except (IndexError, ValueError):
				return "NONE"
		finally:
			self.lock.release()
1063464
def first(self, **kwargs):
        
        result = yield self.get(**kwargs)

        if not result['rows']:
            raise exceptions.NotFound()

        raise Return(result['rows'][0])
1195769
def firstElementChild(self) -> Optional[AbstractNode]:
        
        for child in self.childNodes:
            if child.nodeType == Node.ELEMENT_NODE:
                return child
        return None
15103
def get_first_key_from_value(self, value):
        

        for key, data in self.iteritems():
            if data == value:
                return key
1282432
public Element<T> getElement( int index , boolean fromFront ) {
		if( index > size || index < 0 ) {
			throw new IllegalArgumentException("index is out of bounds");
		}
		if( fromFront ) {
			Element<T> e = first;
			for( int i = 0; i < index; i++ ) {
				e = e.next;
			}
			return e;
		} else {
			Element<T> e = last;
			for( int i = 0; i < index; i++ ) {
				e = e.previous;
			}
			return e;
		}
	}
1303117
def _first_and_last_element(arr):
    """"""
    if isinstance(arr, np.ndarray) or hasattr(arr, 'data'):
        # numpy array or sparse matrix with .data attribute
        data = arr.data if sparse.issparse(arr) else arr
        return data.flat[0], data.flat[-1]
    else:
        # Sparse matrices without .data attribute. Only dok_matrix at
        # the time of writing, in this case indexing is fast
        return arr[0, 0], arr[-1, -1]
1164482
def find_first(data, what):
    '''
    
    '''
    for i, line in enumerate(data):
        if contains(line, what):
            return i
            
    return None