更少的Python,更少的问题。有用的Python实用工具。
项目描述
PyMore
PyMore
是一组Python的实用工具。
包括
- EqualsTester: Python中测试等价合同的帮助程序(最初为 Cirq 开发)
import pymore
tester = pymore.EqualsTester()
# This tests that the added elements all satisfy the equals contract
# between themselves.
tester.add_equality_group(MyObject("a"), MyObject("a"))
# Each new addition of an equality group also tests that the elements
# in this new group are not equal to those in the perviously added group.
# So, for example, this would raise an `AssertionError` if it was
# true that `MyObject("a")` was equal to `MyObject("b")`.
tester.add_equality_group(MyObject("b"), MyObject("b"))
- first: 返回匹配谓词的第一个元素或默认值。
import pymore
is_even = lambda x: x % 2 == 0
# Returns the first element that is even.
first = pymore.first([1, 3, 6, 7], is_even)
assert first == 6
许可证
此软件包根据Apache 2.0许可证许可。此代码源自其他框架中的工作。请参阅 LICENSE 和 NOTICES 了解详情。
项目详情
下载文件
下载适合您平台文件的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。
源分布
PyMore-0.1.3.tar.gz (8.0 kB 查看哈希)
构建分布
PyMore-0.1.3-py3-none-any.whl (12.8 kB 查看哈希)