Merge pull request #913 from markshannon/python-add-3-library-tests

Python add 2/3 specific library tests
This commit is contained in:
Taus
2019-02-12 12:54:15 +01:00
committed by GitHub
262 changed files with 5542 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
| 8 | ControlFlowNode for ExceptStmt | builtin-class AttributeError |
| 10 | ControlFlowNode for ExceptStmt | builtin-class IndexError |
| 12 | ControlFlowNode for ExceptStmt | builtin-class KeyError |
| 14 | ControlFlowNode for ExceptStmt | builtin-class BaseException |
| 23 | ControlFlowNode for ExceptStmt | builtin-class AttributeError |
| 25 | ControlFlowNode for ExceptStmt | builtin-class IndexError |
| 27 | ControlFlowNode for ExceptStmt | builtin-class KeyError |
| 38 | ControlFlowNode for ExceptStmt | builtin-class AttributeError |
| 40 | ControlFlowNode for ExceptStmt | builtin-class IndexError |
| 42 | ControlFlowNode for ExceptStmt | builtin-class KeyError |
| 57 | ControlFlowNode for ExceptStmt | builtin-class IOError |

View File

@@ -0,0 +1,6 @@
import python
from ExceptFlowNode ex, Object obj
where ex.handledException(obj, _, _)
select ex.getLocation().getStartLine(), ex.toString(), obj.toString()

View File

@@ -0,0 +1,15 @@
| 4 | ControlFlowNode for Subscript | builtin-class IndexError |
| 4 | ControlFlowNode for Subscript | builtin-class KeyError |
| 5 | ControlFlowNode for Attribute | builtin-class AttributeError |
| 7 | ControlFlowNode for Raise | builtin-class Exception |
| 19 | ControlFlowNode for Subscript | builtin-class IndexError |
| 19 | ControlFlowNode for Subscript | builtin-class KeyError |
| 20 | ControlFlowNode for Attribute | builtin-class AttributeError |
| 22 | ControlFlowNode for Raise | builtin-class Exception |
| 30 | ControlFlowNode for Pass | builtin-class Exception |
| 34 | ControlFlowNode for Subscript | builtin-class IndexError |
| 34 | ControlFlowNode for Subscript | builtin-class KeyError |
| 35 | ControlFlowNode for Attribute | builtin-class AttributeError |
| 37 | ControlFlowNode for Raise | builtin-class Exception |
| 53 | ControlFlowNode for Attribute() | builtin-class IOError |
| 54 | ControlFlowNode for Attribute() | builtin-class IOError |

View File

@@ -0,0 +1,5 @@
import python
from RaisingNode r
select r.getLocation().getStartLine(), r.toString(), r.getARaisedType().toString()

View File

@@ -0,0 +1,25 @@
| 4 | ControlFlowNode for Subscript | 10 | ControlFlowNode for ExceptStmt |
| 4 | ControlFlowNode for Subscript | 12 | ControlFlowNode for ExceptStmt |
| 5 | ControlFlowNode for Attribute | 8 | ControlFlowNode for ExceptStmt |
| 6 | ControlFlowNode for a() | 8 | ControlFlowNode for ExceptStmt |
| 6 | ControlFlowNode for a() | 10 | ControlFlowNode for ExceptStmt |
| 6 | ControlFlowNode for a() | 12 | ControlFlowNode for ExceptStmt |
| 6 | ControlFlowNode for a() | 14 | ControlFlowNode for ExceptStmt |
| 7 | ControlFlowNode for Raise | 14 | ControlFlowNode for ExceptStmt |
| 19 | ControlFlowNode for Subscript | 25 | ControlFlowNode for ExceptStmt |
| 19 | ControlFlowNode for Subscript | 27 | ControlFlowNode for ExceptStmt |
| 20 | ControlFlowNode for Attribute | 23 | ControlFlowNode for ExceptStmt |
| 21 | ControlFlowNode for a() | 23 | ControlFlowNode for ExceptStmt |
| 21 | ControlFlowNode for a() | 25 | ControlFlowNode for ExceptStmt |
| 21 | ControlFlowNode for a() | 27 | ControlFlowNode for ExceptStmt |
| 21 | ControlFlowNode for a() | 30 | ControlFlowNode for Pass |
| 22 | ControlFlowNode for Raise | 30 | ControlFlowNode for Pass |
| 34 | ControlFlowNode for Subscript | 40 | ControlFlowNode for ExceptStmt |
| 34 | ControlFlowNode for Subscript | 42 | ControlFlowNode for ExceptStmt |
| 35 | ControlFlowNode for Attribute | 38 | ControlFlowNode for ExceptStmt |
| 36 | ControlFlowNode for a() | 38 | ControlFlowNode for ExceptStmt |
| 36 | ControlFlowNode for a() | 40 | ControlFlowNode for ExceptStmt |
| 36 | ControlFlowNode for a() | 42 | ControlFlowNode for ExceptStmt |
| 53 | ControlFlowNode for Attribute() | 57 | ControlFlowNode for ExceptStmt |
| 54 | ControlFlowNode for Attribute() | 57 | ControlFlowNode for ExceptStmt |
| 56 | ControlFlowNode for Attribute() | 57 | ControlFlowNode for ExceptStmt |

View File

@@ -0,0 +1,7 @@
import python
from ControlFlowNode r, ControlFlowNode s
where s = r.getAnExceptionalSuccessor() and
not r.(RaisingNode).unlikelySuccessor(s)
select r.getLocation().getStartLine(), r.toString(), s.getLocation().getStartLine(), s.toString()

View File

@@ -0,0 +1,6 @@
| 6 | ControlFlowNode for a() |
| 21 | ControlFlowNode for a() |
| 36 | ControlFlowNode for a() |
| 51 | ControlFlowNode for open() |
| 56 | ControlFlowNode for Attribute() |
| 58 | ControlFlowNode for Attribute() |

View File

@@ -0,0 +1,6 @@
import python
from RaisingNode r
where r.raisesUnknownType()
select r.getLocation().getStartLine(), r.toString()

View File

@@ -0,0 +1,59 @@
def f(a, x):
try:
a[x]
a.b
a(x)
raise Exception()
except AttributeError:
pass
except IndexError:
pass
except KeyError:
pass
except:
pass
def g(a, x):
try:
a[x]
a.b
a(x)
raise Exception()
except AttributeError:
pass
except IndexError:
pass
except KeyError:
pass
finally:
pass
def h(a, x):
try:
a[x]
a.b
a(x)
raise Exception()
except AttributeError:
pass
except IndexError:
pass
except KeyError:
pass
#I/O stuff.
def doesnt_raise():
pass
def io():
f12 = open("filename")
try:
f12.read("IOError could occur")
f12.write("IOError could occur")
doesnt_raise("Potential false positive here")
f12.close()
except IOError:
f12.close()

View File

@@ -0,0 +1,4 @@
def j():
raise Exception, "Exception"

View File

@@ -0,0 +1,6 @@
#Ensure there is an exceptional edge from the following cases
def f1():
try:
exec "print Hello World"
except:
e1

View File

@@ -0,0 +1,15 @@
#All Python2 kinds of AST nodes, thus all Python2 of flow nodes
class C:
def stmts(p0, p1):
exec "print('Hello World')"
print "hello"
print >> fd, "hello"
if x:
print y
def exprs(p2, p3):
`x`
[ a + "Hi" for a in str(y) ]

View File

@@ -0,0 +1,9 @@
def f():
exec AA_e
def g():
try:
exec AA_e
except:
pass

View File

@@ -0,0 +1,3 @@
| 30 |
| 44 |
| 68 |

View File

@@ -0,0 +1,11 @@
import python
import semmle.python.pointsto.PointsTo
import semmle.python.pointsto.PointsToContext
from ControlFlowNode f, Location l, Context c
where not PointsTo::Test::reachableBlock(f.getBasicBlock(), c) and c.isImport() and
(f.getNode() instanceof FunctionExpr or f.getNode() instanceof ClassExpr) and
l = f.getLocation() and l.getFile().getName().matches("%test.py")
select l.getStartLine()

View File

@@ -0,0 +1,3 @@
| module.py | 6 | BasicBlock | true |
| test.py | 27 | BasicBlock | true |
| test.py | 41 | BasicBlock | true |

View File

@@ -0,0 +1,8 @@
import python
import semmle.python.types.Version
from VersionGuard vg, Location l, boolean b
where l = vg.getLastNode().getLocation()
and (if vg.isTrue() then b = true else b = false)
select l.getFile().getName(), l.getStartLine(), vg.toString(), b

View File

@@ -0,0 +1,9 @@
import sys
os_test = sys.platform == "linux2"
version_test = sys.version_info < (3,)
if version_test:
version_2 = True
else:
version_3 = False

View File

@@ -0,0 +1,70 @@
import sys
class C:
pass
class D:
pass
if x:
v1 = C
else:
v1 = D
version_test = sys.version_info < (3,)
from module import version_test as t3
#We want to run all the tests on all OSes, so omit this test for now.
#if os_test:
# class E: pass
#else:
# def E(): pass
#
#e = E
if version_test:
class F: pass
else:
def F(): pass
f = F
if t3:
class H: pass
else:
def H(): pass
h = H
#Check source origin of some builtins
x = None
x
t = sys.settrace
t
def func():
pass
#type(x)
c = type(C())
t = type(C)
x = type(unknown)
g = type(func())
import module
if module.version_2:
class J: pass
else:
def J(): pass
j = J()

View File

@@ -0,0 +1,16 @@
| __init__.py | 2 | ControlFlowNode for ImportExpr | Module sys | ControlFlowNode for ImportExpr |
| __init__.py | 2 | ControlFlowNode for sys | Module sys | ControlFlowNode for ImportExpr |
| __init__.py | 4 | ControlFlowNode for Compare | bool True | ControlFlowNode for Compare |
| __init__.py | 4 | ControlFlowNode for sys | Module sys | ControlFlowNode for ImportExpr |
| __init__.py | 5 | ControlFlowNode for ImportExpr | Module package.foo | ControlFlowNode for ImportExpr |
| __init__.py | 5 | ControlFlowNode for ImportMember | class foo | ControlFlowNode for ClassExpr |
| __init__.py | 5 | ControlFlowNode for foo | class foo | ControlFlowNode for ClassExpr |
| foo.py | 2 | ControlFlowNode for ClassExpr | class foo | ControlFlowNode for ClassExpr |
| foo.py | 2 | ControlFlowNode for foo | class foo | ControlFlowNode for ClassExpr |
| foo.py | 2 | ControlFlowNode for object | builtin-class object | ControlFlowNode for object |
| foo.py | 5 | ControlFlowNode for List | List | ControlFlowNode for List |
| foo.py | 5 | ControlFlowNode for Str | str b'foo' | ControlFlowNode for Str |
| foo.py | 5 | ControlFlowNode for __all__ | List | ControlFlowNode for List |
| test.py | 2 | ControlFlowNode for ImportExpr | Module package | ControlFlowNode for ImportExpr |
| test.py | 2 | ControlFlowNode for ImportMember | class foo | ControlFlowNode for ClassExpr |
| test.py | 2 | ControlFlowNode for myfoo | class foo | ControlFlowNode for ClassExpr |

View File

@@ -0,0 +1,9 @@
import python
from int line, ControlFlowNode f, Object o, ControlFlowNode orig
where
not f.getLocation().getFile().inStdlib() and
f.refersTo(o, orig) and line = f.getLocation().getStartLine() and line != 0 and
not o instanceof NumericObject // Omit sys.hexversion as it will change between machines
select f.getLocation().getFile().getShortName(), line, f.toString(), o.toString(), orig.toString()

View File

@@ -0,0 +1,5 @@
import sys
if sys.hexversion < 0x03000000:
from .foo import foo

View File

@@ -0,0 +1,5 @@
class foo(object):
pass
__all__ = ['foo']

View File

@@ -0,0 +1,2 @@
from package import foo as myfoo

View File

@@ -0,0 +1,8 @@
| class C1 | class Meta1 |
| class C2 | class Meta2 |
| class C3 | builtin-class type |
| class C4 | class Meta2 |
| class Meta1 | builtin-class type |
| class Meta2 | builtin-class type |
| class NewStyleEvenForPython2 | builtin-class type |
| class NoDeclaredMetaclass | builtin-class classobj |

View File

@@ -0,0 +1,34 @@
class Meta1(type):
pass
class Meta2(type):
pass
class C1(object):
__metaclass__ = Meta1
class C2(object):
__metaclass__ = Meta2
#No explicit metaclass
class C3(object):
pass
#Multiple non-conflicting metaclasses:
class C4(C2, object):
pass
#Metaclass conflict
class C5(C2, C1):
pass
class NoDeclaredMetaclass:
pass
__metaclass__ = type
class NewStyleEvenForPython2:
pass

View File

@@ -0,0 +1,6 @@
import python
from ClassObject cls
where not cls.isC()
select cls.toString(), cls.getMetaClass().toString()

View File

@@ -0,0 +1,25 @@
| 5 | ControlFlowNode for ImportExpr | Module module1 | test.py:5 |
| 5 | ControlFlowNode for module1 | Module module1 | test.py:5 |
| 6 | ControlFlowNode for ImportExpr | Module module1 | test.py:6 |
| 6 | ControlFlowNode for ImportMember | int 1 | module1.py:2 |
| 6 | ControlFlowNode for a | int 1 | module1.py:2 |
| 7 | ControlFlowNode for ImportExpr | Module module2 | test.py:7 |
| 9 | ControlFlowNode for a | int 1 | module1.py:2 |
| 10 | ControlFlowNode for Attribute | int 2 | module1.py:3 |
| 10 | ControlFlowNode for module1 | Module module1 | test.py:5 |
| 11 | ControlFlowNode for x | float 1.0 | module2.py:2 |
| 13 | ControlFlowNode for C | class C | test.py:13 |
| 13 | ControlFlowNode for ClassExpr | class C | test.py:13 |
| 16 | ControlFlowNode for c | class C | test.py:13 |
| 16 | ControlFlowNode for type | builtin-class type | test.py:16 |
| 16 | ControlFlowNode for type() | class C | test.py:13 |
| 17 | ControlFlowNode for C | class C | test.py:13 |
| 17 | ControlFlowNode for C() | C() | test.py:17 |
| 18 | ControlFlowNode for t | builtin-class classobj | test.py:18 |
| 18 | ControlFlowNode for type | builtin-class type | test.py:18 |
| 18 | ControlFlowNode for type() | builtin-class classobj | test.py:18 |
| 19 | ControlFlowNode for C | class C | test.py:13 |
| 20 | ControlFlowNode for i | builtin-class int | test.py:20 |
| 20 | ControlFlowNode for type | builtin-class type | test.py:20 |
| 20 | ControlFlowNode for type() | builtin-class int | test.py:20 |
| 21 | ControlFlowNode for IntegerLiteral | int 7 | test.py:21 |

View File

@@ -0,0 +1,14 @@
import python
string short_loc(Location l) {
result = l.getFile().getShortName() + ":" + l.getStartLine()
}
from ControlFlowNode use, Object obj, ControlFlowNode orig, int line
where use.refersTo(obj, orig) and
use.getLocation().getFile().getName().matches("%test.py") and
line = use.getLocation().getStartLine() and
not line = 0
select line, use.toString(), obj.toString(), short_loc(orig.getLocation())

View File

@@ -0,0 +1,4 @@
a = 1
b = 2
c = 3

View File

@@ -0,0 +1,4 @@
x = 1.0
y = 2.0
z = 3.0

View File

@@ -0,0 +1,21 @@
#Couple of tests for cases where multiple origins had occurred.
import module1
from module1 import a
from module2 import *
a
module1.b
x
class C:
pass
c = type(
C())
t = type(
C)
i = type(
7)

View File

@@ -0,0 +1 @@
| 1 |

View File

@@ -0,0 +1,5 @@
#Test extractor doesn't fail on backticks
def dont_use_this_deprecated_feature(arg):
return `arg`

View File

@@ -0,0 +1,3 @@
import python
select count(Repr r)

View File

@@ -0,0 +1,10 @@
| 36 | class DerivedFromBuiltin | append | Builtin-method append |
| 36 | class DerivedFromBuiltin | count | Builtin-method count |
| 36 | class DerivedFromBuiltin | extend | Builtin-method extend |
| 36 | class DerivedFromBuiltin | index | Builtin-method index |
| 36 | class DerivedFromBuiltin | insert | Builtin-method insert |
| 36 | class DerivedFromBuiltin | meth5 | Function meth5 |
| 36 | class DerivedFromBuiltin | pop | Builtin-method pop |
| 36 | class DerivedFromBuiltin | remove | Builtin-method remove |
| 36 | class DerivedFromBuiltin | reverse | Builtin-method reverse |
| 36 | class DerivedFromBuiltin | sort | Builtin-method sort |

View File

@@ -0,0 +1,13 @@
/**
* @name class_attr
* @kind test
* @problem.severity warning
*/
import python
from ClassObject cls, int line, string name, Object obj
where cls.hasLocationInfo(_, line, _, _, _)
and obj = cls.lookupAttribute(name) and
not cls.isC() and not name.matches("\\_\\_%\\_\\_")
select line, cls.toString(), name, obj.toString()

View File

@@ -0,0 +1,10 @@
| 36 | class DerivedFromBuiltin | append |
| 36 | class DerivedFromBuiltin | count |
| 36 | class DerivedFromBuiltin | extend |
| 36 | class DerivedFromBuiltin | index |
| 36 | class DerivedFromBuiltin | insert |
| 36 | class DerivedFromBuiltin | meth5 |
| 36 | class DerivedFromBuiltin | pop |
| 36 | class DerivedFromBuiltin | remove |
| 36 | class DerivedFromBuiltin | reverse |
| 36 | class DerivedFromBuiltin | sort |

View File

@@ -0,0 +1,13 @@
/**
* @name class_attr
* @kind test
* @problem.severity warning
*/
import python
from ClassObject cls, int line, string name
where cls.hasLocationInfo(_, line, _, _, _)
and cls.hasAttribute(name) and
not cls.isC() and not name.matches("\\_\\_%\\_\\_")
select line, cls.toString(), name

View File

@@ -0,0 +1,91 @@
| builtin-class list | __add__ | Builtin-method __add__ |
| builtin-class list | __class__ | Property __class__ |
| builtin-class list | __contains__ | Builtin-method __contains__ |
| builtin-class list | __delattr__ | Builtin-method __delattr__ |
| builtin-class list | __delitem__ | Builtin-method __delitem__ |
| builtin-class list | __delslice__ | Builtin-method __delslice__ |
| builtin-class list | __doc__ | str b'list() -> new empty list\nlist(iterable) -> new list initialized from iterable's items' |
| builtin-class list | __eq__ | Builtin-method __eq__ |
| builtin-class list | __format__ | Builtin-method __format__ |
| builtin-class list | __ge__ | Builtin-method __ge__ |
| builtin-class list | __getattribute__ | Builtin-method __getattribute__ |
| builtin-class list | __getitem__ | Builtin-method __getitem__ |
| builtin-class list | __getslice__ | Builtin-method __getslice__ |
| builtin-class list | __gt__ | Builtin-method __gt__ |
| builtin-class list | __hash__ | NoneType None |
| builtin-class list | __iadd__ | Builtin-method __iadd__ |
| builtin-class list | __imul__ | Builtin-method __imul__ |
| builtin-class list | __init__ | Builtin-method __init__ |
| builtin-class list | __iter__ | Builtin-method __iter__ |
| builtin-class list | __le__ | Builtin-method __le__ |
| builtin-class list | __len__ | Builtin-method __len__ |
| builtin-class list | __lt__ | Builtin-method __lt__ |
| builtin-class list | __mul__ | Builtin-method __mul__ |
| builtin-class list | __ne__ | Builtin-method __ne__ |
| builtin-class list | __new__ | Builtin-method __new__ |
| builtin-class list | __reduce__ | Builtin-method __reduce__ |
| builtin-class list | __reduce_ex__ | Builtin-method __reduce_ex__ |
| builtin-class list | __repr__ | Builtin-method __repr__ |
| builtin-class list | __reversed__ | Builtin-method __reversed__ |
| builtin-class list | __rmul__ | Builtin-method __rmul__ |
| builtin-class list | __setattr__ | Builtin-method __setattr__ |
| builtin-class list | __setitem__ | Builtin-method __setitem__ |
| builtin-class list | __setslice__ | Builtin-method __setslice__ |
| builtin-class list | __sizeof__ | Builtin-method __sizeof__ |
| builtin-class list | __str__ | Builtin-method __str__ |
| builtin-class list | __subclasshook__ | classmethod_descriptor __subclasshook__ |
| builtin-class list | append | Builtin-method append |
| builtin-class list | count | Builtin-method count |
| builtin-class list | extend | Builtin-method extend |
| builtin-class list | index | Builtin-method index |
| builtin-class list | insert | Builtin-method insert |
| builtin-class list | pop | Builtin-method pop |
| builtin-class list | remove | Builtin-method remove |
| builtin-class list | reverse | Builtin-method reverse |
| builtin-class list | sort | Builtin-method sort |
| class DerivedFromBuiltin | __add__ | Builtin-method __add__ |
| class DerivedFromBuiltin | __class__ | Property __class__ |
| class DerivedFromBuiltin | __contains__ | Builtin-method __contains__ |
| class DerivedFromBuiltin | __delattr__ | Builtin-method __delattr__ |
| class DerivedFromBuiltin | __delitem__ | Builtin-method __delitem__ |
| class DerivedFromBuiltin | __delslice__ | Builtin-method __delslice__ |
| class DerivedFromBuiltin | __doc__ | str b'list() -> new empty list\nlist(iterable) -> new list initialized from iterable's items' |
| class DerivedFromBuiltin | __eq__ | Builtin-method __eq__ |
| class DerivedFromBuiltin | __format__ | Builtin-method __format__ |
| class DerivedFromBuiltin | __ge__ | Builtin-method __ge__ |
| class DerivedFromBuiltin | __getattribute__ | Builtin-method __getattribute__ |
| class DerivedFromBuiltin | __getitem__ | Builtin-method __getitem__ |
| class DerivedFromBuiltin | __getslice__ | Builtin-method __getslice__ |
| class DerivedFromBuiltin | __gt__ | Builtin-method __gt__ |
| class DerivedFromBuiltin | __hash__ | NoneType None |
| class DerivedFromBuiltin | __iadd__ | Builtin-method __iadd__ |
| class DerivedFromBuiltin | __imul__ | Builtin-method __imul__ |
| class DerivedFromBuiltin | __init__ | Builtin-method __init__ |
| class DerivedFromBuiltin | __iter__ | Builtin-method __iter__ |
| class DerivedFromBuiltin | __le__ | Builtin-method __le__ |
| class DerivedFromBuiltin | __len__ | Builtin-method __len__ |
| class DerivedFromBuiltin | __lt__ | Builtin-method __lt__ |
| class DerivedFromBuiltin | __mul__ | Builtin-method __mul__ |
| class DerivedFromBuiltin | __ne__ | Builtin-method __ne__ |
| class DerivedFromBuiltin | __new__ | Builtin-method __new__ |
| class DerivedFromBuiltin | __reduce__ | Builtin-method __reduce__ |
| class DerivedFromBuiltin | __reduce_ex__ | Builtin-method __reduce_ex__ |
| class DerivedFromBuiltin | __repr__ | Builtin-method __repr__ |
| class DerivedFromBuiltin | __reversed__ | Builtin-method __reversed__ |
| class DerivedFromBuiltin | __rmul__ | Builtin-method __rmul__ |
| class DerivedFromBuiltin | __setattr__ | Builtin-method __setattr__ |
| class DerivedFromBuiltin | __setitem__ | Builtin-method __setitem__ |
| class DerivedFromBuiltin | __setslice__ | Builtin-method __setslice__ |
| class DerivedFromBuiltin | __sizeof__ | Builtin-method __sizeof__ |
| class DerivedFromBuiltin | __str__ | Builtin-method __str__ |
| class DerivedFromBuiltin | __subclasshook__ | classmethod_descriptor __subclasshook__ |
| class DerivedFromBuiltin | append | Builtin-method append |
| class DerivedFromBuiltin | count | Builtin-method count |
| class DerivedFromBuiltin | extend | Builtin-method extend |
| class DerivedFromBuiltin | index | Builtin-method index |
| class DerivedFromBuiltin | insert | Builtin-method insert |
| class DerivedFromBuiltin | meth5 | Function meth5 |
| class DerivedFromBuiltin | pop | Builtin-method pop |
| class DerivedFromBuiltin | remove | Builtin-method remove |
| class DerivedFromBuiltin | reverse | Builtin-method reverse |
| class DerivedFromBuiltin | sort | Builtin-method sort |

View File

@@ -0,0 +1,16 @@
/**
* @name class_attr
* @kind test
* @problem.severity warning
*/
import python
from ClassObject cls, string name, Object what
where
(cls.getName() = "list" or
cls.getASuperType().getName() = "list"
)
and
cls.lookupAttribute(name) = what
select cls.toString(), name, what.toString()

View File

@@ -0,0 +1,39 @@
class DerivedFromBuiltin(list):
def meth5(self):
pass

View File

@@ -0,0 +1,18 @@
| class A | [A, BaseException, object] |
| class B | [B, X, object] |
| class C | [C, BaseException, object] |
| class D | [D, X, object] |
| class Meta | [Meta, type, object] |
| class N | [N, object, O] |
| class NewStyle | [NewStyle, object] |
| class NewStyleDerived | [NewStyleDerived, NewStyle, object] |
| class O | [O] |
| class Oddities | [Oddities, object] |
| class OldStyle | [OldStyle] |
| class OldStyleDerived | [OldStyleDerived, OldStyle] |
| class Sub | [Sub, Oddities, Unhashable, object] |
| class Unhashable | [Unhashable, object] |
| class W | [W, Y, X, object] |
| class WithMeta | [WithMeta, object] |
| class X | [X, object] |
| class Y | [Y, X, object] |

View File

@@ -0,0 +1,16 @@
import python
import semmle.python.pointsto.MRO
ClassList mro(ClassObject cls) {
if cls.isNewStyle() then
result = new_style_mro(cls)
else
result = old_style_mro(cls)
}
from ClassObject cls
where not cls.isBuiltin()
select cls.toString(), mro(cls)

View File

@@ -0,0 +1,28 @@
| class A | builtin-class BaseException | builtin-class object |
| class A | class A | builtin-class BaseException |
| class B | class B | class X |
| class B | class X | builtin-class object |
| class C | builtin-class BaseException | builtin-class object |
| class C | class C | builtin-class BaseException |
| class D | class D | class X |
| class D | class X | builtin-class object |
| class Meta | builtin-class type | builtin-class object |
| class Meta | class Meta | builtin-class type |
| class N | builtin-class object | class O |
| class N | class N | builtin-class object |
| class NewStyle | class NewStyle | builtin-class object |
| class NewStyleDerived | class NewStyle | builtin-class object |
| class NewStyleDerived | class NewStyleDerived | class NewStyle |
| class Oddities | class Oddities | builtin-class object |
| class OldStyleDerived | class OldStyleDerived | class OldStyle |
| class Sub | class Oddities | class Unhashable |
| class Sub | class Sub | class Oddities |
| class Sub | class Unhashable | builtin-class object |
| class Unhashable | class Unhashable | builtin-class object |
| class W | class W | class Y |
| class W | class X | builtin-class object |
| class W | class Y | class X |
| class WithMeta | class WithMeta | builtin-class object |
| class X | class X | builtin-class object |
| class Y | class X | builtin-class object |
| class Y | class Y | class X |

View File

@@ -0,0 +1,12 @@
/**
* @name class_attr
* @kind test
* @problem.severity warning
*/
import python
from ClassObject cls, ClassObject l, ClassObject r
where not cls.isC() and
r = cls.nextInMro(l)
select cls.toString(), l.toString(), r.toString()

View File

@@ -0,0 +1,123 @@
from undefined import unknown
k = 1
l = []
class OldStyle:
def meth1(self):
pass
a1 = k
a2 = l
a3 = unknown
l = l
class OldStyleDerived(OldStyle):
def meth2(self):
pass
class NewStyle(object):
def meth3(self):
pass
a1 = k
a2 = l
a3 = unknown
l = l
class NewStyleDerived(NewStyle):
def meth4(self):
pass
class Meta(type):
def __init__(cls, name, bases, dct):
type.__init__(cls, name, bases, dct)
cls.defined_in_meta = 1
def meth5(self):
pass
class WithMeta(object):
def meth6(self):
pass
a1 = k
a2 = l
a3 = unknown
l = l
#MRO tests
#Inconsistent MRO
class X(object):
pass
class Y(X):
pass
#Inconsistent MRO
class Z(X, Y):
pass
#Ok
class W(Y, X):
pass
class O:
pass
#This is OK
class N(object, O):
pass
#
# Assign builtin objects to class atttibutes
len = len
ord = 10
class Unhashable(object):
__hash__ = None
class Oddities(object):
int = int
float = float
l = len
h = hash
class Sub(Oddities, Unhashable):
pass
def nested_class():
class A(BaseException):
pass
class B(X):
pass
def NestedClass(object):
class C(BaseException):
pass
class D(X):
pass

View File

@@ -0,0 +1 @@
| 0 |

View File

@@ -0,0 +1,7 @@
/**
* Check that all Comprehensions have one toString(), one getLocation() and at least one flow node.
*/
import python
select count(Comprehension c | count(c.toString()) != 1 or count(c.getLocation()) != 1 or not exists(c.getAFlowNode()))

View File

@@ -0,0 +1,13 @@
from __future__ import print_function
def undefined_in_3():
[x for x in range(3)]
print(x)
def different_in_3():
y = 10
[y for y in range(3)]
print(y)
def ok():
[z for z in range(4)]

View File

@@ -0,0 +1,16 @@
/**
* @name All must have locations
* @description
* @kind problem
* @problem.severity error
*/
import python
from string classname
where
exists(AstNode node | not exists(node.getLocation()) and classname = node.getAQlClass())
or
exists(ControlFlowNode node | not exists(node.getLocation()) and classname = node.getAQlClass())
select classname

View File

@@ -0,0 +1,327 @@
| Assert | 8 | 9 | 8 | 21 |
| AssignStmt | 9 | 9 | 9 | 13 |
| AssignStmt | 42 | 9 | 42 | 16 |
| AssignStmt | 43 | 9 | 43 | 16 |
| AssignStmt | 44 | 9 | 44 | 17 |
| AssignStmt | 45 | 9 | 45 | 23 |
| Attribute | 43 | 13 | 43 | 16 |
| Attribute | 54 | 20 | 54 | 22 |
| Attribute | 54 | 25 | 54 | 28 |
| AugAssign | 10 | 9 | 10 | 14 |
| AugAssign | 14 | 13 | 14 | 18 |
| BinaryExpr | 10 | 9 | 10 | 14 |
| BinaryExpr | 14 | 13 | 14 | 18 |
| BinaryExpr | 31 | 13 | 31 | 15 |
| BinaryExpr | 44 | 13 | 44 | 17 |
| BinaryExpr | 53 | 20 | 53 | 24 |
| BinaryExpr | 55 | 11 | 55 | 18 |
| BinaryExpr | 101 | 1 | 101 | 13 |
| BinaryExpr | 101 | 1 | 101 | 23 |
| BinaryExpr | 102 | 1 | 102 | 3 |
| BinaryExpr | 102 | 1 | 102 | 7 |
| BinaryExpr | 103 | 1 | 103 | 7 |
| BinaryExpr | 103 | 4 | 103 | 6 |
| Break | 12 | 13 | 12 | 17 |
| Bytes | 16 | 14 | 16 | 35 |
| Bytes | 26 | 15 | 26 | 21 |
| Bytes | 27 | 22 | 27 | 28 |
| Bytes | 28 | 19 | 28 | 24 |
| Bytes | 45 | 13 | 45 | 23 |
| Bytes | 46 | 32 | 46 | 35 |
| Bytes | 55 | 15 | 55 | 18 |
| Bytes | 66 | 1 | 67 | 23 |
| Bytes | 69 | 1 | 71 | 9 |
| Bytes | 73 | 1 | 75 | 3 |
| Bytes | 101 | 1 | 101 | 7 |
| Bytes | 101 | 11 | 101 | 13 |
| Bytes | 101 | 17 | 101 | 23 |
| Call | 17 | 9 | 17 | 11 |
| Call | 28 | 14 | 28 | 25 |
| Call | 37 | 19 | 37 | 29 |
| Call | 46 | 9 | 46 | 56 |
| Call | 55 | 29 | 55 | 34 |
| Call | 83 | 2 | 83 | 5 |
| Call | 102 | 5 | 102 | 7 |
| ClassDef | 4 | 1 | 4 | 8 |
| ClassExpr | 4 | 1 | 4 | 8 |
| ClassMetrics | 4 | 1 | 4 | 8 |
| Compare | 8 | 16 | 8 | 21 |
| Compare | 13 | 15 | 13 | 19 |
| Compare | 47 | 9 | 47 | 13 |
| Compare | 52 | 15 | 52 | 19 |
| Continue | 15 | 13 | 15 | 20 |
| Delete | 33 | 13 | 33 | 17 |
| Delete | 35 | 13 | 35 | 17 |
| Dict | 46 | 54 | 46 | 55 |
| Dict | 48 | 9 | 48 | 19 |
| DictUnpacking | 46 | 52 | 46 | 55 |
| Ellipsis | 7 | 7 | 7 | 9 |
| Ellipsis | 50 | 14 | 50 | 16 |
| ExceptStmt | 32 | 9 | 32 | 31 |
| Exec | 16 | 9 | 16 | 35 |
| ExprStmt | 2 | 1 | 2 | 4 |
| ExprStmt | 3 | 1 | 3 | 6 |
| ExprStmt | 4 | 1 | 4 | 7 |
| ExprStmt | 5 | 1 | 5 | 9 |
| ExprStmt | 6 | 1 | 6 | 13 |
| ExprStmt | 7 | 1 | 7 | 14 |
| ExprStmt | 17 | 9 | 17 | 11 |
| ExprStmt | 31 | 13 | 31 | 15 |
| ExprStmt | 46 | 9 | 46 | 56 |
| ExprStmt | 47 | 9 | 47 | 13 |
| ExprStmt | 48 | 9 | 48 | 19 |
| ExprStmt | 50 | 9 | 50 | 20 |
| ExprStmt | 51 | 9 | 51 | 22 |
| ExprStmt | 51 | 10 | 51 | 10 |
| ExprStmt | 52 | 9 | 52 | 27 |
| ExprStmt | 53 | 9 | 53 | 24 |
| ExprStmt | 54 | 9 | 54 | 30 |
| ExprStmt | 55 | 9 | 55 | 36 |
| ExprStmt | 55 | 11 | 55 | 18 |
| ExprStmt | 56 | 9 | 56 | 11 |
| ExprStmt | 60 | 9 | 60 | 13 |
| ExprStmt | 61 | 9 | 61 | 12 |
| ExprStmt | 62 | 9 | 62 | 15 |
| ExprStmt | 63 | 9 | 63 | 19 |
| ExprStmt | 66 | 1 | 67 | 23 |
| ExprStmt | 69 | 1 | 71 | 9 |
| ExprStmt | 73 | 1 | 75 | 3 |
| ExprStmt | 77 | 1 | 80 | 3 |
| ExprStmt | 93 | 1 | 98 | 1 |
| ExprStmt | 93 | 2 | 95 | 3 |
| ExprStmt | 94 | 3 | 94 | 3 |
| ExprStmt | 101 | 1 | 101 | 23 |
| ExprStmt | 102 | 1 | 102 | 7 |
| ExprStmt | 103 | 1 | 103 | 7 |
| FastLocalsFunction | 41 | 5 | 41 | 22 |
| FastLocalsFunction | 51 | 10 | 51 | 21 |
| FastLocalsFunction | 53 | 9 | 53 | 24 |
| FastLocalsFunction | 55 | 9 | 55 | 36 |
| FastLocalsFunction | 84 | 1 | 84 | 8 |
| FastLocalsFunction | 88 | 1 | 88 | 12 |
| FastLocalsFunction | 89 | 5 | 89 | 16 |
| FastLocalsFunction | 93 | 1 | 98 | 1 |
| FastLocalsFunction | 93 | 2 | 95 | 3 |
| For | 18 | 9 | 18 | 19 |
| For | 51 | 10 | 51 | 21 |
| For | 55 | 9 | 55 | 36 |
| For | 93 | 1 | 98 | 1 |
| For | 93 | 2 | 95 | 3 |
| FunctionDef | 6 | 5 | 6 | 22 |
| FunctionDef | 41 | 5 | 41 | 22 |
| FunctionDef | 84 | 1 | 84 | 8 |
| FunctionDef | 88 | 1 | 88 | 12 |
| FunctionDef | 89 | 5 | 89 | 16 |
| FunctionExpr | 6 | 5 | 6 | 22 |
| FunctionExpr | 41 | 5 | 41 | 22 |
| FunctionExpr | 84 | 1 | 84 | 8 |
| FunctionExpr | 88 | 1 | 88 | 12 |
| FunctionExpr | 89 | 5 | 89 | 16 |
| FunctionMetrics | 6 | 5 | 6 | 22 |
| FunctionMetrics | 41 | 5 | 41 | 22 |
| FunctionMetrics | 51 | 10 | 51 | 21 |
| FunctionMetrics | 53 | 9 | 53 | 24 |
| FunctionMetrics | 55 | 9 | 55 | 36 |
| FunctionMetrics | 84 | 1 | 84 | 8 |
| FunctionMetrics | 88 | 1 | 88 | 12 |
| FunctionMetrics | 89 | 5 | 89 | 16 |
| FunctionMetrics | 93 | 1 | 98 | 1 |
| FunctionMetrics | 93 | 2 | 95 | 3 |
| GeneratorExp | 51 | 10 | 51 | 21 |
| Global | 7 | 9 | 7 | 16 |
| If | 20 | 9 | 20 | 13 |
| If | 36 | 9 | 36 | 13 |
| IfExp | 52 | 9 | 52 | 27 |
| Import | 22 | 9 | 22 | 16 |
| Import | 23 | 9 | 23 | 23 |
| Import | 24 | 9 | 24 | 21 |
| Import | 25 | 9 | 25 | 25 |
| ImportExpr | 22 | 16 | 22 | 16 |
| ImportExpr | 23 | 16 | 23 | 18 |
| ImportExpr | 24 | 16 | 24 | 16 |
| ImportExpr | 25 | 14 | 25 | 16 |
| ImportMember | 25 | 25 | 25 | 25 |
| ImportingStmt | 22 | 9 | 22 | 16 |
| ImportingStmt | 23 | 9 | 23 | 23 |
| ImportingStmt | 24 | 9 | 24 | 21 |
| ImportingStmt | 25 | 9 | 25 | 25 |
| IntegerLiteral | 2 | 3 | 2 | 3 |
| IntegerLiteral | 3 | 3 | 3 | 3 |
| IntegerLiteral | 3 | 5 | 3 | 5 |
| IntegerLiteral | 4 | 3 | 4 | 3 |
| IntegerLiteral | 4 | 6 | 4 | 6 |
| IntegerLiteral | 5 | 3 | 5 | 3 |
| IntegerLiteral | 5 | 6 | 5 | 6 |
| IntegerLiteral | 5 | 8 | 5 | 8 |
| IntegerLiteral | 6 | 3 | 6 | 3 |
| IntegerLiteral | 6 | 5 | 6 | 5 |
| IntegerLiteral | 6 | 8 | 6 | 9 |
| IntegerLiteral | 6 | 11 | 6 | 12 |
| IntegerLiteral | 7 | 3 | 7 | 4 |
| IntegerLiteral | 7 | 12 | 7 | 13 |
| IntegerLiteral | 8 | 21 | 8 | 21 |
| IntegerLiteral | 9 | 13 | 9 | 13 |
| IntegerLiteral | 10 | 14 | 10 | 14 |
| IntegerLiteral | 13 | 19 | 13 | 19 |
| IntegerLiteral | 14 | 18 | 14 | 18 |
| IntegerLiteral | 31 | 13 | 31 | 13 |
| IntegerLiteral | 31 | 15 | 31 | 15 |
| IntegerLiteral | 42 | 16 | 42 | 16 |
| IntegerLiteral | 44 | 13 | 44 | 13 |
| IntegerLiteral | 44 | 17 | 44 | 17 |
| IntegerLiteral | 48 | 10 | 48 | 10 |
| IntegerLiteral | 48 | 12 | 48 | 12 |
| IntegerLiteral | 48 | 15 | 48 | 15 |
| IntegerLiteral | 48 | 18 | 48 | 18 |
| IntegerLiteral | 50 | 19 | 50 | 19 |
| IntegerLiteral | 52 | 9 | 52 | 10 |
| IntegerLiteral | 52 | 26 | 52 | 27 |
| IntegerLiteral | 54 | 11 | 54 | 11 |
| IntegerLiteral | 54 | 14 | 54 | 14 |
| IntegerLiteral | 61 | 11 | 61 | 11 |
| IntegerLiteral | 62 | 13 | 62 | 13 |
| IntegerLiteral | 63 | 18 | 63 | 18 |
| IntegerLiteral | 102 | 1 | 102 | 1 |
| IntegerLiteral | 102 | 3 | 102 | 3 |
| IntegerLiteral | 103 | 1 | 103 | 1 |
| IntegerLiteral | 103 | 4 | 103 | 4 |
| IntegerLiteral | 103 | 6 | 103 | 6 |
| KeyValuePair | 48 | 10 | 48 | 12 |
| KeyValuePair | 48 | 15 | 48 | 18 |
| Keyword | 46 | 26 | 46 | 35 |
| Keyword | 46 | 38 | 46 | 44 |
| Lambda | 53 | 9 | 53 | 24 |
| List | 54 | 9 | 54 | 30 |
| ListComp | 55 | 9 | 55 | 36 |
| ListComp | 93 | 1 | 98 | 1 |
| ListComp | 93 | 2 | 95 | 3 |
| ModuleMetrics | 0 | 0 | 0 | 0 |
| Name | 2 | 1 | 2 | 1 |
| Name | 3 | 1 | 3 | 1 |
| Name | 4 | 1 | 4 | 1 |
| Name | 4 | 7 | 4 | 7 |
| Name | 5 | 1 | 5 | 1 |
| Name | 6 | 1 | 6 | 1 |
| Name | 6 | 9 | 6 | 13 |
| Name | 6 | 15 | 6 | 16 |
| Name | 6 | 19 | 6 | 20 |
| Name | 7 | 1 | 7 | 1 |
| Name | 8 | 16 | 8 | 16 |
| Name | 9 | 9 | 9 | 9 |
| Name | 10 | 9 | 10 | 9 |
| Name | 13 | 15 | 13 | 15 |
| Name | 14 | 13 | 14 | 13 |
| Name | 17 | 9 | 17 | 9 |
| Name | 18 | 13 | 18 | 13 |
| Name | 18 | 18 | 18 | 18 |
| Name | 20 | 12 | 20 | 12 |
| Name | 21 | 19 | 21 | 19 |
| Name | 22 | 16 | 22 | 16 |
| Name | 23 | 23 | 23 | 23 |
| Name | 24 | 21 | 24 | 21 |
| Name | 25 | 25 | 25 | 25 |
| Name | 27 | 18 | 27 | 19 |
| Name | 28 | 14 | 28 | 17 |
| Name | 28 | 30 | 28 | 30 |
| Name | 32 | 16 | 32 | 24 |
| Name | 32 | 29 | 32 | 30 |
| Name | 33 | 17 | 33 | 17 |
| Name | 35 | 17 | 35 | 17 |
| Name | 36 | 12 | 36 | 12 |
| Name | 37 | 19 | 37 | 27 |
| Name | 41 | 9 | 41 | 13 |
| Name | 41 | 15 | 41 | 16 |
| Name | 41 | 19 | 41 | 20 |
| Name | 42 | 9 | 42 | 10 |
| Name | 43 | 9 | 43 | 9 |
| Name | 43 | 13 | 43 | 14 |
| Name | 44 | 9 | 44 | 9 |
| Name | 45 | 9 | 45 | 9 |
| Name | 46 | 9 | 46 | 12 |
| Name | 46 | 14 | 46 | 17 |
| Name | 46 | 20 | 46 | 23 |
| Name | 46 | 44 | 46 | 44 |
| Name | 47 | 9 | 47 | 9 |
| Name | 47 | 13 | 47 | 13 |
| Name | 50 | 9 | 50 | 9 |
| Name | 50 | 11 | 50 | 11 |
| Name | 51 | 10 | 51 | 10 |
| Name | 51 | 10 | 51 | 21 |
| Name | 51 | 16 | 51 | 16 |
| Name | 51 | 21 | 51 | 21 |
| Name | 52 | 15 | 52 | 15 |
| Name | 52 | 19 | 52 | 19 |
| Name | 53 | 16 | 53 | 16 |
| Name | 53 | 20 | 53 | 20 |
| Name | 53 | 24 | 53 | 24 |
| Name | 54 | 17 | 54 | 17 |
| Name | 54 | 20 | 54 | 20 |
| Name | 54 | 25 | 54 | 26 |
| Name | 55 | 9 | 55 | 36 |
| Name | 55 | 11 | 55 | 11 |
| Name | 55 | 24 | 55 | 24 |
| Name | 55 | 29 | 55 | 31 |
| Name | 55 | 33 | 55 | 33 |
| Name | 56 | 10 | 56 | 10 |
| Name | 61 | 9 | 61 | 9 |
| Name | 62 | 9 | 62 | 9 |
| Name | 62 | 11 | 62 | 11 |
| Name | 63 | 10 | 63 | 11 |
| Name | 63 | 14 | 63 | 15 |
| Name | 83 | 2 | 83 | 5 |
| Name | 84 | 5 | 84 | 5 |
| Name | 88 | 5 | 88 | 9 |
| Name | 89 | 9 | 89 | 13 |
| Name | 93 | 1 | 98 | 1 |
| Name | 93 | 2 | 95 | 3 |
| Name | 94 | 3 | 94 | 3 |
| Name | 94 | 9 | 94 | 9 |
| Name | 94 | 14 | 94 | 14 |
| Name | 97 | 7 | 97 | 7 |
| Name | 97 | 12 | 97 | 12 |
| Name | 102 | 5 | 102 | 5 |
| Pass | 19 | 13 | 19 | 16 |
| Pass | 29 | 13 | 29 | 16 |
| Pass | 85 | 5 | 85 | 8 |
| Pass | 90 | 9 | 90 | 12 |
| Print | 21 | 13 | 21 | 19 |
| Print | 26 | 9 | 26 | 21 |
| Print | 27 | 9 | 27 | 28 |
| Raise | 37 | 13 | 37 | 29 |
| Repr | 56 | 9 | 56 | 11 |
| Return | 39 | 13 | 39 | 18 |
| Return | 53 | 20 | 53 | 24 |
| SelfAttributeStore | 42 | 9 | 42 | 12 |
| Slice | 3 | 3 | 3 | 5 |
| Slice | 5 | 6 | 5 | 8 |
| Slice | 6 | 3 | 6 | 5 |
| Slice | 6 | 8 | 6 | 12 |
| Starred | 46 | 47 | 46 | 49 |
| Subscript | 2 | 1 | 2 | 4 |
| Subscript | 3 | 1 | 3 | 6 |
| Subscript | 4 | 1 | 4 | 7 |
| Subscript | 5 | 1 | 5 | 9 |
| Subscript | 6 | 1 | 6 | 13 |
| Subscript | 7 | 1 | 7 | 14 |
| Subscript | 50 | 9 | 50 | 20 |
| Subscript | 61 | 9 | 61 | 12 |
| Subscript | 62 | 9 | 62 | 15 |
| Subscript | 62 | 11 | 62 | 14 |
| True | 11 | 15 | 11 | 18 |
| Try | 30 | 9 | 30 | 12 |
| Tuple | 4 | 3 | 4 | 6 |
| Tuple | 5 | 3 | 5 | 8 |
| Tuple | 6 | 3 | 6 | 12 |
| Tuple | 7 | 3 | 7 | 13 |
| Tuple | 46 | 48 | 46 | 49 |
| Tuple | 50 | 11 | 50 | 19 |
| Tuple | 63 | 10 | 63 | 18 |
| Unicode | 60 | 9 | 60 | 13 |
| Unicode | 77 | 1 | 80 | 3 |
| While | 11 | 9 | 11 | 19 |
| While | 13 | 9 | 13 | 20 |
| With | 28 | 9 | 28 | 31 |
| Yield | 51 | 10 | 51 | 10 |
| Yield | 55 | 11 | 55 | 18 |
| Yield | 93 | 2 | 95 | 3 |
| Yield | 94 | 3 | 94 | 3 |

View File

@@ -0,0 +1,6 @@
import python
from AstNode ast, Location l
where ast.getLocation() = l
select ast.getAQlClass(), l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn()

View File

@@ -0,0 +1,15 @@
| 16 | print('Hello World') | " |
| 26 | hello | " |
| 27 | hello | " |
| 28 | file | " |
| 45 | h4tpvhsa | b' |
| 46 | Hi | " |
| 55 | Hi | " |
| 60 | Hi | u" |
| 66 | \nSingle quotes string | ''' |
| 69 | \nDouble-quotes\nstring | """ |
| 73 | \nBytes\n | r''' |
| 77 | \nRaw\nUnicode\n | U""" |
| 101 | | " |
| 101 | Hello | " |
| 101 | world | " |

View File

@@ -0,0 +1,5 @@
import python
from StrConst s
select s.getLocation().getStartLine(), s.getText(), s.getPrefix()

View File

@@ -0,0 +1,8 @@
v[0]
w[1:2]
x[3, 4]
y[5, 6:7]
z[8:9, 10:11]
z[12, ..., 13]

View File

@@ -0,0 +1,2 @@
This file contains a syntax error!

View File

@@ -0,0 +1,103 @@
#AST nodes: Classes, Functions, Modules, expr, stmts
class C:
def stmts(p0, p1):
global x
assert x == 2
y = 3
y += 4
while True:
break
while x > 0:
x -= 1
continue
exec "print('Hello World')"
f()
for x in y:
pass
if x:
print y
import a
import a.b as c
import a as b
from a.b import c
print "hello"
print >> fd, "hello"
with open("file") as f:
pass
try:
1/0
except Exception as ex:
del y
finally:
del x
if x:
raise Exception()
else:
return
def exprs(p2, p3):
p2.x = 2
a = p3.y
x = 1 + 2
y = b'h4tpvhsa'
call(arg0, arg1, name0="Hi", name1=y, *(), **{})
x < y
{1:1, 2: 2}
x[a, ..., 7]
(x for x in y)
17 if x < y else 16
lambda x : x * y
[ 1, 2, a, x.b, p1.c ]
[ a + "Hi" for a in str(y) ]
`x`
#a, *b = y
u"Hi"
x[0]
x[y[0]]
(p2, p3, 7)
#Some multiline strings
'''
Single quotes string'''
"""
Double-quotes
string"""
r'''
Bytes
'''
U"""
Raw
Unicode
"""
#Decorated function
@deco
def f():
pass
#Inner function (see ODASA-1774)
def outer():
def inner():
pass
#Oddly laid out comprehension
[[
x for x in y
]
for a in b
]
#Nested binary operations
"Hello" + " " + "world"
1+2+f()
1+(2+3)

View File

@@ -0,0 +1,3 @@
| 3 | 3 | 3 | 10 |
| 3 | 13 | 3 | 39 |
| 4 | 3 | 12 | 6 |

View File

@@ -0,0 +1,6 @@
import python
from Keyword k, Location l
where k.getLocation() = l
select l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn()

View File

@@ -0,0 +1,12 @@
#Keywords
f(name=val, spaced = val2)
f(multi
=
line)

View File

@@ -0,0 +1,12 @@
| 2 | 1 | 2 | 20 | Hello World |
| 5 | 1 | 6 | 7 | Goodbye World |
| 9 | 3 | 9 | 9 | ab |
| 12 | 2 | 12 | 8 | cd |
| 16 | 5 | 17 | 7 | ef |
| 21 | 1 | 21 | 8 | string |
| 24 | 1 | 24 | 10 | \n\n\n\n |
| 27 | 1 | 27 | 14 | \\u0123\\u1234 |
| 30 | 1 | 30 | 9 | word |
| 33 | 1 | 33 | 14 | \n\n\n\n0 |
| 36 | 1 | 39 | 3 | \nline 0\nline 1\n |
| 42 | 1 | 48 | 3 | \nline 2\nline 3\n\nline 4\nline 5\n |

View File

@@ -0,0 +1,51 @@
#Single line concat
"Hello " "World"
#Multi line concat with line continuation
"Goodbye " \
"World"
#Single line concat in list
[ "a" "b" ]
#Single line, looks like tuple, but is just parenthesized
("c" "d" )
#Multi line in list
[
'e'
'f'
]
#Simple String
"string"
#String with escapes
"\n\n\n\n"
#String with unicode escapes
'\u0123\u1234'
#Concat with empty String
'word' ''
#String with escapes and concatenation :
'\n\n\n\n' '0'
#Multiline string
'''
line 0
line 1
'''
#Multiline impicitly concatenated string
'''
line 2
line 3
''' '''
line 4
line 5
'''
#Implicitly concatenated

View File

@@ -0,0 +1,5 @@
import python
from StrConst s, int bl, int bc, int el, int ec
where s.getLocation().hasLocationInfo(_, bl, bc, el, ec)
select bl, bc, el, ec, s.getText()

View File

@@ -0,0 +1,3 @@
e = 5

View File

@@ -0,0 +1,3 @@
from .a import b as a
__name__ = "henry"

View File

@@ -0,0 +1,2 @@
b = 1

View File

@@ -0,0 +1,6 @@
class Wrong(object):
pass
d = Wrong()

View File

@@ -0,0 +1,15 @@
| Module confused_elements.__init__ | 1 | ImportExpr | 1 | bottom | relative | confused_elements.a |
| Module main | 1 | ImportExpr | -1 | top | absolute | package |
| Module main | 2 | ImportExpr | -1 | top | absolute | helper |
| Module main | 3 | ImportExpr | -1 | top | absolute | package |
| Module main | 5 | ImportExpr | -1 | bottom | absolute | confused_elements |
| Module main | 7 | ImportExpr | -1 | top | absolute | sys |
| Module package.__init__ | 7 | ImportExpr | -1 | bottom | relative | package.helper |
| Module package.__init__ | 10 | ImportExpr | 1 | bottom | relative | package.helper |
| Module package.__init__ | 12 | ImportExpr | 1 | bottom | relative | package.assistant |
| Module package.__init__ | 15 | ImportExpr | -1 | top | relative | package.helper |
| Module package.helper | 1 | ImportExpr | 0 | bottom | absolute | __future__ |
| Module package.helper | 2 | ImportExpr | 0 | bottom | absolute | assistant |
| Module package.helper | 3 | ImportExpr | 0 | top | absolute | sys |
| Module package.helper | 10 | ImportExpr | 1 | bottom | relative | package |
| Module test_star | 1 | ImportExpr | -1 | bottom | absolute | test_package |

View File

@@ -0,0 +1,7 @@
import python
from ImportExpr ie, string m, string t, string r
where m = ie.getImportedModuleName() and
(if ie.isTop() then t = "top" else t = "bottom") and
(if ie.isRelative() then r= "relative" else r = "absolute")
select ie.getScope().toString(), ie.getLocation().getStartLine(), ie.toString(), ie.getLevel(), t, r, m

View File

@@ -0,0 +1,7 @@
import package
import helper
import package.assistant
#We expect that 'a' below will be 1 not a module.
from confused_elements import a
import sys

View File

@@ -0,0 +1,11 @@
| Module confused_elements | __name__ | str b'henry' |
| Module confused_elements | a | int 1 |
| Module package | __name__ | str b'package' |
| Module package | a | int 1 |
| Module package | assistant | Module package.assistant |
| Module package | b | int 2 |
| Module package | c | int 3 |
| Module package | d | int 4 |
| Module package | f | int 1 |
| Module package | g | int 7 |
| Module package | helper | Module package.helper |

View File

@@ -0,0 +1,6 @@
import python
from ModuleObject m, string name
where m.getName() = "package" or m.getName() = "confused_elements"
select m.toString(), name, m.getAttribute(name).toString()

View File

@@ -0,0 +1,15 @@
a = 1
b = 2
c = 3
#Implicit relative import
from helper import d
#Explicit relative import
from .helper import g
from .assistant import f
#This will be an implicit relative import (in Python 2)
import helper

View File

@@ -0,0 +1,7 @@
class Wrong(object):
pass
e = Wrong()
f = 1

View File

@@ -0,0 +1,10 @@
from __future__ import absolute_import
from assistant import e
import sys
d = 4
g = 7
from . import assistant

View File

@@ -0,0 +1 @@
from test_package import *

View File

@@ -0,0 +1 @@
semmle-extractor-options: --max-import-depth=3

View File

@@ -0,0 +1,57 @@
| Module test | __name__ | str b'test' |
| Module test | _private | int 1 |
| Module test | module2 | Module test_package.module2 |
| Module test | sys | Module sys |
| Module test | test_package | Module test_package |
| Module test_package | __name__ | str b'test_package' |
| Module test_package | a | int 1 |
| Module test_package | b | int 2 |
| Module test_package | c | int 3 |
| Module test_package | module1 | Module test_package.module1 |
| Module test_package | module2 | Module test_package.module2 |
| Module test_package | module3 | Module test_package.module3 |
| Module test_package | module4 | Module test_package.module4 |
| Module test_package | p | str b'p' |
| Module test_package | q | str b'q' |
| Module test_package | r | str b'r' |
| Module test_package | sys | Module sys |
| Module test_package.__init__ | __name__ | str b'test_package' |
| Module test_package.__init__ | a | int 1 |
| Module test_package.__init__ | b | int 2 |
| Module test_package.__init__ | c | int 3 |
| Module test_package.__init__ | p | str b'p' |
| Module test_package.__init__ | q | str b'q' |
| Module test_package.__init__ | r | str b'r' |
| Module test_package.__init__ | sys | Module sys |
| Module test_package.module1 | __all__ | List |
| Module test_package.module1 | __name__ | str b'test_package.module1' |
| Module test_package.module1 | a | int 1 |
| Module test_package.module1 | b | int 2 |
| Module test_package.module1 | c | int 3 |
| Module test_package.module1 | d | int 4 |
| Module test_package.module2 | __all__ | List |
| Module test_package.module2 | __name__ | str b'test_package.module2' |
| Module test_package.module2 | w | str b'w' |
| Module test_package.module2 | x | str b'x' |
| Module test_package.module2 | y | str b'y' |
| Module test_package.module2 | z | str b'z' |
| Module test_package.module3 | __name__ | str b'test_package.module3' |
| Module test_package.module3 | sys | Module sys |
| Module test_package.module4 | __all__ | List |
| Module test_package.module4 | __name__ | str b'test_package.module4' |
| Module test_package.module4 | p | str b'p' |
| Module test_package.module4 | q | str b'q' |
| Module test_package.module4 | r | str b'r' |
| Module test_package.module4 | s | str b's' |
| Module test_star | __name__ | str b'test_star' |
| Module test_star | a | int 1 |
| Module test_star | b | int 2 |
| Module test_star | c | int 3 |
| Module test_star | module1 | Module test_package.module1 |
| Module test_star | module2 | Module test_package.module2 |
| Module test_star | module3 | Module test_package.module3 |
| Module test_star | module4 | Module test_package.module4 |
| Module test_star | p | str b'p' |
| Module test_star | q | str b'q' |
| Module test_star | r | str b'r' |
| Module test_star | sys | Module sys |

View File

@@ -0,0 +1,5 @@
import python
from ModuleObject m, string name
where not m.isC()
select m.toString(), name, m.getAttribute(name).toString()

View File

@@ -0,0 +1,42 @@
| Module test | module2 |
| Module test | sys |
| Module test | test_package |
| Module test_package | a |
| Module test_package | b |
| Module test_package | c |
| Module test_package | module1 |
| Module test_package | module2 |
| Module test_package | module3 |
| Module test_package | module4 |
| Module test_package | p |
| Module test_package | q |
| Module test_package | r |
| Module test_package | sys |
| Module test_package.__init__ | a |
| Module test_package.__init__ | b |
| Module test_package.__init__ | c |
| Module test_package.__init__ | p |
| Module test_package.__init__ | q |
| Module test_package.__init__ | r |
| Module test_package.__init__ | sys |
| Module test_package.module1 | a |
| Module test_package.module1 | b |
| Module test_package.module1 | c |
| Module test_package.module2 | x |
| Module test_package.module2 | y |
| Module test_package.module2 | z |
| Module test_package.module3 | sys |
| Module test_package.module4 | p |
| Module test_package.module4 | q |
| Module test_package.module4 | r |
| Module test_star | a |
| Module test_star | b |
| Module test_star | c |
| Module test_star | module1 |
| Module test_star | module2 |
| Module test_star | module3 |
| Module test_star | module4 |
| Module test_star | p |
| Module test_star | q |
| Module test_star | r |
| Module test_star | sys |

View File

@@ -0,0 +1,5 @@
import python
from ModuleObject m, string name
where not m.isC() and m.exports(name)
select m.toString(), name

View File

@@ -0,0 +1,8 @@
| Module test | test |
| Module test_package | test_package |
| Module test_package.__init__ | test_package.__init__ |
| Module test_package.module1 | test_package.module1 |
| Module test_package.module2 | test_package.module2 |
| Module test_package.module3 | test_package.module3 |
| Module test_package.module4 | test_package.module4 |
| Module test_star | test_star |

View File

@@ -0,0 +1,5 @@
import python
from ModuleObject m, string name
where not m.isC() and m.importedAs(name)
select m.toString(), name

View File

@@ -0,0 +1,31 @@
#Importing the package will execute its __init__.py module, filling in the namespace for the package.
import test_package
import sys
#These values now exist
test_package.a
test_package.b
test_package.c
#But this does not...
#test_package.d
#This doesn't exist either
#test_package.module2
#We can't do this as d is not a module
#from test_package import d
#When we do this test_package.module2 becomes defined
from test_package import module2
#Now these are defined
test_package.module2
module2
import test_package.module3
#Now this are defined
test_package.module3
_private = 1

View File

@@ -0,0 +1,3 @@
from .module1 import *
from module4 import *
import sys

View File

@@ -0,0 +1,6 @@
__all__ = [ 'a', 'b', 'c' ]
a = 1
b = 2
c = 3
d = 4

View File

@@ -0,0 +1,6 @@
__all__ = [ 'x', 'y', 'z']
w = 'w'
x = 'x'
y = 'y'
z = 'z'

View File

@@ -0,0 +1 @@
import sys

View File

@@ -0,0 +1,6 @@
__all__ = [ 'p', 'q', 'r']
p = 'p'
q = 'q'
r = 'r'
s = 's'

View File

@@ -0,0 +1,3 @@
#Importing the package will execute its __init__.py module, filling in the namespace for the package.
from test_package import *

View File

@@ -0,0 +1,16 @@
/* Test that there are no literals that do not have a corresponding object. */
import python
string repr(Expr e) {
result = e.(Num).getN() or
result = e.(Bytes).getS() or
result = e.(Unicode).getS()
}
from ImmutableLiteral l
where
not exists(l.getLiteralObject())
select l.getLocation().getStartLine(), repr(l)

View File

@@ -0,0 +1,5 @@
0666
01
1L
4987312561856745907287624786230562734672583763984576267L

View File

@@ -0,0 +1 @@
automatic_locations: true

View File

@@ -0,0 +1,2 @@
semmle-extractor-options: --max-import-depth=3
optimize: true

View File

@@ -0,0 +1,3 @@
| six | Module six |
| six.moves | Module six.moves |
| six.moves.range | builtin-class xrange |

View File

@@ -0,0 +1,15 @@
import python
string longname(Expr e) {
result = e.(Name).getId()
or
exists(Attribute a |
a = e |
result = longname(a.getObject()) + "." + a.getName()
)
}
from Expr e, Object o
where e.refersTo(o) and e.getLocation().getFile().getShortName() = "test.py"
select longname(e), o.toString()

View File

@@ -0,0 +1,262 @@
| Module six | BytesIO | class StringIO |
| Module six | Iterator | class Iterator |
| Module six | MAXSIZE | int() |
| Module six | PY2 | bool True |
| Module six | PY3 | bool False |
| Module six | StringIO | class StringIO |
| Module six | __author__ | str b'Benjamin Peterson <benjamin@python.org>' |
| Module six | __name__ | str b'six' |
| Module six | __version__ | str b'1.5.2' |
| Module six | _add_doc | Function _add_doc |
| Module six | _func_closure | str b'func_closure' |
| Module six | _func_code | str b'func_code' |
| Module six | _func_defaults | str b'func_defaults' |
| Module six | _func_globals | str b'func_globals' |
| Module six | _import_module | Function _import_module |
| Module six | _iteritems | str b'iteritems' |
| Module six | _iterkeys | str b'iterkeys' |
| Module six | _iterlists | str b'iterlists' |
| Module six | _itervalues | str b'itervalues' |
| Module six | _meth_func | str b'im_func' |
| Module six | _meth_self | str b'im_self' |
| Module six | add_metaclass | Function add_metaclass |
| Module six | add_move | Function add_move |
| Module six | advance_iterator | Builtin-function next |
| Module six | b | Function b |
| Module six | binary_type | builtin-class str |
| Module six | byte2int | Function byte2int |
| Module six | callable | Builtin-function callable |
| Module six | callable | Function callable |
| Module six | class_types | Tuple |
| Module six | create_bound_method | Function create_bound_method |
| Module six | exec_ | Function exec_ |
| Module six | get_function_closure | Attribute() |
| Module six | get_function_code | Attribute() |
| Module six | get_function_defaults | Attribute() |
| Module six | get_function_globals | Attribute() |
| Module six | get_method_function | Attribute() |
| Module six | get_method_self | Attribute() |
| Module six | get_unbound_function | Function get_unbound_function |
| Module six | indexbytes | Function indexbytes |
| Module six | int2byte | Builtin-function chr |
| Module six | integer_types | Tuple |
| Module six | iterbytes | Function iterbytes |
| Module six | iteritems | Function iteritems |
| Module six | iterkeys | Function iterkeys |
| Module six | iterlists | Function iterlists |
| Module six | itervalues | Function itervalues |
| Module six | moves | Module six.moves |
| Module six | next | Builtin-function next |
| Module six | operator | Module operator |
| Module six | remove_move | Function remove_move |
| Module six | reraise | Function reraise |
| Module six | string_types | Tuple |
| Module six | sys | Module sys |
| Module six | text_type | builtin-class unicode |
| Module six | types | Module types |
| Module six | u | Function u |
| Module six | unichr | Builtin-function unichr |
| Module six | with_metaclass | Function with_metaclass |
| Module six.__init__ | BytesIO | class StringIO |
| Module six.__init__ | Iterator | class Iterator |
| Module six.__init__ | MAXSIZE | int() |
| Module six.__init__ | PY2 | bool True |
| Module six.__init__ | PY3 | bool False |
| Module six.__init__ | StringIO | class StringIO |
| Module six.__init__ | __author__ | str b'Benjamin Peterson <benjamin@python.org>' |
| Module six.__init__ | __name__ | str b'six' |
| Module six.__init__ | __version__ | str b'1.5.2' |
| Module six.__init__ | _add_doc | Function _add_doc |
| Module six.__init__ | _func_closure | str b'func_closure' |
| Module six.__init__ | _func_code | str b'func_code' |
| Module six.__init__ | _func_defaults | str b'func_defaults' |
| Module six.__init__ | _func_globals | str b'func_globals' |
| Module six.__init__ | _import_module | Function _import_module |
| Module six.__init__ | _iteritems | str b'iteritems' |
| Module six.__init__ | _iterkeys | str b'iterkeys' |
| Module six.__init__ | _iterlists | str b'iterlists' |
| Module six.__init__ | _itervalues | str b'itervalues' |
| Module six.__init__ | _meth_func | str b'im_func' |
| Module six.__init__ | _meth_self | str b'im_self' |
| Module six.__init__ | add_metaclass | Function add_metaclass |
| Module six.__init__ | add_move | Function add_move |
| Module six.__init__ | advance_iterator | Builtin-function next |
| Module six.__init__ | b | Function b |
| Module six.__init__ | binary_type | builtin-class str |
| Module six.__init__ | byte2int | Function byte2int |
| Module six.__init__ | callable | Builtin-function callable |
| Module six.__init__ | callable | Function callable |
| Module six.__init__ | class_types | Tuple |
| Module six.__init__ | create_bound_method | Function create_bound_method |
| Module six.__init__ | exec_ | Function exec_ |
| Module six.__init__ | get_function_closure | Attribute() |
| Module six.__init__ | get_function_code | Attribute() |
| Module six.__init__ | get_function_defaults | Attribute() |
| Module six.__init__ | get_function_globals | Attribute() |
| Module six.__init__ | get_method_function | Attribute() |
| Module six.__init__ | get_method_self | Attribute() |
| Module six.__init__ | get_unbound_function | Function get_unbound_function |
| Module six.__init__ | indexbytes | Function indexbytes |
| Module six.__init__ | int2byte | Builtin-function chr |
| Module six.__init__ | integer_types | Tuple |
| Module six.__init__ | iterbytes | Function iterbytes |
| Module six.__init__ | iteritems | Function iteritems |
| Module six.__init__ | iterkeys | Function iterkeys |
| Module six.__init__ | iterlists | Function iterlists |
| Module six.__init__ | itervalues | Function itervalues |
| Module six.__init__ | moves | Module six.moves |
| Module six.__init__ | next | Builtin-function next |
| Module six.__init__ | operator | Module operator |
| Module six.__init__ | remove_move | Function remove_move |
| Module six.__init__ | reraise | Function reraise |
| Module six.__init__ | string_types | Tuple |
| Module six.__init__ | sys | Module sys |
| Module six.__init__ | text_type | builtin-class unicode |
| Module six.__init__ | types | Module types |
| Module six.__init__ | u | Function u |
| Module six.__init__ | unichr | Builtin-function unichr |
| Module six.__init__ | with_metaclass | Function with_metaclass |
| Module six.moves | BaseHTTPServer | Module BaseHTTPServer |
| Module six.moves | CGIHTTPServer | Module CGIHTTPServer |
| Module six.moves | PY2 | bool True |
| Module six.moves | PY3 | bool False |
| Module six.moves | SimpleHTTPServer | Module SimpleHTTPServer |
| Module six.moves | StringIO | class StringIO |
| Module six.moves | UserDict | class UserDict |
| Module six.moves | __name__ | str b'six.moves' |
| Module six.moves | _dummy_thread | Module dummy_thread |
| Module six.moves | _thread | Module thread |
| Module six.moves | builtins | Module __builtin__ |
| Module six.moves | cPickle | Module cPickle |
| Module six.moves | cStringIO | Builtin-function StringIO |
| Module six.moves | configparser | Module ConfigParser |
| Module six.moves | copyreg | Module copy_reg |
| Module six.moves | filter | builtin-class itertools.ifilter |
| Module six.moves | filterfalse | builtin-class itertools.ifilterfalse |
| Module six.moves | html_entities | Module htmlentitydefs |
| Module six.moves | html_parser | Module HTMLParser |
| Module six.moves | http_client | Module httplib |
| Module six.moves | http_cookiejar | Module cookielib |
| Module six.moves | http_cookies | Module Cookie |
| Module six.moves | input | Builtin-function raw_input |
| Module six.moves | intern | Builtin-function intern |
| Module six.moves | map | builtin-class itertools.imap |
| Module six.moves | queue | Module Queue |
| Module six.moves | range | builtin-class xrange |
| Module six.moves | reduce | Builtin-function reduce |
| Module six.moves | reload_module | Builtin-function reload |
| Module six.moves | reprlib | Module repr |
| Module six.moves | shlex_quote | Function quote |
| Module six.moves | socketserver | Module SocketServer |
| Module six.moves | tkinter | Module Tkinter |
| Module six.moves | tkinter_colorchooser | Module tkColorChooser |
| Module six.moves | tkinter_commondialog | Module tkCommonDialog |
| Module six.moves | tkinter_constants | Module Tkconstants |
| Module six.moves | tkinter_dialog | Module Dialog |
| Module six.moves | tkinter_dnd | Module Tkdnd |
| Module six.moves | tkinter_filedialog | Module FileDialog |
| Module six.moves | tkinter_font | Module tkFont |
| Module six.moves | tkinter_messagebox | Module tkMessageBox |
| Module six.moves | tkinter_scrolledtext | Module ScrolledText |
| Module six.moves | tkinter_simpledialog | Module SimpleDialog |
| Module six.moves | tkinter_tix | Module Tix |
| Module six.moves | tkinter_tkfiledialog | Module tkFileDialog |
| Module six.moves | tkinter_tksimpledialog | Module tkSimpleDialog |
| Module six.moves | tkinter_ttk | Module ttk |
| Module six.moves | urllib | Module six.moves.urllib |
| Module six.moves | urllib_error | Module six.moves.urllib_error |
| Module six.moves | urllib_parse | Module six.moves.urllib_parse |
| Module six.moves | urllib_request | Module six.moves.urllib_request |
| Module six.moves | urllib_response | Module six.moves.urllib_response |
| Module six.moves | urllib_robotparser | Module six.moves.urllib_robotparser |
| Module six.moves | xmlrpc_client | Module xmlrpclib |
| Module six.moves | xmlrpc_server | Module SimpleXMLRPCServer |
| Module six.moves | xrange | builtin-class xrange |
| Module six.moves | zip | builtin-class itertools.izip |
| Module six.moves | zip_longest | builtin-class itertools.izip_longest |
| Module six.moves.__init__ | BaseHTTPServer | Module BaseHTTPServer |
| Module six.moves.__init__ | CGIHTTPServer | Module CGIHTTPServer |
| Module six.moves.__init__ | PY2 | bool True |
| Module six.moves.__init__ | PY3 | bool False |
| Module six.moves.__init__ | SimpleHTTPServer | Module SimpleHTTPServer |
| Module six.moves.__init__ | StringIO | class StringIO |
| Module six.moves.__init__ | UserDict | class UserDict |
| Module six.moves.__init__ | __name__ | str b'six.moves' |
| Module six.moves.__init__ | _dummy_thread | Module dummy_thread |
| Module six.moves.__init__ | _thread | Module thread |
| Module six.moves.__init__ | builtins | Module __builtin__ |
| Module six.moves.__init__ | cPickle | Module cPickle |
| Module six.moves.__init__ | cStringIO | Builtin-function StringIO |
| Module six.moves.__init__ | configparser | Module ConfigParser |
| Module six.moves.__init__ | copyreg | Module copy_reg |
| Module six.moves.__init__ | filter | builtin-class itertools.ifilter |
| Module six.moves.__init__ | filterfalse | builtin-class itertools.ifilterfalse |
| Module six.moves.__init__ | html_entities | Module htmlentitydefs |
| Module six.moves.__init__ | html_parser | Module HTMLParser |
| Module six.moves.__init__ | http_client | Module httplib |
| Module six.moves.__init__ | http_cookiejar | Module cookielib |
| Module six.moves.__init__ | http_cookies | Module Cookie |
| Module six.moves.__init__ | input | Builtin-function raw_input |
| Module six.moves.__init__ | intern | Builtin-function intern |
| Module six.moves.__init__ | map | builtin-class itertools.imap |
| Module six.moves.__init__ | queue | Module Queue |
| Module six.moves.__init__ | range | builtin-class xrange |
| Module six.moves.__init__ | reduce | Builtin-function reduce |
| Module six.moves.__init__ | reload_module | Builtin-function reload |
| Module six.moves.__init__ | reprlib | Module repr |
| Module six.moves.__init__ | shlex_quote | Function quote |
| Module six.moves.__init__ | socketserver | Module SocketServer |
| Module six.moves.__init__ | tkinter | Module Tkinter |
| Module six.moves.__init__ | tkinter_colorchooser | Module tkColorChooser |
| Module six.moves.__init__ | tkinter_commondialog | Module tkCommonDialog |
| Module six.moves.__init__ | tkinter_constants | Module Tkconstants |
| Module six.moves.__init__ | tkinter_dialog | Module Dialog |
| Module six.moves.__init__ | tkinter_dnd | Module Tkdnd |
| Module six.moves.__init__ | tkinter_filedialog | Module FileDialog |
| Module six.moves.__init__ | tkinter_font | Module tkFont |
| Module six.moves.__init__ | tkinter_messagebox | Module tkMessageBox |
| Module six.moves.__init__ | tkinter_scrolledtext | Module ScrolledText |
| Module six.moves.__init__ | tkinter_simpledialog | Module SimpleDialog |
| Module six.moves.__init__ | tkinter_tix | Module Tix |
| Module six.moves.__init__ | tkinter_tkfiledialog | Module tkFileDialog |
| Module six.moves.__init__ | tkinter_tksimpledialog | Module tkSimpleDialog |
| Module six.moves.__init__ | tkinter_ttk | Module ttk |
| Module six.moves.__init__ | urllib | Module six.moves.urllib |
| Module six.moves.__init__ | urllib_error | Module six.moves.urllib_error |
| Module six.moves.__init__ | urllib_parse | Module six.moves.urllib_parse |
| Module six.moves.__init__ | urllib_request | Module six.moves.urllib_request |
| Module six.moves.__init__ | urllib_response | Module six.moves.urllib_response |
| Module six.moves.__init__ | urllib_robotparser | Module six.moves.urllib_robotparser |
| Module six.moves.__init__ | xmlrpc_client | Module xmlrpclib |
| Module six.moves.__init__ | xmlrpc_server | Module SimpleXMLRPCServer |
| Module six.moves.__init__ | xrange | builtin-class xrange |
| Module six.moves.__init__ | zip | builtin-class itertools.izip |
| Module six.moves.__init__ | zip_longest | builtin-class itertools.izip_longest |
| Module six.moves.urllib | __name__ | str b'six.moves.urllib' |
| Module six.moves.urllib | error | Module six.moves.urllib_error |
| Module six.moves.urllib | parse | Module six.moves.urllib_parse |
| Module six.moves.urllib | request | Module six.moves.urllib_request |
| Module six.moves.urllib | response | Module six.moves.urllib_response |
| Module six.moves.urllib | robotparser | Module six.moves.urllib_robotparser |
| Module six.moves.urllib.__init__ | __name__ | str b'six.moves.urllib' |
| Module six.moves.urllib.__init__ | error | Module six.moves.urllib_error |
| Module six.moves.urllib.__init__ | parse | Module six.moves.urllib_parse |
| Module six.moves.urllib.__init__ | request | Module six.moves.urllib_request |
| Module six.moves.urllib.__init__ | response | Module six.moves.urllib_response |
| Module six.moves.urllib.__init__ | robotparser | Module six.moves.urllib_robotparser |
| Module six.moves.urllib_error | PY2 | bool True |
| Module six.moves.urllib_error | PY3 | bool False |
| Module six.moves.urllib_error | __name__ | str b'six.moves.urllib_error' |
| Module six.moves.urllib_parse | PY2 | bool True |
| Module six.moves.urllib_parse | PY3 | bool False |
| Module six.moves.urllib_parse | __name__ | str b'six.moves.urllib_parse' |
| Module six.moves.urllib_request | PY2 | bool True |
| Module six.moves.urllib_request | PY3 | bool False |
| Module six.moves.urllib_request | __name__ | str b'six.moves.urllib_request' |
| Module six.moves.urllib_response | PY2 | bool True |
| Module six.moves.urllib_response | PY3 | bool False |
| Module six.moves.urllib_response | __name__ | str b'six.moves.urllib_response' |
| Module six.moves.urllib_robotparser | PY2 | bool True |
| Module six.moves.urllib_robotparser | PY3 | bool False |
| Module six.moves.urllib_robotparser | RobotFileParser | class RobotFileParser |
| Module six.moves.urllib_robotparser | __name__ | str b'six.moves.urllib_robotparser' |

Some files were not shown because too many files have changed in this diff Show More