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.3
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f12cbfdb67a83a81db9eb1cc3b5ad97160feea4ec02766dafc50bb2c64e562 |
|
MD5 | ec48f656c8eac575860ef8d718d70470 |
|
BLAKE2b-256 | b0f101dd7995d126a5e76843514d6f729f6dee8a955d752134924492cc0e50b2 |
Close
Hashes for dequote_annotations-0.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f7cf601996081c8eb171660325082624934801d5d662606428018fdb9d6c3d |
|
MD5 | d3d2cf562f99277c09b52a5e0a9ffe5e |
|
BLAKE2b-256 | ab21b81b521a541698fee900531957e3b11e0a1b4b7d9c5084e5205e49e28042 |