一个用于自动替换类型注解中字符串字面量的工具。
项目描述
no-string-hints
一个预提交钩子,用于自动从参数、返回值和类变量类型注解中删除字符串字面量。只有当您的文件包含from __future__ import annotations
时,才会进行替换。
安装
pip安装no-string-hints
作为预提交钩子
有关说明,请参阅pre-commit
示例.pre-commit-config.yaml
- repo: https://github.com/MarcoGorelli/no-string-hints
rev: v0.2.0
hooks:
- id: no-string-hints
命令行示例
$ cat myfile.py
myvar: 'str'
$ no_string_hints myfile.py
$ cat myfile.py
myvar: str
另请参阅
检查pyupgrade,我在编写此项目时从中学到了很多。
项目详情
关闭
no_string_hints-0.2.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 055c1b012b09c47eb0d8a8d89f0ed743b0582bd83ff810f39eacdd6dc8efd988 |
|
MD5 | a45c5dc816637d08e0a89961a07a43d1 |
|
BLAKE2b-256 | db5d9a893830889e6dc76d4c065875ac7c06ba32fcc9e5110a0141d2daa9769a |
关闭
no_string_hints-0.2.0-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 4b584e37fd6000b8cd4ed69b297ecea4b3206a15782af73e694f18453c85b6c9 |
|
MD5 | fab5f2527b2ed1c18afb049cbc4997d1 |
|
BLAKE2b-256 | cab34d5d56bbd64af782e5946007a693198ca28d1fa1d5b092086e530d28bd0c |