A tool to automatically replace string literals in type annotations.
Project description
dequote-annotations
A pre-commit hook to automatically remove string literals as type hints from argument, return, and class variable type annotations. Will only make the replacement if your file contains from __future__ import annotations
.
Installation
pip install dequote-annotations
As a pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/MarcoGorelli/dequote-annotations
rev: v0.2.1
hooks:
- id: dequote-annotations
Command-line example
$ cat myfile.py
myvar: 'str'
$ dequote_annotations myfile.py
$ cat myfile.py
myvar: str
See also
Check out pyupgrade, which I learned a lot from when writing this.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dequote_annotations-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30eb48c3f89c5d1d156a2b375d9872116bf0ade610b4332f4e3ddb5664a59826 |
|
MD5 | 218d09220f5d171d51ecde29fe36facd |
|
BLAKE2b-256 | 50e2704dd9e93a51c6a4790dbd341acdc05d7eb3d7691b2fb28e75d1c8f3161f |
Close
Hashes for dequote_annotations-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ebc0944b24e3234f1c89e1c35f7b194bea59ab046b77da53931a538058d0b7a |
|
MD5 | 04267e81f0a0159ddf8fa57dd2b2b154 |
|
BLAKE2b-256 | 59ac6b0c5575c26eb0a453c2ee601d136103b7afd077755ef615e5eb45757521 |