Skip to main content

reindent script by Tim Peters

Project description

Released to the public domain, by Tim Peters, 03 October 2000.

Usage:

reindent [-d][-r][-v] [ path ... ]

-d (--dryrun)  Dry run.  Analyze, but don't make any changes to, files.
-r (--recurse) Recurse.  Search for all .py files in subdirectories too.
-v (--verbose) Verbose.  Print informative msgs; else no output.
-h (--help)    Help.     Print this usage information and exit.

Change Python (.py) files to use 4-space indents and no hard tab
characters. Also trim excess spaces and tabs from ends of lines,
and remove empty lines at the end of files.  Also ensure the last line
ends with a newline.

If no paths are given on the command line, reindent operates as a filter,
reading a single source file from standard input and writing the
transformed source to standard output.  In this case, the -d, -r and -v
flags are ignored.

You can pass one or more file and/or directory paths.  When a directory
path, all .py files within the directory will be examined, and, if the -r
option is given, likewise recursively for subdirectories.

If output is not to standard output, reindent overwrites files in place,
renaming the originals with a .bak extension.  If it finds nothing to
change, the file is left alone.  If reindent does change a file,
the changed file is a fixed-point for future runs (i.e., running
reindent on the resulting .py file won't change it again).

The hard part of reindenting is figuring out what to do with comment
lines.  So long as the input files get a clean bill of health from
tabnanny.py, reindent should do a good job.

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

Reindent-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file Reindent-0.1.1.tar.gz.

File metadata

  • Download URL: Reindent-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Reindent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d61226a0d0109aef3495033b42e8a0258c6bef1c014d9f26e31c62f071352b82
MD5 878352c36c421a0b944607efba3b01ad
BLAKE2b-256 333430432dff92313063b5a037d65f9ef908ed601ab836c53b676325049ff4cf

See more details on using hashes here.

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