Python标准库heapq模块的容器数据类型包装器
项目描述
heapq-container
Python标准库heapq模块的容器数据类型包装器。
安装
使用pip安装此库
pip install heapq-container
使用方法
from heapqueue import HeapQueue
def heapsort(iterable):
h = HeapQueue(iterable)
return [h.pop() for _ in range(len(h))]
heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
# -> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
开发
要为此库做贡献,首先检出代码。然后创建一个新的虚拟环境
cd heapq-container
python -m venv venv
source venv/bin/activate
现在安装依赖项和测试依赖项
pip install -e '.[test]'
要运行测试
pytest