This commit is contained in:
guanjihuan 2023-12-31 07:15:56 +08:00
parent 1e5348e045
commit 4b60064b17
5 changed files with 31 additions and 10 deletions

View File

@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = guan
version = 0.1.69
version = 0.1.70
author = guanjihuan
author_email = guanjihuan@163.com
description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: guan
Version: 0.1.69
Version: 0.1.70
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan

View File

@ -6,7 +6,7 @@ import guan
def test():
import guan
current_version = guan.get_current_version('guan')
print(f'\nCongratulations on successfully installing Guan package! The installed version is guan-{current_version}.')
print(f'Congratulations on successfully installing Guan package! The installed version is guan-{current_version}.')
# 泡利矩阵
@guan.statistics_decorator

View File

@ -402,6 +402,34 @@ def color_matplotlib():
color_array = ['tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan']
return color_array
# 如果不存在文件夹,则新建文件夹
@guan.statistics_decorator
def make_directory(directory='./test'):
import os
if not os.path.exists(directory):
os.makedirs(directory)
# 如果不存在文件,则新建空文件
@guan.statistics_decorator
def make_file(file_path='./a.txt'):
import os
if not os.path.exists(file_path):
with open(file_path, 'w') as f:
pass
# 读取文本文件内容,如果不存在,则新建空文件
@guan.statistics_decorator
def read_text_file(file_path='./a.txt'):
import os
if not os.path.exists(file_path):
with open(file_path, 'w') as f:
pass
return ''
else:
with open(file_path, 'r') as f:
content = f.read()
return content
# 将变量存到文件
@guan.statistics_decorator
def dump_data(data, filename, file_format='.txt'):

View File

@ -1,13 +1,6 @@
# Module: others
import guan
# 如果不存在文件夹,则新建文件夹
@guan.statistics_decorator
def make_directory(directory='./test'):
import os
if not os.path.exists(directory):
os.makedirs(directory)
# 获取当前日期字符串
@guan.statistics_decorator
def get_date(bar=True):