-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathUndefinedExport.qhelp
37 lines (29 loc) · 1.3 KB
/
UndefinedExport.qhelp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>When a module is imported using <code>import *</code>, all attributes listed in
<code>__all__</code> are imported. If <code>__all__</code> includes attributes that
are not defined in the module then an exception is triggered. This usually indicates
a typographic error in the attributes in <code>__all__</code> or in the name of the
object.</p>
</overview>
<recommendation>
<p>Correct any typographic errors, either in the name of the object or in the string in
<code>__all__</code>. If there are no typographic errors, either delete the name from
<code>__all__</code> or add the object to the module.</p>
</recommendation>
<example>
<p>
In the example, the function name <code>spam</code> has been misspelled in the <code>__all__</code> list.
This will result in <code>spamm</code> being highlighted as an undefined export.
Correcting the spelling will fix the defect.
</p>
<sample src="UndefinedExport.py" />
</example>
<references>
<li>Python Language Reference: <a href="http://docs.python.org/2/reference/simple_stmts.html#import">The import statement</a>.</li>
<li>Python Tutorial: <a href="http://docs.python.org/2/tutorial/modules.html#importing-from-a-package">Importing * from a Package</a>.</li>
</references>
</qhelp>