class.py :  » Development » PyChecker » pychecker-0.8.18 » pychecker2 » tests » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » PyChecker 
PyChecker » pychecker 0.8.18 » pychecker2 » tests » class.py
import compiler
import compiler                   as one
import compiler.ast              
import compiler.ast               as two
from compiler import ast
from compiler import ast
from compiler.ast import Const
from compiler.ast import Const

func = lambda x: x

class D:
    class B(compiler.ast.Const):
        inherited2 = 1
        def x(self):
            self.inherited1 = 1

class A(D.B):
    def __init__(self):
        self.x = 1                      # define x on A
        self.w.q = 1

    def f(s, self):                     # unusual self
        print self
        s.self = 1
        s = 7

    def x():                            # no self, redefine x on object
        pass

    def y(self):
        self.a, self.b = (1, 2)         # define a, b

    def _z(self):
        print self._z                   # method
        print self.x                    # assigned
        print self.a                    # unpacked
        print self.w                    # unknown
        print self.inherited1           # known from B
        print self.inherited2           # known from B
        print self.value                # from compiler.ast.Const, fails
        print self.goofy                # defined in class scope

    goofy = x
    
class E(one.ast.Const):
    def f(self):
        print self.value

class F(two.Const):
    def f(self):
        print self.value

class H(three.Const):
    def f(self):
        print self.value

class I(four):
    def f(self):
        print self.value

class J(ast.Const):
    def f(self):
        print self.value

class K(Const):
    def f(self):
        print self.value

#
# Various abusive imports, all under a non-global scope
#

def z(arg):
    from xml.dom import minidom

    class L(md.Node):
        def f(self):
            print arg, self.childNodes
    print L()

def zz(arg):
    from xml import dom

    class L(d.minidom.Node):
        def f(self):
            print arg, self.childNodes  # should fail
    print L()

def zzz(arg):
    from xml.dom.minidom import Node

    class L(X):
        def f(self):
            print arg, self.childNodes
    print L()

def zzzz(arg):
    from tests import nested

    class L(nested.N1.N2):
        def f(self):
            print self.x
    print L(), arg

class Base:
   def f(self, x): pass
class Derived(Base):
   def f(self): pass

class Node(compiler.ast.Node):
    def getChildren(self, x):
        return x

class Node2(compiler.ast.Slice):
    def __init__(self):
        return self

class BadSpecial:

    def __del__(self):
        return 0

    def __cmp__(self, x):
        return x

    def __len__(self):
        return 0

    def __le__(self):
        return 0

    def __gt__(self, a, b):
        return 0

    def __ge__(self, a, b = None, c = None):
        return 0

    def __setattr__(self, a = None):
        return 0

    def __not_special__(self):
        return 0
    
class Z1:
    class Z2:
        from xml.dom import minidom

class Z3(Z1.Z2.md.Node):
    def f(self):
        print self.childNodes

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.