On this page
  1. tabnanny.check
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

tabnanny.check

Up: tabnanny | Next: tabnanny.NannyNag
Rel: tabnanny.NannyNag, tabnanny.process_tokens
Ref: docs.python.org — tabnanny.check
Tags: #public #python3 #stdlib #tabnanny


Import

import tabnanny
from tabnanny import check

Signature & Overview

tabnanny.check(file)

If file_or_dir is a directory and not a symbolic link, then recursively descend the directory tree named by file_or_dir, checking all .py files along the way. If file_or_dir is an ordinary Python source file, it is

Usage

from pathlib import Path
import tabnanny, tempfile

with tempfile.TemporaryDirectory() as tmp:
    p = Path(tmp) / 'clean.py'
    p.write_text('def f():\n    return 1\n', encoding='utf-8')
    tabnanny.check(str(p))

Gotchas

REPL Inspect

from tabnanny import check
help(check)

Linked from

Related notes