GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a ruby-to-pyc compiler
Clone URL: git://github.com/why/unholy.git
commit  12d52c4ce7154d3cd8300be129d15ed7e57e8b1e
tree    e914a334f60827097074f2570f76e66d0588f0b1
parent  3fa5d7dd9a996c915b4c7415283b493de0790ede
unholy / decompyle / test / test_nested_scopes.py
100644 96 lines (80 sloc) 1.656 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# test_nested_scopes.py -- source test pattern for nested scopes
#
# This source is part of the decompyle test suite.
#
# decompyle is a Python byte-code decompiler
# See http://www.goebel-consult.de/decompyle/ for download and
# for further information
 
from __future__ import nested_scopes
 
blurb = 1
 
def k0():
    def l0(m=1):
        print
    l0()
 
def x0():
    def y0():
        print
    y0()
 
def x1():
     def y1():
         print 'y-blurb =', blurb
     y1()
 
def x2():
    def y2():
        print
    blurb = 2
    y2()
 
def x3a():
    def y3a(x):
        print 'y-blurb =', blurb, flurb
    print
    blurb = 3
    flurb = 7
    y3a(1)
    print 'x3a-blurb =', blurb
 
def x3():
    def y3(x):
        def z():
            blurb = 25
            print 'z-blurb =', blurb,
        z()
        print 'y-blurb =', blurb,
    print
    blurb = 3
    y3(1)
    print 'x3-blurb =', blurb
 
def x3b():
    def y3b(x):
        def z():
            print 'z-blurb =', blurb,
        blurb = 25
        z()
        print 'y-blurb =', blurb,
    print
    blurb = 3
    y3b(1)
    print 'x3-blurb =', blurb
 
def x4():
    def y4(x):
        def z():
            print 'z-blurb =', blurb
        z()
    global blurb
    blurb = 3
    y4(1)
 
def x():
    def y(x):
        print 'y-blurb =', blurb
    blurb = 2
    y(1)
 
 
def func_with_tuple_args6((a,b), (c,d)=(2,3), *args, **kwargs):
    def y(x):
        print 'y-a =', a
    print c
 
def find(self, name):
    # This is taken from 'What's new in Python 2.1' by amk
    L = filter(lambda x, name: x == name, self.list_attribute)
 
x0(); x1(); x2();
x3(); x3a(); x3b();
x4(); x()
print 'blurb =', blurb