Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

MarcoGorelli/dequote-annotations

Repository files navigation

Build Status Coverage pre-commit.ci status

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.