Skip to main content

Flake8 plugin that checks against poor spacing around the equals sign in function arguments.

Project description

flake8-arg-spacing

pypi

When applying the standard formatting rules of Python, it's easy to end up with code like below, where spacing obscures the actual operator precedence:

foo(bar=a + b)
# or
Order.objects.filter(timestamp__gt=timezone.now() - timedelta(minutes=30))

This plugin reports such patterns in function calls and definitions. You may want to:

  • remove spaces around the binary operator:
foo(bar=a+b)
  • add parentheses around the expression:
foo(bar=(a + b))
  • create a separate variable for the expression:
c = a + b
foo(bar=c)
  • or add spaces around the equals sign:
foo(bar = a + b)  # incompatible with PEP 8

Included rules

  • ARG101 - confusing spacing around keyword argument
  • ARG102 - confusing spacing around parameter default

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_arg_spacing-1.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

flake8_arg_spacing-1.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file flake8_arg_spacing-1.1.0.tar.gz.

File metadata

  • Download URL: flake8_arg_spacing-1.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for flake8_arg_spacing-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f018c11b26c6ad01c23c9a58267a77af0ec2302226e952f8c10d2983015be42b
MD5 332d698532d5c7af8c2170cf5218d37b
BLAKE2b-256 ff4993f77403490c6308f0881cb40acf8c2a5abff766912e17bfdfe8e86b866e

See more details on using hashes here.

File details

Details for the file flake8_arg_spacing-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_arg_spacing-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 322d3157e3b42fab46c20c3901ca08aa9c9617abf96a0026ae613eaf69a8c1e5
MD5 0c7799a9c760d297154527400f7cf76c
BLAKE2b-256 83dec5195a4a6a93d00063762f2da376fcc96969031a7de07f000be5648a94d9

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