/Doc/library/tabnanny.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 62 lines · 38 code · 24 blank · 0 comment · 0 complexity · 1a5bdf9c813a2bb98112244c967c4f36 MD5 · raw file

  1. :mod:`tabnanny` --- Detection of ambiguous indentation
  2. ======================================================
  3. .. module:: tabnanny
  4. :synopsis: Tool for detecting white space related problems in Python source files in a
  5. directory tree.
  6. .. moduleauthor:: Tim Peters <tim_one@users.sourceforge.net>
  7. .. sectionauthor:: Peter Funk <pf@artcom-gmbh.de>
  8. .. rudimentary documentation based on module comments
  9. For the time being this module is intended to be called as a script. However it
  10. is possible to import it into an IDE and use the function :func:`check`
  11. described below.
  12. .. note::
  13. The API provided by this module is likely to change in future releases; such
  14. changes may not be backward compatible.
  15. .. function:: check(file_or_dir)
  16. If *file_or_dir* is a directory and not a symbolic link, then recursively
  17. descend the directory tree named by *file_or_dir*, checking all :file:`.py`
  18. files along the way. If *file_or_dir* is an ordinary Python source file, it is
  19. checked for whitespace related problems. The diagnostic messages are written to
  20. standard output using the print statement.
  21. .. data:: verbose
  22. Flag indicating whether to print verbose messages. This is incremented by the
  23. ``-v`` option if called as a script.
  24. .. data:: filename_only
  25. Flag indicating whether to print only the filenames of files containing
  26. whitespace related problems. This is set to true by the ``-q`` option if called
  27. as a script.
  28. .. exception:: NannyNag
  29. Raised by :func:`tokeneater` if detecting an ambiguous indent. Captured and
  30. handled in :func:`check`.
  31. .. function:: tokeneater(type, token, start, end, line)
  32. This function is used by :func:`check` as a callback parameter to the function
  33. :func:`tokenize.tokenize`.
  34. .. XXX document errprint, format_witnesses, Whitespace, check_equal, indents,
  35. reset_globals
  36. .. seealso::
  37. Module :mod:`tokenize`
  38. Lexical scanner for Python source code.