http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import73.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import73.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import73.py new file mode 100644 index 0000000..2a00c78 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import73.py @@ -0,0 +1,9 @@ +class AbstractLib: + "" + def __init__(self): + pass + + def abstract(self): + "This is doc" + "this is an expression, sneaky" + raise NotImplementedError("This method must be overridden")
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import98.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import98.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import98.py new file mode 100644 index 0000000..99975c7 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/import98.py @@ -0,0 +1,11 @@ +__doc__ = 'Auxiliary file for test98.py' + +class BaseGood: + 'Nice base init' + def __init__(self): + return + +class BaseBad: + 'Error should print as coming from this file' + def __init__(self): + return 42 http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/pycheckrc ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/pycheckrc b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/pycheckrc new file mode 100644 index 0000000..a242dbf --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/pycheckrc @@ -0,0 +1,7 @@ + +suppressions = { 'test39': 'no-moduledoc', 'test39.func2': 'funcdoc', + 'test39.X1': 'no-classdoc', 'test39.X2.x': 'self="s"' } + +suppressionRegexs = { 'test39.Y.': 'no-classdoc', + 'test39.Y..a': 'funcdoc', + 'test39.NewStyle.f': 'no-local' } http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test1.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test1.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test1.py new file mode 100644 index 0000000..d4df718 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test1.py @@ -0,0 +1,75 @@ + +import imp +import re + +_NOT_USED1 = None +NOT_USED2 = None + +def getModules(n = 0, j = 3) : + "Return list of modules by removing .py from each entry." + for m in unknownList : + pass + +def jjj(self) : + import sys + print sys.argv + +def jjj2(a, b = None, c = None) : + pass + +def ddd(a, *args): + jjj2() + jjj2(1) + jjj2(1, 2) + jjj2(1, 2, 3) + jjj2(1, 2, 3, 4) + +def ppp(): + ddd() + ddd(1) + ddd(1, 2) + ddd(1, 2, 3) + +class X: + def __init__(self) : + print sys.argv + print self.__class__, self.__doc__, self.__dict__, self.__x__, self.x + self.y = 0 + print self.y + def r(sf): + nofunc() + for i in range(0, len(self.a)) : + jjj(1, 2, 3, k=5) + +class Y(X): + def xxx(self, adf) : + asdf = adf + # jjjj doesn't exist + j = jjjj + # z() doesn't exist + self.z() + adf.mmm.kkk() + # j doesn't exist + self.j = 0 + self.xxx(1, 2) + +def uuu(): + a=1+2 + return a[0], [['a', 'b'], [1,2,3,4]] + +def renderElement(a, b=2, c=3, **kw): + contents = kw + print contents + +def renderItem(text): + return renderElement(1, contents=text, z=1, y=2, x=3) + +def test_kw_lambda(a, b, c): + return renderElement(a, ff=lambda value: '=' + renderItem(b)) + +str = '53' +_ = "blah, don't care, shouldn't warn" + +def getOneImageFromPath(k, v): + d = [] + d.append(id=k, original_flag=v) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test10.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test10.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test10.py new file mode 100644 index 0000000..1546479 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test10.py @@ -0,0 +1,8 @@ +"doc" + +from xml.sax import saxutils + +def afunc(): + stuff = saxutils.escape.make_parser('junk') + return stuff + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test100.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test100.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test100.py new file mode 100644 index 0000000..aced842 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test100.py @@ -0,0 +1,15 @@ +# https://sourceforge.net/tracker/index.php?func=detail&aid=1563494&group_id=24686&atid=382217 +# see zope.interface.declarations.Declaration +# for a real-world one line test, pycheck "import zope.interface.declarations" + +'d' +class D: + 'd' + __bases__ = () + + # this repr avoids getting the default repr, which shows an id + # which changes between test runs + __repr__ = classmethod(lambda cls: 'D') + +# instantiating triggers the bug +d = D() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test101.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test101.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test101.py new file mode 100644 index 0000000..fda76f3 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test101.py @@ -0,0 +1,33 @@ +# -*- Mode: Python -*- +# vi:si:et:sw=4:sts=4:ts=4 + +# see https://sourceforge.net/tracker/index.php?func=detail&aid=1563495&group_id=24686&atid=382217 + +'d' + +__pychecker__ = 'blacklist=wrongname' + +import os +import imp +import tempfile + +code = """ +class C: + pass + +c = C() +""" + +# create a temporary file for the module +(fd, path) = tempfile.mkstemp() +os.write(fd, code) +os.close(fd) + +temp = imp.load_source('temp', path) + +# change class's module to trigger the error +temp.C.__module__ = 'wrongname' + +# clean up +os.unlink(path) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test102.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test102.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test102.py new file mode 100644 index 0000000..46c659c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test102.py @@ -0,0 +1,16 @@ + +"""This used to be a problem for code that assumed __bases__ existed.""" + +class GetattrReturnsNone(object): + """This requires a new-style class.""" + def __getattr__(self, unused_name): + return None + +dummy1 = GetattrReturnsNone() + +class GetattrReturnsStr(object): + """This requires a new-style class.""" + def __getattr__(self, unused_name): + return 'abc' + +dummy2 = GetattrReturnsStr() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test11.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test11.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test11.py new file mode 100644 index 0000000..8ee8365 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test11.py @@ -0,0 +1,20 @@ +"doc" + +class Test: + "'No attribute (alias) found' warning should not be generated" + + def __init__(self): + self.alias() + + def real(self): + pass + + alias = real + + +def rcParseTest(a = 10, b = 'ten', c = (5, 5)): + print '%s, %s, %s' % (a, b, str(c)) + +def a(i): + [0, 1, 3].index(i) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test12.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test12.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test12.py new file mode 100644 index 0000000..a5eae7d --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test12.py @@ -0,0 +1,8 @@ +"shouldn't produce any warnings" + +from xml.sax import handler + +class GetGUI(handler.DTDHandler): + "shouldn't produce any warnings" + pass + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test13.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test13.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test13.py new file mode 100644 index 0000000..c8a19a7 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test13.py @@ -0,0 +1,30 @@ + +"global test" + +def test1(): + 'without -g option, this should be the only warning for x' + global x + x = 90 + +def test2(): + 'with -g option, this should be also generate a warning for x' + global x + x = 90 + +def test3(): + 'with -g option, this should be also generate a warning for x' + global x + x = 90 + +def test4(): + 'without -g option, this should be the only warning for xxx' + print xxx + +def test5(): + 'with -g option, this should be also generate a warning for xxx' + print xxx + +def test6(): + 'with -g option, this should be also generate a warning for xxx' + print xxx + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test14.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test14.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test14.py new file mode 100644 index 0000000..65f3ba9 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test14.py @@ -0,0 +1,24 @@ +"doesn't work in 1.5.2" + +import string +import string as nn + +used = '' +_unused = 0 + +def yyy(): + import string as jj + +if nn.lower('aa') == '': + pass +if string.lower(used) == '': + pass + +if 1 : + _noglobal = 0 + +import xml.sax as sax + +def zzz(): + print sax + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test15.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test15.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test15.py new file mode 100644 index 0000000..426e7bc --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test15.py @@ -0,0 +1,39 @@ +"doc" + +def xx(**kw): + return None + +def yy(): + c = yy + g, h = 1, 2 + xx(a='', b=c.a.d.f, e=5, jj=xx(j=5), f=(g+h), k=("%s" % "df")) + +def zz(): + b = zz + xx(b=(1, 2, 3), c={ 'a': b}, d=[1, 2, 3], k=(1 < 2)) + +def aa(obj): + print obj.x.y + print obj.x.y.z + print obj.x.y.z.a + print obj.x.y.z.a.b + print obj.x.y.z.a.b.c + +class Obj: + 'd' + def __init__(self, xx): + self.xx = xx + self.xx.y = 0 + self.xx.y.z = 0 + self.xx.y.z.a = 0 + self.xx.y.z.a.b = 0 + self.xx.y.z.a.b.c = 0 + + def prn(self): + print self.xx + print self.xx.y + print self.xx.y.z + print self.xx.y.z.a + print self.xx.y.z.a.b + print self.xx.y.z.a.b.c + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test16.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test16.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test16.py new file mode 100644 index 0000000..1362c2c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test16.py @@ -0,0 +1,19 @@ +"doc" + +import re +import sys +import glob + +class X: + 'doc' + global_var = re.compile('a') + def m(self, j = re.match): + print X.global_var + + def xxx(self, j = glob.glob): + print j + +def xxx(j = sys.path): + print j + + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test17.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test17.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test17.py new file mode 100644 index 0000000..7c08df3 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test17.py @@ -0,0 +1,35 @@ +'doc' + +class X: + 'should get a warning for returning value from __init__' + def __init__(self): + print 'howdy' + return 1 + +class Y: + 'should get a warning for returning value from __init__' + def __init__(self, x): + if x == 0 : + return 0 + if x == 1 : + return 53 + return None + +class Z: + 'should not get a warning' + def __init__(self, x): + return + + +class Q(Z): + 'd' + def __init__(self): + v = lambda : None + Z.__init__(self, v) + + +class S(Z): + 'd' + def __init__(self): + Z.__init__(self,lambda x: x in ['p','f']) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test18.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test18.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test18.py new file mode 100644 index 0000000..8a57eb1 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test18.py @@ -0,0 +1,44 @@ +'d' + +class A: + "d" + def __init__(self): pass + +class X: + "d" + def __init__(self, x): pass + +class Y: + "d" + def __init__(self, x, y, z): pass + +class Z: + "d" + def __init__(self, x, y, z, *args, **kw): pass + +def j(): + A() + A(1) + + X() + X(1) + X(1, 2) + X(1, 2, 3) + X(1, 2, 3, 4) + + Y() + Y(1) + Y(1, 2) + Y(1, 2, 3) + Y(1, 2, 3, 4) + + Z() + Z(1) + Z(1, 2) + Z(1, 2, 3) + Z(1, 2, 3, 4) + Z(1, 2, 3, 4, 5) + Z(1, 2, 3, 4, 5, 6) + Z(1, 2, 3, 4, k=1, j=2, m=3, f=5) + + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test19.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test19.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test19.py new file mode 100644 index 0000000..e57bf55 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test19.py @@ -0,0 +1,10 @@ +'d' + +import UserDict + +def y(): + UserDict.UserDict() + UserDict.UserDict({}) + UserDict.UserDict({}, 0) + UserDict.UserDict({}, 0, 1) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test2.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test2.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test2.py new file mode 100644 index 0000000..e46c9f7 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test2.py @@ -0,0 +1,20 @@ + +"time module not used if write32u() line in X.uuu() is commented out" + +import time + +def write32u(a, b): pass + +class X: + def __init__(self): + self.fileobj = 0 + def uuu(self): + #write32u(self.fileobj, long(time.time())) + return None + +class Y(X): + def __init__(self) : + "ERROR: X.__init__() isn't called" + # X.__init__(self) + self.x = 0 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test20.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test20.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test20.py new file mode 100644 index 0000000..21d2e6f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test20.py @@ -0,0 +1,41 @@ +'this test will fail unless -r/--returnvalues is used' + +def func0(x): + 'should not be a warning' + return 0 + +def func1(x): + 'should be a warning implicit/explicit' + if x == 0 : + return 1 + +def func2(x): + 'should not be a warning' + if x == 0 : + return + +def func3(x): + 'should be a warning' + if x == 0 : + return 1, 2 + return 1 + +def func4(x): + 'should not be a warning, difficult to deal with' + c = (1, 2) + if x == 0 : + return c + return 9, 8 + +def func5(x): + 'should not be a warning' + if x == 0 : + return 1, 2 + return 9, 8 + +def func6(x): + 'should be a warning' + if x == 0 : + return 1, 2 + return 9, 8, 7 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test21.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test21.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test21.py new file mode 100644 index 0000000..197d07c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test21.py @@ -0,0 +1,57 @@ +'test inconsistent return types' + +a, b = 0, 0 + +def f(z): + 'should be a warning' + if z: + return 1 + return [] + +def g(z): + 'should be a warning' + if z: + return (1, 2) + return [] + +def h(z): + 'should be a warning' + if z: + return {} + return [] + +def y(): + 'should not be a warning' + if a: return 1 + elif b: return 0 + else : return cmp(a, b) + +def z(): + 'should not be a warning' + if b: return b, a, globals() + return 1, 2, 3 + +class A: + 'test returning base class' + +class B(A): + 'test returning derived class' + +def x(num): + if num == 1: + return A() + if num == 2: + return B() + return None + +class C: + 'test returning "inconsistent" types from __getattr__ which is allowed' + def __getattr__(self, attr): + if attr == 'a': + return 1 + if attr == 'b': + return 3.1415926 + if attr == 'b': + return 'string' + raise AttributeError, 'no attr ' + attr + ' is a bad attr' + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test22.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test22.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test22.py new file mode 100644 index 0000000..868a8c6 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test22.py @@ -0,0 +1,86 @@ +'d' + +def y(): + print '%d %f %s' % (1, 2.2, 'sdf') + + print '%d %f %s %d' % (1, 2.2, 'sdf') + + aaa = bbb = 1 + eee = 0 + print '%(aaa)d %(bbb)f %(ccc)s %(ddd)s' % locals() + + b = 0 + print '%()s %(b)d' % locals() + + print '%(b) %(aaa)d' % locals() + print '%(aaa)d %(b)' % locals() + + print '%*d' % (2, 2) + print '%*d' % (2, 2, 3) + + print '%*.*f' % (5, 2, 2.0) + print '%*.*f' % (5, 2, 2.0, 3) + + print '%z %f %s' % (1, 2.2, 'sdf') + print '%d %J %s' % (1, 2.2, 'sdf') + print '%***f' % (5, 2, 2.0, 3) + + print '%(aaa)d %d' % locals() + print '%(aaa)*d' % locals() + jjj = 1.0 + print '%(jjj)*.*f' % locals() + + fmt = '%d %s %d' + print fmt % (aaa, bbb) + + +_F = '%d %d' + +def ZZ(): + print _F % 5 + print _F % (5, 5) + print _F % (5, 5, 5) + + F = '%d' + print F % 5 + print F % (5, 5, 5) + + t1 = (1,) + t2 = (1,2) + print F % t1 + print F % t2 + +def YY(item): + print '%(a)s %(b)s' % { 'a': '5', 'b': '7' } + print '%(a)s %(b)s' % item + d = { 'a': '5', 'b': '7' } + print '%(a)s %(b)s' % d + +def string_multiply(): + # these are right + print '%d ' * 3 % (1, 2, 3) + print ('%d ' * 3) % (1, 2, 3) + + # these are wrong + print '%d ' * 2 % (1, 2, 3) + print '%d ' * 3 % (1, 2, 3, 4) + print ('%d ' * 4) % (1, 2) + +def check_vars1(): + a = b = c = 5 + print '%(a)d %(b)d' % vars() + +def check_vars2(): + a = b = c = 5 + print '%(a)d %(b)d' % vars(c) + +def check_modulo_1(): + print '%s' % '1' + print '%s' % 1 + print .55555 % 1 + print 55555 % 1 + f = 55555.55 + print f % 1 + +def check_bad_format_end_percent(arg): + print 'ha, better not crash %' % arg http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py new file mode 100644 index 0000000..d88b1e0 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py @@ -0,0 +1,48 @@ +'doc' + +class X: + 'doc' + def __init__(self): + self.fff = 0 + + def x(self): + pass + + def y(self): + 'should generate a warning' + if self.x: + pass + if self.x and globals(): + pass + if globals() and self.x: + pass + + def z(self): + 'should NOT generate a warning' + if globals() : + pass + if self.x() and self.fff: + pass + if self.x() and globals(): + pass + if globals() and self.x(): + pass + if self.fff: + pass + print self.x + print self.fff + +class Y(X): + 'doc' + def j(self): + 'should generate a warning' + if self.x: + pass + print self.fff + + def h(self): + 'should NOT generate a warning' + if self.x(): + pass + print self.x + print self.fff http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test24.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test24.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test24.py new file mode 100644 index 0000000..0611926 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test24.py @@ -0,0 +1,12 @@ +'doc' + +from import24 import * + +b = Bbb() + +def xxx(): + print func24(1) + +def func(shadow): + print shadow + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py new file mode 100644 index 0000000..e5c871f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py @@ -0,0 +1,16 @@ +'doc' + +import sys + +class A: + 'doc' + z = 1 + def x(self): pass + +def xxx(): + print A.x() + print A.z + print A.a + print A.y() + print sys.lkjsdflksjasdlf + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test26.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test26.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test26.py new file mode 100644 index 0000000..dba9bc2 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test26.py @@ -0,0 +1,11 @@ +"" +class Foo: + "" + def __init__(self,q): + print q + +class Bar(Foo): + "" + def __init__(self): + Foo.__init__(self,{ 'a' : 1 }) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test27.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test27.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test27.py new file mode 100644 index 0000000..dcf40d7 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test27.py @@ -0,0 +1,15 @@ +'doc' + +import fnmatch + +x = [] +bfp = '' +x = filter(lambda f, p = bfp : fnmatch.fnmatch(f, p), x) + +def y(): + print x + +def d(lines): + import string + lines = map(lambda s: string.strip(s), lines) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test28.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test28.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test28.py new file mode 100644 index 0000000..789a572 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test28.py @@ -0,0 +1,8 @@ +'doc' + +import fnmatch + +class X: + 'doc' + x = filter(lambda f, p = '' : fnmatch.fnmatch(f, p), []) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test29.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test29.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test29.py new file mode 100644 index 0000000..0ac3855 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test29.py @@ -0,0 +1,14 @@ +'doc' + +import fnmatch + +class X: + 'doc' + def x(self): + x = filter(lambda f, p = '' : fnmatch.fnmatch(f, p), []) + print x + +def x(cpu): + p = len(filter(lambda x: x.find('processor') > -1, cpu.items)) + print p + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test3.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test3.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test3.py new file mode 100644 index 0000000..c92bc05 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test3.py @@ -0,0 +1,14 @@ + +"Shouldn't be any warnings/errors" + +import string + +def describeSyntax(syntax): + return string.join(['<%s>' % x.Description]) + +from UserDict import UserDict + +class jj(UserDict) : + def __init__(self): + UserDict.__init__(self) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test30.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test30.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test30.py new file mode 100644 index 0000000..123db37 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test30.py @@ -0,0 +1,8 @@ +'doc' + +import fnmatch + +def x(): + x = filter(lambda f, p = '' : fnmatch.fnmatch(f, p), []) + print x + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test31.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test31.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test31.py new file mode 100644 index 0000000..a3d040c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test31.py @@ -0,0 +1,38 @@ +'doc' + +class X: + 'doc' + +class Y(X): + 'doc' + +class Z(X): + 'doc' + def __init__(self, arg): + pass + +def x(): + 'should not cause a warning' + print X() + print Y() + print Z('should create a warning since no __init__()') + +def y(): + print X(a='should create a warning since no __init__()') + print X('should create a warning since no __init__()') + print Y(a='should create a warning since no __init__()') + print Y('should create a warning since no __init__()') + print Z(1, a='should create a warning since no __init__()') + print Z(1, 2) + +class A: + 'd' + def a(self, a, b, c): pass + def x(self, a, b, c): pass + +class B(A): + 'd' + def y(self): + A.x(self, 1, 2, 3) + def z(self): + A.a(self, 1, 2, 3) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test32.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test32.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test32.py new file mode 100644 index 0000000..1ca2b82 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test32.py @@ -0,0 +1,16 @@ +'doc' + +class X: + 'doc' + def __init__(self): pass + +class Y(X): + 'doc' + def __init__(self, s): + X.__init__(s) + +class Z(X): + 'doc' + def __init__(self, s): + X.__init__() + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test33.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test33.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test33.py new file mode 100644 index 0000000..739b736 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test33.py @@ -0,0 +1,10 @@ +'d' + +def x(): + print j + j = 0 + +def y(): + for x in []: + print x + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test34.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test34.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test34.py new file mode 100644 index 0000000..9cea46a --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test34.py @@ -0,0 +1,27 @@ +'d' + +from string import whitespace +from string import digits +from string import lowercase +from string import * + +import locale +from locale import LC_ALL +from locale import * + +import getopt +from getopt import * + +from copy import * +import copy + +from re import sub +from re import sub + +import ihooks +import ihooks + +def x(a): + "just use the imported modules so we don't get an unused warning" + print ihooks, getopt, copy, locale + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test35.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test35.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test35.py new file mode 100644 index 0000000..76e26d5 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test35.py @@ -0,0 +1,13 @@ + +__pychecker__ = '--no-namedargs --no-import --no-var --no-privatevar --no-moduledoc --funcdoc' + +import re + +_NOT_USED1 = None +NOT_USED2 = None + +def x(a, b) : pass + +def y(): + x(b=1, a=2) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test36.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test36.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test36.py new file mode 100644 index 0000000..69b8a4f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test36.py @@ -0,0 +1,40 @@ +'d' + +from types import StringType, NoneType +from string import upper + +def foo(): + return map(lambda x: upper(x), 'testing') + +def func(a, b, *args, **kw): + 'verify no warnings for variables (arguments) used before set' + print a, b, args, kw + +class E(Exception): + 'doc' + + +def x(): + 'instantiate a new E with many args, should not be a warning' + print E('test', 'test', 'test', 'test', 'test', 0) + +def y(): + from string import lower + lower = lower('Unknown option') + +def foobar(x): return x + +def nn(): + print map(lambda x, s=foobar: s(x), [1,2]) + +def start() : + int(args=(lambda x=None: x,)) + +def nn2(): + n = [] + n.append(1) + n.append(1, 2) + n.append((1, 2)) + +def run(): + foobar(x={0:5}) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test37.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test37.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test37.py new file mode 100644 index 0000000..66cdd7d --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test37.py @@ -0,0 +1,7 @@ +'d' + +import struct +from import37 import Test + +def x(): + print struct http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test38.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test38.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test38.py new file mode 100644 index 0000000..6a0ec43 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test38.py @@ -0,0 +1,54 @@ +'d' + +class X: + 'd' + def m1(self, a, b, c, d): pass + def m2(self, a, b, c, d, *args): pass + def m3(self, a, b, c, d, *args, **kwArgs): pass + def m4(self, a, b=0, c=0, d=0): pass + def m5(self, a, b=0, c=0, d=0, *args): pass + def m6(self, a, b=0, c=0, d=0, *args, **kwArgs): pass + +class Y1(X): + 'should not generate any warnings' + def m1(self, a, b, c, d): exec a in globals() + def m2(self, a, b, c, d, *args): exec a in globals() + def m3(self, a, b, c, d, *args, **kwArgs): exec a in globals() + def m4(self, a, b, c, d): exec a in globals() + def m5(self, a, b, c, d, *args): exec a in globals() + def m6(self, a, b, c, d, *args, **kwArgs): exec a in globals() + +class Z1(X): + 'should generate warnings' + def m1(self, a, b, c): pass + def m2(self, a, b, c, d): pass + def m3(self, a, b, c, d, **kwArgs): pass + def m4(self, a, b=0, c=0): pass + def m5(self, a, b=0, c=0, d=0): pass + def m6(self, a, b=0, c=0, d=0, **kwArgs): pass + +class Z2(X): + 'should generate warnings' + def m3(self, a, b, c, d, *args): pass + def m6(self, a, b=0, c=0, d=0, *args): pass + +class Z3(X): + 'should generate warnings' + def m3(self, a, b, c, d): pass + def m6(self, a, b=0, c=0, d=0): pass + +class Z4(X): + 'should generate warnings' + def m1(self): pass + def m2(self): pass + def m3(self): pass + def m4(self): pass + def m5(self): pass + def m6(self): pass + +class AAA: + 'should generate 1 warning' + __pychecker__ = 'exec' + def m1(self, a, b, c, d): pass + def m2(self, a, b, c, d, *args): exec a in d + def m3(self, a, b, c, d, *args): exec a http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test39.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test39.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test39.py new file mode 100644 index 0000000..755301b --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test39.py @@ -0,0 +1,44 @@ + +def func1(): pass +def func2(): pass + +class X1: + def x(self) : pass + def y(self) : pass + +class X2: + def x(self) : pass + def y(self) : pass + +class Y1: + def a(self) : pass + def x(self) : pass + def y(self) : pass + +class Y2: + def a(self) : pass + def x(self) : pass + def y(self) : pass + +class check_here: + 'test __pychecker__ var at class scope' + __pychecker__ = 'funcdoc argsused unusednames=foo,bar' + def a(self) : + 'd' + pass + def x(self, foo) : + print self + def y(self, bar) : + print self + def z(self, jjj) : + j = 0 + +# Requires Python 2.2+ +try: + class NewStyle(object): + 'test that suppressions work with new style classes' + def f(self): + i = 5 + +except NameError: + pass http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test4.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test4.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test4.py new file mode 100644 index 0000000..0a7bcc2 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test4.py @@ -0,0 +1,32 @@ + +import UserDict + +class jj(UserDict.UserDict) : + "jj" + def __init__(self): + UserDict.UserDict.__init__(self, None) + +class jj2(UserDict.UserDict) : + "jj2" + def __init__(self): + "Warning don't call UserDict.UserDict.__init__()" + print "don't call UserDict.UserDict.__init__()" + +class jj3(jj) : + "jj3" + def __init__(self): + jj.__init__(self) + +class jj4(jj) : + "jj4" + +class A: + 'should not generate warnings' + def __init__(self): pass + +class B(A): + 'should not generate warnings' + +class C(B): + 'should not generate warnings' + def __init__(self): B.__init__(self) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test40.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test40.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test40.py new file mode 100644 index 0000000..61114c0 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test40.py @@ -0,0 +1,34 @@ +'d' + +__pychecker__ = 'argsused' + +def x0(): + print 'should be ok' + +def x1(a, b, c, *args, **kw): + print a, b, c + +def x2(a, b, c, *args, **kw): + print a, b, c, args + +def x3(a, b, c, *args, **kw): + print a, b, c, args, kw + +def x4(a, b, c, *args, **kw): + print 'uh-oh, forgot to use args' + +def x5(a, b, c, *args, **kw): + raise NotImplementedError + +def x6(a, b, c, *args, **kw): + pass + +def x7(a, b, c, *args, **kw): + return None + +class X: + 'd' + def x1(self): + print 'hi' + def x2(self, a, *args, **kw): + print 'oops' http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test41.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test41.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test41.py new file mode 100644 index 0000000..e88be46 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test41.py @@ -0,0 +1,18 @@ +'d' + +def x(): pass +def x(): pass + +class X: + 'first use okay' +class X: + 'reuse not okay' + +class Y: + 'should warning about x being redefined' + def x(self): pass + def x(self): pass + +class Z: + 'should not be a warning' + def x(self): pass http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test42.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test42.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test42.py new file mode 100644 index 0000000..ebf1aac --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test42.py @@ -0,0 +1,16 @@ +'d' + +import sys + +def x(): + print sys.ps1 + print sys.ps2 + print sys.tracebacklimit + print sys.exc_type + print sys.exc_value + print sys.exc_traceback + print sys.last_type + print sys.last_value + print sys.last_traceback + print sys.__dict__ + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test43.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test43.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test43.py new file mode 100644 index 0000000..460ee7a --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test43.py @@ -0,0 +1,11 @@ +'d' + +class GameObject: + 'd' + # def isIntersecting(self, other): pass + pass + +class SoAndSo(GameObject): + 'd' + def isIntersecting(self, other): + return GameObject.isIntersecting(self, other) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test44.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test44.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test44.py new file mode 100644 index 0000000..89bd7f8 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test44.py @@ -0,0 +1,9 @@ +'d' + +from import44 import * + +class Ccc: + 'd' + def __init__(self): + pass + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test45.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test45.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test45.py new file mode 100644 index 0000000..21ea625 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test45.py @@ -0,0 +1,23 @@ +'d' + +__pychecker__ = 'argsused' + +def x(empty, unused): + print 'nothing' +def y(empty1, unused1): + print 'nothing' +def z(): + empty = 1 + unused = 2 + empty1 = 1 + unused1 = 2 + +class A: + 'd' + def x(self, other, empty, unused): + print 'nothing' + def y(self, other1, empty1, unused1): + print 'nothing' + +def a(): + _ = 5 http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test46.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test46.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test46.py new file mode 100644 index 0000000..a5a5885 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test46.py @@ -0,0 +1,7 @@ +'d' + +def x(): pass + +import test46 +from test46 import x +from test46 import * http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test47.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test47.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test47.py new file mode 100644 index 0000000..fd9af25 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test47.py @@ -0,0 +1,7 @@ +'there was a spurious warning when the module and class name were the same' + +import import47 + +class jj(import47.import47): + 'doc' + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test48.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test48.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test48.py new file mode 100644 index 0000000..9b8b01c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test48.py @@ -0,0 +1,84 @@ +'d' + +class X: + 'd' + def x(self): pass + def y(self): pass + +def x(): + i, l, d, s, n, e = 0, [], {}, '', None, Ellipsis + i.has_no_method() + l.has_no_method() + d.has_no_method() + s.has_no_method() + n.has_no_method() + e.has_no_method() + + print i.has_no_attr + print l.has_no_attr + print d.has_no_attr + print s.has_no_attr + print n.has_no_attr + print e.has_no_attr + + l.sort() + d.clear() + + d[i] = jj = X() + jj.a() + jj.b() + jj.x() + jj.y() + +def y(): + for j in []: + print j.a() + + +class Z: + 'd' + def __init__(self): pass + def x(self): pass + def y(self): pass + +def zz(): + tt = Z() + tt.a() + tt.b() + tt.x() + tt.y() + +def abc(a, b, c): + # these should all generate a warning for doing nothing + a + b + c + abc + 5 + zz.func_doc + str + +def j343(): + d = {} + d['HOME'] + l = [] + l[5] + d, l + +def jklasdflksdjf(): + d = {} + 5 + 3 + 5 - 3 + 5 / 3. + 5 * 3 + 5 ** 3 + d.get + d[1] + d[1:2] + d, d + [d, d] + +def print_item_to(fp, boundary): + # this should not generate a warning, note comma at end + print >> fp, '\n--' + boundary + '--', + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test49.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test49.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test49.py new file mode 100644 index 0000000..711766e --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test49.py @@ -0,0 +1,37 @@ +'d' + +def x(): + d = e = 7 + print d / e + print d / 3 + print 7 / e + print 5 / 6 + +def y1(): + x = 0 + return (x * 100.0) / 10 + +def y2(): + x = 0 + return (x + 100.0) / 10 + +def y3(): + x = 0 + return (x - 100.0) / 10 + +def y4(): + x = 1 + return (x ** 100.0) / 10 + +def z(e): + x = 0 + if e: + x = x + 1 + return (x * 100.0) / 10 + y = 0 + return (x * 100.0) / y + +def should_not_warn(a): + # this warning should be suppressed automatically + x = int(a) + return int(x / 5) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test5.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test5.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test5.py new file mode 100644 index 0000000..46e8fea --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test5.py @@ -0,0 +1,20 @@ +'test named args' +__pychecker__ = 'namedargs' + +def x(a, b, c = None, d = None, **kw): + pass + +def y(): + x(1, 2, c=3, d=4, e=5) + +def z(): + x(1, 2, e=5, d=4) + +class X: + "doc" + def __init__(self): + self.y = 0 + def z(self): + "this should not have any warnings" + x(self.y, { 'a': 'b' }) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test50.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test50.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test50.py new file mode 100644 index 0000000..9fd3d8f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test50.py @@ -0,0 +1,21 @@ +'d' + +__pychecker__ = 'maxargs=4 maxlocals=3' + +def A(a, b, c): pass +def B(a, b, c, d): pass +def C(a, b, c, d, e): pass +def D(a, b, c, d, f, g): pass + +def E(a, b, c, d): + w = x = y = 0 + print a, b, c, d, w, x, y + +def F(a, b, c, d): + w = x = y = z = 0 + print a, b, c, d, w, x, y, z + +def G(a, b, c, d): + w = x = y = z = jj = 0 + print a, b, c, d, w, x, y, z, jj + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test51.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test51.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test51.py new file mode 100644 index 0000000..70033dd --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test51.py @@ -0,0 +1,19 @@ +'d' + +def x(): + n = [] + d = {} + print n[5] + print n[5,-3] + print n[1,3] + print n[1:3] + print n[1:-3] + + print d[5] + print d[5,-3] + print d[1,3] + print d[1:3] + print d[1:-3] + + print [1, 2][1] + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test52.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test52.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test52.py new file mode 100644 index 0000000..cb470ea --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test52.py @@ -0,0 +1,54 @@ +"doesn't work in 1.5.2" + +class foo: + 'd' + def __init__(self, *args, **kwargs): + self.args = args + self.kw = kwargs + +class foo2(foo): + 'd' + def __init__(self, *args): + foo.__init__(self, jj=5, kk=10, *args) + +class foo3(foo): + 'd' + def __init__(self, **kwargs): + foo.__init__(self, jj=5, kk=10, **kwargs) + +class foo4(foo): + 'd' + def __init__(self, *args, **kwargs): + foo.__init__(self, jj=5, kk=10, *args, **kwargs) + +class c: + 'd' + def __init__(self): + pass + +class c1: + 'd' + o = c() + def c(self,x): + print x + +def x(): + a = c1() + a.b = c1() + # we can't handle this yet + # a.b.c(5) + +class c2: + 'd' + def m1(self): + print "ok" + def m2(self,x): + print "ok" + +class c3: + 'd' + c2 = None + def m(self): + self.c2.m1() + self.c2.m2(5) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test53.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test53.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test53.py new file mode 100644 index 0000000..df40518 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test53.py @@ -0,0 +1,28 @@ +'d' + +def x(): + # these are broken, this is BAD code!!! + i = ~~ (10) + while i > 0 : + --i + while i < 100 : + ++i + + # these are fine + j = 0 + while j > 0 : + j = j - 1 + while j < 100 : + j = j + 1 + +def y(): + # should not generate a warning + print ("format w/2 strings %s" + "=" + "'%s'") % ('a', 'b') + # should generate a warning + print ("format w/2 strings %s" + "=" + "'%s'") % ('a', 'b', 'c') + +def z(): + i = -5 + print +i, i, -i + print +5, 5, -5 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test54.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test54.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test54.py new file mode 100644 index 0000000..45c1b5d --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test54.py @@ -0,0 +1,20 @@ +'d' + +real_global = 0 + +def f(a, b, c): + del a + del z + z = 0 + del a + del z + + print a, b, c + + global no_global + del no_global + +if __name__ == '__main__': + del another_non_existant_global + del real_global + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test55.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test55.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test55.py new file mode 100644 index 0000000..f08ec9f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test55.py @@ -0,0 +1,47 @@ +'d' + +def x(): + try : + print "howdy, this ain't right" + except KeyError, RuntimeError : + pass + +def y(): + try : + print "ok, " + "this func %s should be fine" % y.__name__ + except (KeyError, RuntimeError) : + pass + +def z(): + try : + pass + except (KeyError, RuntimeError, IndexError) : + pass + +def a(): + try : + pass + except (KeyError, RuntimeError, IndexError), a : + print a + +try : + pass +except KeyError, RuntimeError : + pass + +try : + pass +except (KeyError, RuntimeError) : + pass + +def b(): + try : + print "ok, " + "this func %s should be fine" % y.__name__ + except (KeyError, RuntimeError), msg : + print msg +def c(): + try : + print "ok, " + "this func %s should be fine" % y.__name__ + except KeyError, detail : + print detail + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test56.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test56.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test56.py new file mode 100644 index 0000000..0eba6c6 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test56.py @@ -0,0 +1,7 @@ +'doc' + +from import56a import Foo + +def x(): + print Foo + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test57.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test57.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test57.py new file mode 100644 index 0000000..1c8e6df --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test57.py @@ -0,0 +1,11 @@ +"doesn't work in 1.5.2" + +def ttt(c): + return None + +def x(): + "should not complain about either, we can't check # args" + columns = [ 1, 2 ] + print zip(*columns) + print ttt(*columns) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test58.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test58.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test58.py new file mode 100644 index 0000000..abc557f --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test58.py @@ -0,0 +1,11 @@ +'Note: this will only work on Python 2.1 and before' + +yield = None + +def x(): + yield = 53 + print yield + +def y(): + print yield + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test59.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test59.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test59.py new file mode 100644 index 0000000..03ed7f0 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test59.py @@ -0,0 +1,31 @@ +'d' + +def x1(a, b, c = [], d = {}): + c.reverse() + d.update({ a: b}) + +def x2(a, b, c, d): + c.reverse() + d.update({ a: b}) + +def y(a, b, c = [], d = {}): + print a, b, c, d + +class X: + 'd' + def x(self) : pass + +def zz(x = X()): + print x.x() + +def zz2(a = [], b = {}): + a[0] = b + b[0] = a + +def aaa1(a, b, c = [], d = {}): + print c.index(a) + print c.count(a) + print d.get(b) + print d.has_key(b) + print d.keys() + print d[b] http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test6.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test6.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test6.py new file mode 100644 index 0000000..e4ad2ee --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test6.py @@ -0,0 +1,31 @@ + +"doc" + +from xml.dom import pulldom + +class X(pulldom.PullDOM) : + "doc" + def __init__(self): + "shouldn't be a warning" + pulldom.PullDOM.__init__(self) + +class Y(Exception): + "doc" + def __init__(self, err): + "this shouldn't produce a warning" + Exception.__init__(self, err) + +class Z(Y): + "doc" + def __init__(self, err): + "this shouldn't produce a warning" + apply(Y.__init__, (self, err)) + +def uuu(func): + "shouldn't crash" + return tuple([i for i in func() if func(globals()[i])]) + +def yyy(): + "shouldn't crash" + map(apply, globals().keys(), ((),) * len(globals()), globals().values()) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test60.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test60.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test60.py new file mode 100644 index 0000000..e0d192e --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test60.py @@ -0,0 +1,22 @@ +'d' + +def __repr__(self): + print `self` + +class X: + 'd' + def __repr__(self): + print `self` + +class Y: + 'd' + def __init__(self): + self.x = 0 + def __repr__(self): + print `self.x` + +class Z: + 'd' + def other_method(self): + print `self` + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test61.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test61.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test61.py new file mode 100644 index 0000000..e7eb549 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test61.py @@ -0,0 +1,28 @@ +'d' + +class X: + 'd' + def x(self, g, h): pass + +def y(): + x = X() + print x.x() + +def z(): + x = X() + print x.x(1, 2) + +def a(): + d = {} + print d.get(1, 5) + print d.get(1, 5, 7) + print d.keys() + print d.keys(1, 5, 7) + print d.clear() + x = d.clear() + x.y = d.clear() + d.clear() + print + print setattr(d, 'junk', 'neal') + print `d`.rjust(5) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test62.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test62.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test62.py new file mode 100644 index 0000000..82e821b --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test62.py @@ -0,0 +1,4 @@ +'bug found by Joe VanAndel' + +isintorlong = lambda x: type(x) == type(0) or type(x) == type(0L) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test63.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test63.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test63.py new file mode 100644 index 0000000..85769a8 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test63.py @@ -0,0 +1,15 @@ +'d' + +def x(v): + count = 0 + if v != 0: + return 1 + return count + +def y(v): + x = len(v) + if x == 0 : + return x + else : + return x - 1 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py new file mode 100644 index 0000000..dad2288 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test64.py @@ -0,0 +1,17 @@ +'''spurious warnings reported by Andrew Dalke +''' + +import sys, string, re +import array + +class _Anything: pass +_anything = _Anything() + +def outer(): + def x(): + return _anything + + def y(): + return dir(string.translate) + + x() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test65.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test65.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test65.py new file mode 100644 index 0000000..2f4843d --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test65.py @@ -0,0 +1,21 @@ +'test nested scopes' + +from __future__ import nested_scopes + +def x(p): + def y(): + print p + + y() + print p + +def a(p): + def y(): + print p + + y() + +def chop(seq,size): + chunk = lambda i: seq[i:i+size] + return map(chunk,range(len(seq))) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test66.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test66.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test66.py new file mode 100644 index 0000000..6dcad76 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test66.py @@ -0,0 +1,7 @@ +'d' + +from time import time, sleep + +def x(): + print time, sleep + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test67.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test67.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test67.py new file mode 100644 index 0000000..67ddd4c --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test67.py @@ -0,0 +1,16 @@ +'d' + +__pychecker__ = 'members' + +class X: + 'd' + j = 0 + def __init__(self): + self.a = 0 + self.b = 0 + self.c = 0 + self.d = 0 + + def p(self): + print self.b, self.c, self.j + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test68.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test68.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test68.py new file mode 100644 index 0000000..547f4d6 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test68.py @@ -0,0 +1,170 @@ +'test implicit returns' + +__pychecker__ = 'implicitreturns' + +def func1(x): + 'should not produce a warning' + if x == 1: + return 1 + return 0 + +def func2(x): + 'should produce a warning' + if x == 1: + return 1 + +def func3(x): + 'should not produce a warning' + while 1: + if x == 1: + return 1 + x = x / 2 + return 0 + +def func4(x): + 'should not produce a warning' + while 1: + if x == 1: + return 1 + x = x / 2 + +def func5(x): + 'should not produce a warning' + while 1: + if x == 1: + return 1 + return 0 + +def func6(x): + 'should produce a warning' + while 1: + if x == 1: + return 1 + break + +def func7(x): + 'should not produce a warning' + try: + print x + return 2 + except: + pass + return 0 + +def func8(x): + 'should produce a warning' + try: + if x == 1: + return 3 + if x == 2: + return 6 + except: + pass + +def func9(x): + 'should not produce a warning' + try: + return x + except: + return 0 + +def func10(x): + 'should not produce a warning' + if x: + raise ValueError + +def func11(x): + 'should not produce a warning' + if x: + raise ValueError + return 5 + +def func12(x): + 'should not produce a warning' + raise ValueError, 'test' + +def func13(x): + 'should not produce a warning' + if x == 1: + return 1 + else: + return 0 + +def func14(x): + 'should not produce a warning' + try: + if x == 1: + return 3 + return 6 + except: + raise + +def func15(x): + 'should not produce a warning' + try: + return x.j + except AttributeError: + return 0 + +def func16(x): + 'should not produce a warning' + try: + return x.j + except AttributeError: + raise + +def func17(x): + 'should not produce a warning' + try: + return x.j + except (AttributeError, KeyError, IndexError): + return 0 + +def func18(x): + if x == 'n': + return x + if x != 'j': + raise AttributeError + +def func19(x): + 'should not produce a warning' + while 1: + if x: + x = x + 1 + return 1 + +def func20(x): + 'should produce a warning' + while 1: + if x: + break + return 1 + +def func21(x): + 'should not produce a warning' + try: + if x == 1: + return 3 + return 6 + finally: + print 'do nothing' + +def func22(x): + 'should not produce a warning' + while 1: + for _ in range(10) : + x = x / 2 + break + return 1 + +def catchup(slave, image, inProgress): + d = func1.bogus() + def next_func(): + defer = slave.call('', image.next()) + try: + defer.add(d.errback) + except: + slave.call(inProgress) + next_func() + return d + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test69.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test69.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test69.py new file mode 100644 index 0000000..457019e --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test69.py @@ -0,0 +1,22 @@ +'d' + +import import69 + +__pychecker__ = 'callattr' +class B: + 'd' + def __init__(self): pass + +class C(B): + 'd' + __super_init = B.__init__ + def __init__(self): + self.__super_init() + +class D(import69.Alias): + 'd' + __super_init = import69.Alias.__init__ + def __init__(self): + self.__super_init() + + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test7.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test7.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test7.py new file mode 100644 index 0000000..f201ac0 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test7.py @@ -0,0 +1,18 @@ + +"doc" + +def func(): pass + +class X: + "should only generate a warning w/-A, --callattr cmd line options" + def __init__(self, other): + self.func = func + self.other = other + self.x = None + + def test(self): + "self.y should generate a function" + self.func() + self.other() + self.x() + self.y() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test70.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test70.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test70.py new file mode 100644 index 0000000..379a9ea --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test70.py @@ -0,0 +1,60 @@ +'test checking constant conditions' + +# __pychecker__ = '' + +def func1(x): + 'should not produce a warning' + if 1: + pass + while 1: + print x + break + assert x, 'test' + return 0 + +def func2(x): + 'should produce a warning' + __pychecker__ = 'constant1' + if 1: + pass + while 1: + print x + break + return 0 + +def func3(x): + 'should produce a warning' + if 21: + return 1 + if 31: + return 2 + assert(x, 'test') + assert(5, 'test') + assert 5, 'test' + + if 'str': + return 3 + + return 4 + +def func4(x): + 'should not produce a warning' + if x == 204 or x == 201 or 200 <= x < 300: + x = 0 + if x == 1: + pass + while x == 'str': + print x + break + return 0 + +def func5(need_quotes, text): + 'should not produce a warning' + return (need_quotes) and ('"%s"' % text) or (text) + +def func6(x): + 'should not produce warnings' + if x & 32: + print 'ya' + if 32 & x: + print 'ya' http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test71.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test71.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test71.py new file mode 100644 index 0000000..e45ea05 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test71.py @@ -0,0 +1,50 @@ +'test unreachable code' + +__pychecker__ = 'unreachable' + +def a(x): + if x == 5: + return x + return 0 + print x + +def b(x): + if x == 5: + return x + raise ValueError + print x + +def c(x): + if x == 5: + return + return + print x + +def d(x): + if x == 5: + return + raise ValueError + print x + +def e(x): + def foo(): + print x + foo() + return x + +def f(): + x = e(1) + print x + +class Point: + """doc string""" + parse = None + + def get_position(self, parts): + try: + return Point.parse('%s %s' % (parts[1], parts[2]), float(parts[3])) + except ValueError, e: + # FIXME: handle better than printing + print 'Unable to process position report\n', e + return None + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test72.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test72.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test72.py new file mode 100644 index 0000000..d32771b --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test72.py @@ -0,0 +1,29 @@ +'test setting class attributes not in __init__ w/initattr set' + +__pychecker__ = 'initattr no-classdoc' + +class A: + 'd' + def a(self): + self.y = 0 + +class B(A): + 'd' + def b(self): + self.z = 0 + +class C: + 'd' + def __init__(self): + self.a = self.b = self.c = 0 + self.d = None + self.e = [] + + def b(self): + print self.z + self.y = 0 + +class D(C): + def c(self): + self.a = 5 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test73.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test73.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test73.py new file mode 100644 index 0000000..47b2dc4 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test73.py @@ -0,0 +1,37 @@ +'test abstract classes' + +__pychecker__ = 'no-classdoc' + +class Abstract: + def f(self): raise NotImplementedError, "override in subclass" + def g(self): raise NotImplementedError +class ConcreteBad(Abstract): + def g(self): pass +class ConcreteGood(ConcreteBad): + def f(self): pass +a = Abstract() # error +cb = ConcreteBad() # error +cg = ConcreteGood() # ok, f defined + +class ConcreteInst: + def f(self): raise SystemError("not yet ready for prime time") +ch = ConcreteInst() # ok, raises SystemError + +class AbstractInst: + def f(self): raise NotImplementedError("not yet ready for prime time") +ch = AbstractInst() + +cb.g() +def f(): + class MoreBad(Abstract): + def g(): pass + _ = MoreBad() # FIXME, error not caught + +import import73 +class ImplAbstract(import73.AbstractLib): + def __init__(self): + import73.AbstractLib.__init__(self) + +def lib_example(): + _ = import73.AbstractLib() # error + unused = ImplAbstract() # error http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test74.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test74.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test74.py new file mode 100644 index 0000000..acf45e3 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test74.py @@ -0,0 +1,41 @@ +'test __getattr[ibute]__ returning None' + +class A: + 'no warning' + def __getattr__(self, attr): + return attr + +class B: + 'no warning' + def __getattribute__(self, attr): + return attr + +class C: + 'warning' + def __getattr__(self, attr): + pass + +class D: + 'warning' + def __getattribute__(self, attr): + pass + +class E: + 'warning' + def __getattr__(self, attr): + if attr == 'n': + return attr + if attr != 'j': + raise AttributeError + +class F: + 'no warning' + def __getattr__(self, attr): + if attr == 'n': + return attr + raise AttributeError + +class G: + 'should not gen a warning' + def __getattr__(self, name): + return getattr(self, 'a')[name] http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test75.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test75.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test75.py new file mode 100644 index 0000000..c8f5ee8 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test75.py @@ -0,0 +1,87 @@ +'test slots & property, this will only work in Python 2.2' + +class A: + 'warn about using slots in classic classes' + __slots__ = ('a',) + +try: + class B(object): + 'no warning' + __slots__ = ('a',) + + class C(object): + 'warn about using empty slots' + __slots__ = () + + class D(object): + "don't warn about using empty slots" + __pychecker__ = '--no-emptyslots' + __slots__ = () + + class E: + 'this should generate a warning for using properties w/classic classes' + def getx(self): + print 'get x' + return 5 + x = property(getx) + + class F(object): + 'this should not generate a warning for using properties' + def getx(self): + print 'get x' + return 5 + x = property(getx) + + class Solution(list): + 'this should not generate a warning or crash' + def __init__(self): + pass + + class MethodArgNames: + 'check warnings for static/class methods for first arg name' + def __init__(self, *args): pass + + # should warn + def nn(self, *args): pass + nn = classmethod(nn) + + # should warn + def mm(self, *args): pass + mm = staticmethod(mm) + + # should not warn + def oo(cls, *args): pass + oo = classmethod(oo) + + # should not warn + def pp(*args): pass + pp = staticmethod(pp) + + # should not warn + def qq(): pass + qq = staticmethod(qq) + + # should not warn + def rr(klass, *args): pass + rr = classmethod(rr) + + class Bug4(object): + '''doc''' + def static(arg1, arg2): + return arg1+arg2 + static = staticmethod(static) + + def buggy(self): + return self.static(1,2) + + class Slots(dict): + 'doc' + pass + + class Foo(object): + 'doc' + __slots__ = Slots() + +except NameError: + pass + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test76.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test76.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test76.py new file mode 100644 index 0000000..bffc077 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test76.py @@ -0,0 +1,12 @@ +'test 3+ nested functions' + +__pychecker__ = 'argsused' + +def x(a=1): + def y(b=2, c=3, d=4): + def z(b=2, e=5): + print 'in z', b, e + print 'in y', b, c + z() + print 'in x' + y() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test77.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test77.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test77.py new file mode 100644 index 0000000..002b3b6 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test77.py @@ -0,0 +1,9 @@ +"always raise an exception and make sure pychecker doesn't - from Greg Ward" + +class MyError(Exception): + 'd' + def __init__(self, msg): + self.msg = msg + +raise MyError("FOO!") + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test78.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test78.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test78.py new file mode 100644 index 0000000..73e1378 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test78.py @@ -0,0 +1,19 @@ +'test using input()' + +import readline # should not generate a warning since input/raw_input() is used + +def f1(): + x = input() + print x + +def f2(): + x = raw_input() + print x + +def f3(): + 'should not generate a warning, since this is not the real input' + __pychecker__ = 'no-shadowbuiltin' + def input(): return 0 + + x = input() + print x http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test79.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test79.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test79.py new file mode 100644 index 0000000..8524f94 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test79.py @@ -0,0 +1,33 @@ +'test iterating over a string' + +__pychecker__ = 'stringiter' + +def func1(): + 'should generate a warning' + s = 'string' + for c in s: + print 'oops', c[0] + +def func2(): + 'should generate a warning' + f = open('/dev/null') + s = f.read() + for c in s: + print 'oops', c[0] + +def func3(): + 'should not generate a warning' + for i in []: + print 'ok', i + for i in (): + print 'ok', i + +def func4(): + 'should not generate a warning' + v = [] + for i in v: + print 'ok', i + w = () + for i in w: + print 'ok', i + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test8.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test8.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test8.py new file mode 100644 index 0000000..0ac0586 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test8.py @@ -0,0 +1,4 @@ +"doc" + +def func(): + syntax error here http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test80.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test80.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test80.py new file mode 100644 index 0000000..a855134 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test80.py @@ -0,0 +1,25 @@ +'test inconsistent types' + +__pychecker__ = 'changetypes' + +def func1(): + 'should generate a warning' + x = 0 + x += 1.1 + print x + +def func2(): + 'should not generate a warning' + x = "" + x = "string" + for j in []: + x = j + print x + +def func3(): + 'should generate a warning' + y = None + y = [] + y = {} + print y + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test81.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test81.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test81.py new file mode 100644 index 0000000..6e9e1f8 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test81.py @@ -0,0 +1,30 @@ +'test use of freevars and cellvars' + +from __future__ import nested_scopes + +__pychecker__ = 'classattr' + +class Board: + 'base class to test' + def atomCount(self): + pass + +def func(l): + pass + +class BoardTests: + 'should not generate a warning' + def testAddAtom(self): + b = Board() + b.atomCount() + func(lambda:b.atomCount()) + +def q(funcp): + print funcp() + +def f(): + y = 1 + def g(): + return y + q(g) + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test82.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test82.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test82.py new file mode 100644 index 0000000..8b2cb63 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test82.py @@ -0,0 +1,18 @@ +'test private globals in a class, from tom culliton' + +_happy_private_name=("eyes", "nose", "fingers", "toes") +__unhappy_private_name=("missing life", "long commute", "dumb user") + +def whatsit(thingee): + if (thingee in _happy_private_name + or thingee in __unhappy_private_name): + return "I got one too!" + else: + return "Ooo! What's that?" + +class geek: + 'd' + def __init__(self): + self.happy = _happy_private_name + self.unhappy = __unhappy_private_name + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test83.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test83.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test83.py new file mode 100644 index 0000000..f2a6a94 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test83.py @@ -0,0 +1,43 @@ +'test unpacking variables' + +def func1(): + 'should not warn' + x, z = (5, 2) + +def func2(): + 'should warn' + x, y, z = (5, 2) + +def func3(): + 'should warn' + a = (5, 2) + x, y, z = a + +def func4(): + 'should warn' + x, = (5, 2) + +def func5(): + 'should warn' + x, y = 5, + +def func6(): + 'should warn' + x, = 5 + +def func101(): + 'should not warn' + x, y, z = (5, 2, 3, 4, 5)[:3] + +def func102(): + 'should warn ideally, but size becomes unknown' + x, y, z = (5, 2, 3, 4, 5)[:2] + +def func103(): + 'should not warn' + x, y, z = (5, 2, 3, 4, 5)[2:] + +def func104(): + 'should warn ideally, but size becomes unknown' + x, y, z = (5, 2, 3, 4, 5)[3:] + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test84.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test84.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test84.py new file mode 100644 index 0000000..a26bea6 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test84.py @@ -0,0 +1,10 @@ +'this crashed pychecker from calendar.py in Python 2.2' + +class X: + 'd' + def test(self, item): + return [e for e in item].__getslice__() + +# this crashed in 2.2, but not 2.3 +def f(a): + a.a = [x for x in range(2) if x > 1] http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test85.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test85.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test85.py new file mode 100644 index 0000000..b549493 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test85.py @@ -0,0 +1,22 @@ +'''test return (x and 'true' or 'false') idiom''' + +def f1(test): + 'should not warn' + return test and 'true' or 'false' + +def f2(test): + 'should not warn about None' + return test and 'true' or None + +def f3(test): + 'should warn about None' + return test and None or 'false' + +def f4(test): + 'should warn' + return test and [] or 0 + +def f5(test): + 'should not warn' + return test and 'true' or 0 + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/80e25b46/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test86.py ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test86.py b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test86.py new file mode 100644 index 0000000..36935c0 --- /dev/null +++ b/tools/bin/pythonSrc/pychecker-0.8.18/test_input/test86.py @@ -0,0 +1,96 @@ +'warn about raising/catching string exceptions' + +__pychecker__ = 'no-classdoc' + +class g(Exception): pass +h = 'blah' +i = g +j = KeyError +class k: pass + +def f1(a, b, c): + 'should not warn' + class z(Exception): pass + if a: + raise + if a: + raise KeyError + if a: + raise b, '' + if a: + raise c() + if a: + raise g, '' + if a: + raise i + if a: + raise j + if a: + raise z + +def f2(a): + 'should warn' + if a: + raise 'strerr' + if a: + raise h, '' + if a: + raise k + +def f3(a, b, c): + 'should not warn' + class z(Exception): pass + try: + f1(a, b, c) + except a: + pass + except b.bbb: + pass + except KeyError: + pass + except (TypeError, KeyError): + pass + except g: + pass + except z: + pass + except (g, z): + pass + except i, detail: + print detail + except Exception, detail: + print detail + except: + pass + +def f4(a): + 'should warn' + try: + f2(a) + except 'strerr': + pass + except ('strerr1', 'strerr2'): + pass + except ('strerr1', KeyError): + pass + except h: + pass + except k: + pass + +tt = (KeyError, ValueError) + +def f5(a): + 'should not warn' + try: + f2(a) + except tt: + pass + +def f6(a): + 'should not warn' + # but does in 0.8.17 + try: + pass + except KeyboardInterrupt: + pass
