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
File details
Details for the file dequote_annotations-0.2.3.tar.gz
.
File metadata
- Download URL: dequote_annotations-0.2.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f12cbfdb67a83a81db9eb1cc3b5ad97160feea4ec02766dafc50bb2c64e562 |
|
MD5 | ec48f656c8eac575860ef8d718d70470 |
|
BLAKE2b-256 | b0f101dd7995d126a5e76843514d6f729f6dee8a955d752134924492cc0e50b2 |
Provenance
File details
Details for the file dequote_annotations-0.2.3-py2.py3-none-any.whl
.
File metadata
- Download URL: dequote_annotations-0.2.3-py2.py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f7cf601996081c8eb171660325082624934801d5d662606428018fdb9d6c3d |
|
MD5 | d3d2cf562f99277c09b52a5e0a9ffe5e |
|
BLAKE2b-256 | ab21b81b521a541698fee900531957e3b11e0a1b4b7d9c5084e5205e49e28042 |