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.2
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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | de93e5aa6fe8dcf0bce40d3c3b6607e3b69e471108ca791dbe988076542278f2 |
|
MD5 | bd7a0bc27b8453fe5c5e7c29bb8ef788 |
|
BLAKE2b-256 | a55124e88e9bdaf428ebcef191c0b56ab6004a3256981610cce5490d6a6a3dc0 |
Close
Hashes for dequote_annotations-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 726fba84092d9e9b3e37c46a43f5f4c81dd38e3d559242be3f374e86b8903938 |
|
MD5 | 738e50eef4255501b45e8de06b58ae46 |
|
BLAKE2b-256 | e0cc4df8fba0e301e1d2913049d70e71ea6a32083c8307c66967bef17c53837f |