跳转到主要内容

一个用于自动替换类型注解中字符串字面量的工具。

项目描述

Build Status Coverage pre-commit.ci status

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 (3.8 kB 查看哈希值)

上传时间:

构建分布

no_string_hints-0.2.0-py2.py3-none-any.whl (4.1 kB 查看哈希值)

上传时间 Python 2 Python 3

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF赞助商 PingdomPingdom 监控 SentrySentry 错误日志 StatusPageStatusPage 状态页面