Skip to main content

A tool to automatically replace string literals in type annotations.

Project description

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.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dequote_annotations-0.2.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

dequote_annotations-0.2.2-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dequote_annotations-0.2.2.tar.gz.

File metadata

  • Download URL: dequote_annotations-0.2.2.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

Hashes for dequote_annotations-0.2.2.tar.gz
Algorithm Hash digest
SHA256 de93e5aa6fe8dcf0bce40d3c3b6607e3b69e471108ca791dbe988076542278f2
MD5 bd7a0bc27b8453fe5c5e7c29bb8ef788
BLAKE2b-256 a55124e88e9bdaf428ebcef191c0b56ab6004a3256981610cce5490d6a6a3dc0

See more details on using hashes here.

Provenance

File details

Details for the file dequote_annotations-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: dequote_annotations-0.2.2-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

Hashes for dequote_annotations-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 726fba84092d9e9b3e37c46a43f5f4c81dd38e3d559242be3f374e86b8903938
MD5 738e50eef4255501b45e8de06b58ae46
BLAKE2b-256 e0cc4df8fba0e301e1d2913049d70e71ea6a32083c8307c66967bef17c53837f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page