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


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.3.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

Hashes for dequote_annotations-0.2.3.tar.gz
Algorithm Hash digest
SHA256 b9f12cbfdb67a83a81db9eb1cc3b5ad97160feea4ec02766dafc50bb2c64e562
MD5 ec48f656c8eac575860ef8d718d70470
BLAKE2b-256 b0f101dd7995d126a5e76843514d6f729f6dee8a955d752134924492cc0e50b2

See more details on using hashes here.

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

Hashes for dequote_annotations-0.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 08f7cf601996081c8eb171660325082624934801d5d662606428018fdb9d6c3d
MD5 d3d2cf562f99277c09b52a5e0a9ffe5e
BLAKE2b-256 ab21b81b521a541698fee900531957e3b11e0a1b4b7d9c5084e5205e49e28042

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