From 5dbbc968e2d38eb70d5b38bc30dbc4813034ca8e Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Sun, 9 Feb 2025 01:15:11 +0800 Subject: [PATCH] 0.1.142 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/data_processing.py | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index dcfcf39..13dd8e5 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.141 +version = 0.1.142 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 9cb9f82..85bfe6c 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.2 Name: guan -Version: 0.1.141 +Version: 0.1.142 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index 9f52f24..1732a4c 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -371,6 +371,15 @@ def get_string_between_two_patterns(original_string, start, end, include_start_a else: return '' +# 打印数组 +def print_array(array, line_break=0): + if line_break == 0: + for i0 in array: + print(i0) + else: + for i0 in array: + print(i0+'\n') + # 以显示编号的样式,打印数组 def print_array_with_index(array, show_index=1, index_type=0): if show_index==0: @@ -950,6 +959,35 @@ def get_PID_array(name): id_running_array.append(ps_ef_2[1]) return id_running_array +# 寻找所有的git仓库 +def find_git_repositories(base_path='./', ignored_directory_with_words=[]): + import os + git_repository_array = [] + for root, dirs, files in os.walk(base_path): + if '.git' in dirs: + ignore_signal = 0 + for word in ignored_directory_with_words: + if word in root: + ignore_signal = 1 + break + if ignore_signal == 0: + git_repository_array.append(root) + return git_repository_array + +# 在git仓库列表中找到有修改待commit的 +def get_git_repositories_to_commit(git_repository_array): + import os + import subprocess + git_repository_array_to_commit = [] + for repository in git_repository_array: + os.chdir(repository) + status = subprocess.check_output(['git', 'status']).decode('utf-8') + if 'nothing to commit, working tree clean' in status: + pass + else: + git_repository_array_to_commit.append(repository) + return git_repository_array_to_commit + # 每日git commit次数的统计 def statistics_of_git_commits(print_show=0, str_or_datetime='str'): import subprocess