A tool to automatically replace string literals in type annotations.
Project description
no-string-hints
A pre-commit hook to automatically remove string literals as type hints from argument, return, and class variable type annotations.
Installation
pip install no_string_hints
As a pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/MarcoGorelli/no-string-hints
rev: v0.1.8
hooks:
- id: no-string-hints
Command-line example
$ cat myfile.py
myvar: 'str'
$ no_string_hints myfile.py
$ cat myfile.py
myvar: str
See also
Check out pyupgrade, which I learned a lot from when writing this.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
no_string_hints-0.1.8.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for no_string_hints-0.1.8-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b03996fee5c337509456532fa954066545c4d185f83deef93314188fb9bd1dd |
|
MD5 | b049ad7af439bbfc842eeb40a672f865 |
|
BLAKE2b-256 | 36ac6cbfa50ff037f8233c4b9cb6272c83fbba083b478d21bcf6a1f029a2860b |