0.1.117
This commit is contained in:
parent
79ff1cf345
commit
5299bb6891
@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
# replace with your username:
|
||||
name = guan
|
||||
version = 0.1.115
|
||||
version = 0.1.117
|
||||
author = guanjihuan
|
||||
author_email = guanjihuan@163.com
|
||||
description = An open source python package
|
||||
|
@ -1,6 +1,6 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: guan
|
||||
Version: 0.1.115
|
||||
Version: 0.1.117
|
||||
Summary: An open source python package
|
||||
Home-page: https://py.guanjihuan.com
|
||||
Author: guanjihuan
|
||||
|
@ -11,6 +11,7 @@ src/guan/basic_functions.py
|
||||
src/guan/data_processing.py
|
||||
src/guan/decorators.py
|
||||
src/guan/density_of_states.py
|
||||
src/guan/deprecated.py
|
||||
src/guan/figure_plotting.py
|
||||
src/guan/file_reading_and_writing.py
|
||||
src/guan/machine_learning.py
|
||||
|
@ -14,4 +14,5 @@ from .figure_plotting import *
|
||||
from .data_processing import *
|
||||
from .others import *
|
||||
from .decorators import *
|
||||
from .deprecated import *
|
||||
statistics_of_guan_package()
|
29
PyPI/src/guan/deprecated.py
Normal file
29
PyPI/src/guan/deprecated.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Module: deprecated
|
||||
|
||||
def plot_without_starting_fig(plt, fig, ax, x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, style='', y_min=None, y_max=None, linewidth=None, markersize=None, color=None, fontfamily='Times New Roman'):
|
||||
import guan
|
||||
print('Warning: The current function name has been deprecated, which will be deleted in the future version. Please change it into guan.plot_without_starting_fig_ax().')
|
||||
guan.plot_without_starting_fig_ax(plt, fig, ax, x_array, y_array, xlabel=xlabel, ylabel=ylabel, title=title, fontsize=fontsize, style=style, y_min=y_min, y_max=y_max, linewidth=linewidth, markersize=markersize, color=color, fontfamily=fontfamily)
|
||||
|
||||
def draw_dots_and_lines_without_starting_fig(plt, fig, ax, coordinate_array, draw_dots=1, draw_lines=1, max_distance=1, line_style='-k', linewidth=1, dot_style='ro', markersize=3):
|
||||
import guan
|
||||
print('Warning: The current function name has been deprecated, which will be deleted in the future version. Please change it into guan.draw_dots_and_lines_without_starting_fig_ax().')
|
||||
guan.draw_dots_and_lines_without_starting_fig_ax(plt, fig, ax, coordinate_array, draw_dots=draw_dots, draw_lines=draw_lines, max_distance=max_distance, line_style=line_style, linewidth=linewidth, dot_style=dot_style, markersize=markersize)
|
||||
|
||||
def get_days_of_the_current_month(str_or_datetime='str'):
|
||||
import guan
|
||||
print('Warning: The current function name has been deprecated, which will be deleted in the future version. Please change it into guan.get_date_array_of_the_current_month().')
|
||||
date_array = guan.get_date_array_of_the_current_month(str_or_datetime=str_or_datetime)
|
||||
return date_array
|
||||
|
||||
def get_days_of_the_last_month(str_or_datetime='str'):
|
||||
import guan
|
||||
print('Warning: The current function name has been deprecated, which will be deleted in the future version. Please change it into guan.get_date_array_of_the_last_month().')
|
||||
date_array = guan.get_date_array_of_the_last_month(str_or_datetime=str_or_datetime)
|
||||
return date_array
|
||||
|
||||
def get_days_of_the_month_before_last(str_or_datetime='str'):
|
||||
import guan
|
||||
print('Warning: The current function name has been deprecated, which will be deleted in the future version. Please change it into guan.get_date_array_of_the_month_before_last().')
|
||||
date_array = guan.get_date_array_of_the_month_before_last(str_or_datetime=str_or_datetime)
|
||||
return date_array
|
@ -13,7 +13,7 @@ def import_plt_and_start_fig_ax(adjust_bottom=0.2, adjust_left=0.2, labelsize=20
|
||||
return plt, fig, ax
|
||||
|
||||
# 基于plt, fig, ax画图
|
||||
def plot_without_starting_fig(plt, fig, ax, x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, style='', y_min=None, y_max=None, linewidth=None, markersize=None, color=None, fontfamily='Times New Roman'):
|
||||
def plot_without_starting_fig_ax(plt, fig, ax, x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, style='', y_min=None, y_max=None, linewidth=None, markersize=None, color=None, fontfamily='Times New Roman'):
|
||||
if color==None:
|
||||
ax.plot(x_array, y_array, style, linewidth=linewidth, markersize=markersize)
|
||||
else:
|
||||
@ -298,7 +298,7 @@ def plot_pcolor(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', font
|
||||
plt.close('all')
|
||||
|
||||
# 基于plt, fig, ax,通过坐标画点和线
|
||||
def draw_dots_and_lines_without_starting_fig(plt, fig, ax, coordinate_array, draw_dots=1, draw_lines=1, max_distance=1, line_style='-k', linewidth=1, dot_style='ro', markersize=3):
|
||||
def draw_dots_and_lines_without_starting_fig_ax(plt, fig, ax, coordinate_array, draw_dots=1, draw_lines=1, max_distance=1, line_style='-k', linewidth=1, dot_style='ro', markersize=3):
|
||||
import numpy as np
|
||||
coordinate_array = np.array(coordinate_array)
|
||||
if draw_lines==1:
|
||||
|
@ -32,6 +32,31 @@ def get_memory_info():
|
||||
used_memory_percent = memory_info.percent
|
||||
return total_memory, used_memory, available_memory, used_memory_percent
|
||||
|
||||
# 每日git commit次数的统计
|
||||
def statistics_of_git_commits(print_show=0, str_or_datetime='str'):
|
||||
import subprocess
|
||||
import collections
|
||||
since_date = '100 year ago'
|
||||
result = subprocess.run(
|
||||
['git', 'log', f'--since={since_date}', '--pretty=format:%ad', '--date=short'],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True)
|
||||
commits = result.stdout.strip().split('\n')
|
||||
counter = collections.Counter(commits)
|
||||
daily_commit_counts = dict(sorted(counter.items()))
|
||||
date_array = []
|
||||
commit_count_array = []
|
||||
for date, count in daily_commit_counts.items():
|
||||
if print_show == 1:
|
||||
print(f"{date}: {count} commits")
|
||||
if str_or_datetime=='datetime':
|
||||
import datetime
|
||||
date_array.append(datetime.datetime.strptime(date, "%Y-%m-%d"))
|
||||
elif str_or_datetime=='str':
|
||||
date_array.append(date)
|
||||
commit_count_array.append(count)
|
||||
return date_array, commit_count_array
|
||||
|
||||
# 将WordPress导出的XML格式文件转换成多个MarkDown格式的文件
|
||||
def convert_wordpress_xml_to_markdown(xml_file='./a.xml', convert_content=1, replace_more=[]):
|
||||
import xml.etree.ElementTree as ET
|
||||
@ -94,7 +119,7 @@ def count_number_of_import_statements(filename, file_format='.py', num=1000):
|
||||
return import_statement_counter
|
||||
|
||||
# 获取本月的所有日期
|
||||
def get_days_of_the_current_month(str_or_datetime='str'):
|
||||
def get_date_array_of_the_current_month(str_or_datetime='str'):
|
||||
import datetime
|
||||
today = datetime.date.today()
|
||||
first_day_of_month = today.replace(day=1)
|
||||
@ -103,14 +128,25 @@ def get_days_of_the_current_month(str_or_datetime='str'):
|
||||
else:
|
||||
next_month = first_day_of_month.replace(month=first_day_of_month.month + 1)
|
||||
current_date = first_day_of_month
|
||||
day_array = []
|
||||
date_array = []
|
||||
while current_date < next_month:
|
||||
if str_or_datetime=='str':
|
||||
day_array.append(str(current_date))
|
||||
date_array.append(str(current_date))
|
||||
elif str_or_datetime=='datetime':
|
||||
day_array.append(current_date)
|
||||
date_array.append(current_date)
|
||||
current_date += datetime.timedelta(days=1)
|
||||
return day_array
|
||||
return date_array
|
||||
|
||||
# 根据新的日期,填充数组中缺少的数据为零
|
||||
def fill_zero_data_for_new_dates(old_dates, new_dates, old_data_array):
|
||||
new_data_array = []
|
||||
for date in new_dates:
|
||||
if str(date) not in old_dates:
|
||||
new_data_array.append(0)
|
||||
else:
|
||||
index = old_dates.index(date)
|
||||
new_data_array.append(old_data_array[index])
|
||||
return new_data_array
|
||||
|
||||
# 获取上个月份
|
||||
def get_last_month():
|
||||
@ -142,7 +178,7 @@ def get_the_month_before_last():
|
||||
return year_of_the_month_before_last, the_month_before_last
|
||||
|
||||
# 获取上个月的所有日期
|
||||
def get_days_of_the_last_month(str_or_datetime='str'):
|
||||
def get_date_array_of_the_last_month(str_or_datetime='str'):
|
||||
import datetime
|
||||
import guan
|
||||
today = datetime.date.today()
|
||||
@ -153,17 +189,17 @@ def get_days_of_the_last_month(str_or_datetime='str'):
|
||||
else:
|
||||
next_month = first_day_of_month.replace(month=first_day_of_month.month + 1)
|
||||
current_date = first_day_of_month
|
||||
day_array = []
|
||||
date_array = []
|
||||
while current_date < next_month:
|
||||
if str_or_datetime=='str':
|
||||
day_array.append(str(current_date))
|
||||
date_array.append(str(current_date))
|
||||
elif str_or_datetime=='datetime':
|
||||
day_array.append(current_date)
|
||||
date_array.append(current_date)
|
||||
current_date += datetime.timedelta(days=1)
|
||||
return day_array
|
||||
return date_array
|
||||
|
||||
# 获取上上个月的所有日期
|
||||
def get_days_of_the_month_before_last(str_or_datetime='str'):
|
||||
def get_date_array_of_the_month_before_last(str_or_datetime='str'):
|
||||
import datetime
|
||||
import guan
|
||||
today = datetime.date.today()
|
||||
@ -174,14 +210,14 @@ def get_days_of_the_month_before_last(str_or_datetime='str'):
|
||||
else:
|
||||
next_month = first_day_of_month.replace(month=first_day_of_month.month + 1)
|
||||
current_date = first_day_of_month
|
||||
day_array = []
|
||||
date_array = []
|
||||
while current_date < next_month:
|
||||
if str_or_datetime=='str':
|
||||
day_array.append(str(current_date))
|
||||
date_array.append(str(current_date))
|
||||
elif str_or_datetime=='datetime':
|
||||
day_array.append(current_date)
|
||||
date_array.append(current_date)
|
||||
current_date += datetime.timedelta(days=1)
|
||||
return day_array
|
||||
return date_array
|
||||
|
||||
# 获取所有股票
|
||||
def all_stocks():
|
||||
|
Loading…
x
Reference in New Issue
Block a user