Пример #1
0
    print "sleeping s+t",s,t
    time.sleep(s+t)
    return "slept for t+s",s+t

def sleeping_time( atime = 1):
    print "sleeping_time",atime
    time.sleep( atime )
    return "slept for time atime"

def sleeping_a_time(a,atime = 1):
    print "sleeeeep"
    time.sleep( a+atime)
    return "slept for",a,atime
    

wrp = Wrapy()
# wrapy_ori_result = None, wrapy_pre_result=None
sleeping= wrp.prepost(sleeping,my_pre, my_post )
print sleeping( wrapy_ori_result=None, wrapy_pre_result=None)
sleeping_s = wrp.prepost(sleeping_s, my_pre, my_post )
print sleeping_s(1,wrapy_pre_result=None, wrapy_ori_result=None)
sleeping_st =  wrp.prepost(sleeping_st, my_pre, my_post )
print sleeping_st(1,1)
sleeping_time =  wrp.prepost(sleeping_time, my_pre, my_post )
print sleeping_time(atime = 1)
sleeping_a_time =  wrp.prepost(sleeping_a_time, my_pre, my_post )
print sleeping_a_time( 1, atime = 1)



Пример #2
0
def sleeping_s(s):
    print "sleeping s",s
    time.sleep(s)

def sleeping_st(s,t):
    print "sleeping s+t",s,t
    time.sleep(s+t)

def sleeping_time( atime = 1):
    print "sleeping_time",atime
    time.sleep( atime )

def sleeping_a_time(a,atime = 1):
    print "sleeping_a_time",a,atime

wrp = Wrapy()

sleeping = wrp.pre(sleeping, my_pre )
sleeping()
sleeping_s = wrp.pre(sleeping_s, my_pre )
sleeping_s(1)
sleeping_st =  wrp.pre(sleeping_st, my_pre )
sleeping_st(1,1)
sleeping_time =  wrp.pre(sleeping_time, my_pre )
sleeping_time(atime = 1)
sleeping_a_time =  wrp.pre(sleeping_a_time, my_pre )
sleeping_a_time( "ok", atime = 1)



Пример #3
0
    print "sleeping s",s
    time.sleep(s)
    return "slept for ",s

def sleeping_st(s,t):
    print "sleeping s+t",s,t
    time.sleep(s+t)

def sleeping_time( atime = 1):
    print "sleeping_time",atime
    time.sleep( atime )

def sleeping_a_time(a,atime = 1):
    print "sleeping_a_time",a,atime

wrp = Wrapy()

sleeping_s = wrp.prepost(sleeping_s,my_pre, my_post )
print sleeping_s( 3, wrapy_ori_result = None, wrapy_pre_result=None)

'''
sleeping_s = wrp.pref(sleeping_s, my_pref )
sleeping_s(1)
sleeping_st =  wrp.pref(sleeping_st, my_pref )
sleeping_st(1,1)
sleeping_time =  wrp.pref(sleeping_time, my_pref )
sleeping_time(atime = 1)
sleeping_a_time =  wrp.pref(sleeping_a_time, my_pref )
sleeping_a_time( "ok", atime = 1)
'''