Skip to main content

Correct placement of separators

Project description

flake8-digit-separator

coverage tests pypi package version pypi downloads supported python versions wemake-python-styleguide license

FDS logo

A set of rules on top of the capabilities provided by PEP515.

correct_int = 10_000
correct_float = 10_000.1_234
correct_binary = 0b_1101_1001
correct_octal = 0o_134_155
correct_hex = 0x_CAFE_F00D

Installation

pip install flake8-digit-separator

Dependencies

  • python (>=3.10, <4.0)
  • flake8 (>=7.1, <8.0)

Usage

flake8 . --select FDS

Rules

PEP515 allows separators, but does not impose any restrictions on their position in a number (except that a number should not start/end with a separator and there should not be two separators in a row). To introduce more rigor and beauty into the code, we have written a few simple rules that we suggest following.

Rule Number Description Correct Wrong
FDS100 integer Group by 3s from right 10_000 10_0
FDS200 float Group by 3s from right 10_000.1_234 1_0_0.123_4
FDS300 binary Group by 4s from right after prefix 0b 0b_1101_1001 0b110_11
FDS400 octal Group by 3s from right after prefix 0o 0o_12_134_155 0o1_23_45
FDS500 hex Group by 4s from right after prefix 0x 0x_CAFE_F00D 0xCAFEF0_0D

License

FDS is released under the MIT License. See the bundled LICENSE file for details.

The logo was created using Font Meme.

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

flake8_digit_separator-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_digit_separator-0.1.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file flake8_digit_separator-0.1.0.tar.gz.

File metadata

  • Download URL: flake8_digit_separator-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for flake8_digit_separator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a2a9c50400733355a043876d160c5c6094a7d7061f21f604883db7e5b8e1473
MD5 10e80ee5369926e649b11760f5049b04
BLAKE2b-256 8408b0bda1dc9ceb64bf1dce445c288a13ca26ecafd6065b1d98d30d4ee5df2b

See more details on using hashes here.

File details

Details for the file flake8_digit_separator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_digit_separator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for flake8_digit_separator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d64d767a650fbb7a9260523b95687a9f6f81cd42ef7cd6e0fb8bbc8393f5cf05
MD5 a5b8c812588ced710d751c60b1731b8e
BLAKE2b-256 b92a12272989f285a1ecb796605b39fa6f3a6884f0412dafc527e8e4ff92a950

See more details on using hashes here.

Supported by

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