Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-pyclbr.html" /> | |
13 | <link rel="prev" href="module-tokenize.html" /> | |
14 | <link rel="parent" href="language.html" /> | |
15 | <link rel="next" href="module-pyclbr.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>18.6 tabnanny -- Detection of ambiguous indentation</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="18.5 tokenize " | |
25 | href="module-tokenize.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="18. Python Language Services" | |
28 | href="language.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="18.7 pyclbr " | |
31 | href="module-pyclbr.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-tokenize.html">18.5 tokenize </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="language.html">18. Python Language Services</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-pyclbr.html">18.7 pyclbr </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0020600000000000000000"> | |
56 | 18.6 <tt class="module">tabnanny</tt> -- | |
57 | Detection of ambiguous indentation</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-tabnanny"></A> | |
62 | ||
63 | <P> | |
64 | For the time being this module is intended to be called as a script. | |
65 | However it is possible to import it into an IDE and use the function | |
66 | <tt class="function">check()</tt> described below. | |
67 | ||
68 | <P> | |
69 | <span class="warning"><b class="label">Warning:</b> | |
70 | The API provided by this module is likely to change | |
71 | in future releases; such changes may not be backward compatible.</span> | |
72 | ||
73 | <P> | |
74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
75 | <td><nobr><b><tt id='l2h-4974' xml:id='l2h-4974' class="function">check</tt></b>(</nobr></td> | |
76 | <td><var>file_or_dir</var>)</td></tr></table></dt> | |
77 | <dd> | |
78 | If <var>file_or_dir</var> is a directory and not a symbolic link, then | |
79 | recursively descend the directory tree named by <var>file_or_dir</var>, | |
80 | checking all <span class="file">.py</span> files along the way. If <var>file_or_dir</var> | |
81 | is an ordinary Python source file, it is checked for whitespace | |
82 | related problems. The diagnostic messages are written to standard | |
83 | output using the print statement. | |
84 | </dl> | |
85 | ||
86 | <P> | |
87 | <dl><dt><b><tt id='l2h-4975' xml:id='l2h-4975'>verbose</tt></b></dt> | |
88 | <dd> | |
89 | Flag indicating whether to print verbose messages. | |
90 | This is incremented by the <code>-v</code> option if called as a script. | |
91 | </dd></dl> | |
92 | ||
93 | <P> | |
94 | <dl><dt><b><tt id='l2h-4976' xml:id='l2h-4976'>filename_only</tt></b></dt> | |
95 | <dd> | |
96 | Flag indicating whether to print only the filenames of files | |
97 | containing whitespace related problems. This is set to true by the | |
98 | <code>-q</code> option if called as a script. | |
99 | </dd></dl> | |
100 | ||
101 | <P> | |
102 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-4977' xml:id='l2h-4977' class="exception">NannyNag</tt></b></dt> | |
103 | <dd> | |
104 | Raised by <tt class="function">tokeneater()</tt> if detecting an ambiguous indent. | |
105 | Captured and handled in <tt class="function">check()</tt>. | |
106 | </dd></dl> | |
107 | ||
108 | <P> | |
109 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
110 | <td><nobr><b><tt id='l2h-4978' xml:id='l2h-4978' class="function">tokeneater</tt></b>(</nobr></td> | |
111 | <td><var>type, token, start, end, line</var>)</td></tr></table></dt> | |
112 | <dd> | |
113 | This function is used by <tt class="function">check()</tt> as a callback parameter to | |
114 | the function <tt class="function">tokenize.tokenize()</tt>. | |
115 | </dl> | |
116 | ||
117 | <P> | |
118 | <div class="seealso"> | |
119 | <p class="heading">See Also:</p> | |
120 | ||
121 | <dl compact="compact" class="seemodule"> | |
122 | <dt>Module <b><tt class="module"><a href="module-tokenize.html">tokenize</a></tt>:</b> | |
123 | <dd>Lexical scanner for Python source code. | |
124 | </dl> | |
125 | </div> | |
126 | ||
127 | <DIV CLASS="navigation"> | |
128 | <div class='online-navigation'> | |
129 | <p></p><hr /> | |
130 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
131 | <tr> | |
132 | <td class='online-navigation'><a rel="prev" title="18.5 tokenize " | |
133 | href="module-tokenize.html"><img src='../icons/previous.png' | |
134 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
135 | <td class='online-navigation'><a rel="parent" title="18. Python Language Services" | |
136 | href="language.html"><img src='../icons/up.png' | |
137 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
138 | <td class='online-navigation'><a rel="next" title="18.7 pyclbr " | |
139 | href="module-pyclbr.html"><img src='../icons/next.png' | |
140 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
141 | <td align="center" width="100%">Python Library Reference</td> | |
142 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
143 | href="contents.html"><img src='../icons/contents.png' | |
144 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
145 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
146 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
147 | <td class='online-navigation'><a rel="index" title="Index" | |
148 | href="genindex.html"><img src='../icons/index.png' | |
149 | border='0' height='32' alt='Index' width='32' /></A></td> | |
150 | </tr></table> | |
151 | <div class='online-navigation'> | |
152 | <b class="navlabel">Previous:</b> | |
153 | <a class="sectref" rel="prev" href="module-tokenize.html">18.5 tokenize </A> | |
154 | <b class="navlabel">Up:</b> | |
155 | <a class="sectref" rel="parent" href="language.html">18. Python Language Services</A> | |
156 | <b class="navlabel">Next:</b> | |
157 | <a class="sectref" rel="next" href="module-pyclbr.html">18.7 pyclbr </A> | |
158 | </div> | |
159 | </div> | |
160 | <hr /> | |
161 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
162 | </DIV> | |
163 | <!--End of Navigation Panel--> | |
164 | <ADDRESS> | |
165 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
166 | </ADDRESS> | |
167 | </BODY> | |
168 | </HTML> |