一个烦人的辅助模块,用于查找unicode/bytes字符串比较和其他问题。
项目描述
// Unicode纳粹 //
一旦启用,Unicode纳粹会在遇到不是纯Unicode或bytestring的情况时抱怨。这非常烦人,仅在将库从Python 2迁移到Python 3时有用。它对性能有很大的影响,并且还会对Python标准库中的大多数内容进行抱怨。
用法
>>> import unicodenazi >>> 'foo' == u'foo' __main__:1: UnicodeWarning: Implicit conversion of str to unicode True如何再次禁用它
>>> unicodenazi.disable()以下是如何启用它
>>> unicodenazi.enable()如果您只想为给定块启用它
>>> unicodenazi.disable() >>> with unicodenazi.blockwise(enabled=True): ... assert 'foo' == u'foo' ... __main__:2: UnicodeWarning: Implicit conversion of str to unicode当然也可以相反操作。
该模块可以从命令行使用
$ python -municodenazi your_script.py [script_args..]
项目详情
关闭
unicode-nazi-1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5be37c62cfa750d0a58693d9c63b6e95f6932675e3939c4cdd60151631ac04fc |
|
MD5 | f9b3d2c25c7887df643e67e2c8d99c45 |
|
BLAKE2b-256 | 664f70344391454973af0fcc70bcea02e9f78ead8e82b5ea82b0d01eb0ea753f |