This commit is contained in:
guanjihuan 2025-02-09 01:15:11 +08:00
parent 3da33141ea
commit 5dbbc968e2
3 changed files with 40 additions and 2 deletions

View File

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

View File

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

View File

@ -371,6 +371,15 @@ def get_string_between_two_patterns(original_string, start, end, include_start_a
else: else:
return '' 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): def print_array_with_index(array, show_index=1, index_type=0):
if show_index==0: if show_index==0:
@ -950,6 +959,35 @@ def get_PID_array(name):
id_running_array.append(ps_ef_2[1]) id_running_array.append(ps_ef_2[1])
return id_running_array 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次数的统计 # 每日git commit次数的统计
def statistics_of_git_commits(print_show=0, str_or_datetime='str'): def statistics_of_git_commits(print_show=0, str_or_datetime='str'):
import subprocess import subprocess