(self, sort=False)
return data
Extracts all elements from the TopN. This is a destructive operation.

    The only method that can be called immediately after extract() is reset().

    Args:
      sort: Whether to return the elements in descending sorted order.

    Returns:
      A list of data; the top n elements provided to the set.
Extracts all elements from the TopN. This is a destructive operation.
Extracts all elements from the TopN . This is a destructive operation .
def extract(self, sort=False):
    """Extracts all elements from the TopN. This is a destructive operation.

    The only method that can be called immediately after extract() is reset().

    Args:
      sort: Whether to return the elements in descending sorted order.

    Returns:
      A list of data; the top n elements provided to the set.
    """
    assert self._data is not None
    data = self._data
    self._data = None
    if sort:
      data.sort(reverse=True)
    return data
def extract ( self , sort = False ) : assert self . _data is not None data = self . _data self . _data = None if sort : data . sort ( reverse = True ) return data