Convenience function for accessing the first partition in the
        partitions list, when there is only one.
324933
def partition(self):
        """"""

        if not self.partitions:
            return None

        if len(self.partitions) > 1:
            raise ValueError(
                "Can't use this method when there is more than one partition")

        return list(self.partitions.values())[0]
535013
private Completable initFromBeginningToNow() {
    return initWithCallback(new Action1<PartitionAndSeqno>() {
      @Override
      public void call(PartitionAndSeqno partitionAndSeqno) {
        short partition = partitionAndSeqno.partition();
        long seqno = partitionAndSeqno.seqno();
        PartitionState partitionState = sessionState().get(partition);
        partitionState.setEndSeqno(seqno);
        sessionState().set(partition, partitionState);
      }
    });
  }
1006869
private static <T> T firstOf(final List<T> list) {
        return list.isEmpty()? null: list.get(0);
    }
964285
def first(self):
        """"""
        self.open()
        seq = SeqIO.parse(self.handle, self.format).next()
        self.close()
        return seq
331857
private int partitionItems(int left, int right, int pivot, double[] origin) {
		double pivotDistance = distance(origin, items[pivot]);
		listSwap(items, pivot, right - 1);
		listSwap(indexes, pivot, right - 1);
		int storeIndex = left;
		for (int i = left; i < right - 1; i++) {
			if (distance(origin, items[i]) <= pivotDistance) {
				listSwap(items, i, storeIndex);
				listSwap(indexes, i, storeIndex);
				storeIndex++;
			}
		}
		listSwap(items, storeIndex, right - 1);
		listSwap(indexes, storeIndex, right - 1);
		return storeIndex;
	}
751339
public static <T> T getFirstOrNull(List<T> list) {
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }
1006854
def first(self):
        
        if self.mode == 'local':
            return self.values[tuple(zeros(len(self.baseaxes))) + (slice(None, None),)]

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

        if self.mode == 'local':
            return self.values.first
702545
List<PartitionInstance> getAbsent() {
    List<PartitionInstance> absentPartitions = new ArrayList<>();
    for (Map.Entry<Integer, List<PartitionInstance>> e : nodeIndexToHostedPartitions.entrySet()) {
      if (e.getKey() < 0) {
        absentPartitions.addAll(e.getValue());
      }
    }
    return absentPartitions;
  }
854065
def find_segment_first(self, *args, **kwargs):
        """"""

        for m in self.find_segments(*args, **kwargs):
            return m

        return None
919686
def first(self):
        """"""
        with self.lock:
            try:
                return self.data[0][0]
            except IndexError as ex:
                ex.args = ('DEPQ is empty',)
                raise
1130900
def first(self, n=1):
        
        res = self.obj[0:n]
        if len(res) is 1:
            res = res[0]
        return self._wrap(res)
1077290
def build_input_partitions(cls, name='inputTablePartitions', input_name='input'):
        
        obj = cls(name)
        obj.exporter = 'get_input_partitions'
        obj.input_name = input_name
        return obj
503586
def _find_unused_partition() -> RootPartitions:
    
    which = subprocess.check_output(['ot-unused-partition']).strip()
    return {b'2': RootPartitions.TWO,
            b'3': RootPartitions.THREE}[which]
114701
private void findBestWithoutFirst(List<DatanodeDescriptor> listOfNodes,
      DatanodeDescriptor[] result) {

    readLock();
    try {
      for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
        DatanodeDescriptor n2 = listOfNodes.get(in2);

        for (int in3 = in2 + 1; in3 < listOfNodes.size(); in3++) {
          DatanodeDescriptor n3 = listOfNodes.get(in3);
          if (n2.getNetworkLocation().equals(n3.getNetworkLocation())) {
            RackRingInfo rackInfo = racksMap.get(n2.getNetworkLocation());
            assert (rackInfo != null);
            final int rackSize = rackInfo.rackNodes.size();
            final Integer idN2 = rackInfo.findNode(n2);
            final Integer idN3 = rackInfo.findNode(n3);

            if (idN2 != null && idN3 != null) {
              int dist = (idN3 - idN2 + rackSize) % rackSize;
              if (dist >= machineWindow) {
                dist = rackSize - dist; // try n2 - n3
              }

              if (dist < machineWindow) {
                result[0] = null;
                result[1] = n2;
                result[2] = n3;
                return;
              }
            }
          }
        }
      }
    } finally {
      readUnlock();
    }
  }
1220286
private void compactPartition(int partitionNumber) throws IOException {
		// stop if no garbage exists
		if(this.partitions.get(partitionNumber).isCompacted()) {
			return;
		}
		// release all segments owned by compaction partition
		this.compactionMemory.clearAllMemory(availableMemory);
		this.compactionMemory.allocateSegments(1);
		T tempHolder = this.buildSideSerializer.createInstance();
		InMemoryPartition<T> partition = this.partitions.remove(partitionNumber);
		final int numPartitions = this.partitions.size() + 1; // dropped one earlier
		long pointer = 0L;
		int pointerOffset = 0;
		int bucketOffset = 0;
		final int bucketsPerSegment = this.bucketsPerSegmentMask + 1;
		for (int i = 0, bucket = partitionNumber; i < this.buckets.length && bucket < this.numBuckets; i++) {
			MemorySegment segment = this.buckets[i];
			// go over all buckets in the segment belonging to the partition
			for (int k = bucket % bucketsPerSegment; k < bucketsPerSegment && bucket < this.numBuckets; k += numPartitions, bucket += numPartitions) {
				bucketOffset = k * HASH_BUCKET_SIZE;
				if((int)segment.get(bucketOffset + HEADER_PARTITION_OFFSET) != partitionNumber) {
					throw new IOException("Accessed wrong bucket! ");
				}
				int count = segment.getInt(bucketOffset + HEADER_COUNT_OFFSET);
				for (int j = 0; j < NUM_ENTRIES_PER_BUCKET && j < count; j++) {
					pointerOffset = bucketOffset + BUCKET_POINTER_START_OFFSET + (j * POINTER_LEN);
					pointer = segment.getLong(pointerOffset);
					partition.readRecordAt(pointer, tempHolder);
					pointer = this.compactionMemory.appendRecord(tempHolder);
					segment.putLong(pointerOffset, pointer);
				}
				long overflowPointer = segment.getLong(bucketOffset + HEADER_FORWARD_OFFSET);
				if(overflowPointer != BUCKET_FORWARD_POINTER_NOT_SET) {
					// scan overflow buckets
					int current = NUM_ENTRIES_PER_BUCKET;
					bucketOffset = (int) (overflowPointer & 0xffffffff);
					pointerOffset = ((int) (overflowPointer & 0xffffffff)) + BUCKET_POINTER_START_OFFSET;
					int overflowSegNum = (int) (overflowPointer >>> 32);
					count += partition.overflowSegments[overflowSegNum].getInt(bucketOffset + HEADER_COUNT_OFFSET);
					while(current < count) {
						pointer = partition.overflowSegments[overflowSegNum].getLong(pointerOffset);
						partition.readRecordAt(pointer, tempHolder);
						pointer = this.compactionMemory.appendRecord(tempHolder);
						partition.overflowSegments[overflowSegNum].putLong(pointerOffset, pointer);
						current++;
						if(current % NUM_ENTRIES_PER_BUCKET == 0) {
							count += partition.overflowSegments[overflowSegNum].getInt(bucketOffset + HEADER_COUNT_OFFSET);
							overflowPointer = partition.overflowSegments[overflowSegNum].getLong(bucketOffset + HEADER_FORWARD_OFFSET);
							if(overflowPointer == BUCKET_FORWARD_POINTER_NOT_SET) {
								break;
							}
							overflowSegNum = (int) (overflowPointer >>> 32);
							bucketOffset = (int) (overflowPointer & 0xffffffff);
							pointerOffset = ((int) (overflowPointer & 0xffffffff)) + BUCKET_POINTER_START_OFFSET;
						} else {
							pointerOffset += POINTER_LEN;
						}
					}
				}
			}
		}
		// swap partition with compaction partition
		this.compactionMemory.setPartitionNumber(partitionNumber);
		this.partitions.add(partitionNumber, compactionMemory);
		this.compactionMemory = partition;
		this.partitions.get(partitionNumber).overflowSegments = this.compactionMemory.overflowSegments;
		this.partitions.get(partitionNumber).numOverflowSegments = this.compactionMemory.numOverflowSegments;
		this.partitions.get(partitionNumber).nextOverflowBucket = this.compactionMemory.nextOverflowBucket;
		this.partitions.get(partitionNumber).setCompaction(true);
		this.compactionMemory.resetRecordCounter();
		this.compactionMemory.setPartitionNumber(-1);
		// try to allocate maximum segment count
		int maxSegmentNumber = 0;
		for (InMemoryPartition<T> e : this.partitions) {
			if(e.getBlockCount() > maxSegmentNumber) {
				maxSegmentNumber = e.getBlockCount();
			}
		}
		this.compactionMemory.allocateSegments(maxSegmentNumber);
		if(this.compactionMemory.getBlockCount() > maxSegmentNumber) {
			this.compactionMemory.releaseSegments(maxSegmentNumber, availableMemory);
		}
	}
913401
function splitOnFirst(str, splitter, callback) {
        var parts = str.split(splitter);
        var first = parts.shift();
        return callback(first, parts.join(splitter));
    }