This commit is contained in:
2025-03-20 04:10:31 +08:00
parent e766e8fb2c
commit 2b753c38b6
5 changed files with 25 additions and 673 deletions

View File

@@ -1,6 +1,6 @@
Metadata-Version: 2.2
Metadata-Version: 2.4
Name: guan
Version: 0.1.164
Version: 0.1.165
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan
@@ -12,5 +12,6 @@ Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file
Guan is an open-source python package developed and maintained by https://www.guanjihuan.com/about (Ji-Huan Guan, 关济寰). The primary location of this package is on website https://py.guanjihuan.com. The GitHub location of this package is on https://github.com/guanjihuan/py.guanjihuan.com.

View File

@@ -86,6 +86,13 @@ def run(function_name, *args, **kwargs):
pass
return return_data
# 使用该函数实现 try except 结构
def try_except(function_name, *args, **kwargs):
try:
return function_name(*args, **kwargs)
except:
pass
# 获取运行的日期和时间并写入文件
def statistics_with_day_and_time(content='', filename='time_logging', file_format='.txt'):
import datetime

View File

@@ -58,6 +58,15 @@ def timer_decorator_with_parameters(unit='second', print_show=1, write_file=0, f
return wrapper
return timer_decorator
# 函数的装饰器,用于实现 try except 结构
def try_decorator(func):
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
pass
return wrapper
# # 函数的装饰器用于GUAN软件包函数的使用统计
# def statistics_decorator(func):
# def wrapper(*args, **kwargs):