This commit is contained in:
guanjihuan 2025-03-20 05:29:42 +08:00
parent ede8d08443
commit 2bb0a1ab9b
2 changed files with 39 additions and 3 deletions

View File

@ -2,10 +2,24 @@
import guan
@guan.timer_decorator
def my_function():
def test1(a, b):
import time
print(a)
time.sleep(2)
print('Run finished')
print(b)
print('Run finished.')
for _ in range(3):
my_function()
test1(10, b=20)
print()
def test2(a, b):
import time
print(a)
time.sleep(2)
print(b)
print('Run finished.')
for _ in range(3):
guan.timer(test2, 10, b=20)

View File

@ -0,0 +1,22 @@
import guan
def test1(a, b):
print(a)
bug_code
print(b)
return 'return_message1'
result1 = guan.try_except(test1, 10, b=20)
print(result1)
print()
@guan.try_decorator
def test2(a, b):
print(a)
bug_code
print(b)
return 'return_message2'
result2 = test2(100, b=200)
print(result2)