0.1.16
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
[metadata]
 | 
					[metadata]
 | 
				
			||||||
# replace with your username:
 | 
					# replace with your username:
 | 
				
			||||||
name = guan
 | 
					name = guan
 | 
				
			||||||
version = 0.1.15
 | 
					version = 0.1.16
 | 
				
			||||||
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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
Metadata-Version: 2.1
 | 
					Metadata-Version: 2.1
 | 
				
			||||||
Name: guan
 | 
					Name: guan
 | 
				
			||||||
Version: 0.1.15
 | 
					Version: 0.1.16
 | 
				
			||||||
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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -308,20 +308,23 @@ def find_repeated_file_with_same_filename(directory='./', ignored_directory_with
 | 
				
			|||||||
    return repeated_file
 | 
					    return repeated_file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 统计各个子文件夹中的文件数量
 | 
					# 统计各个子文件夹中的文件数量
 | 
				
			||||||
def count_file_in_sub_directory(directory='./', smaller_than_num=None):
 | 
					def count_file_in_sub_directory(directory='./', smaller_than_num=None, sort=0):
 | 
				
			||||||
    import os
 | 
					    import os
 | 
				
			||||||
    from collections import Counter
 | 
					    import numpy as np
 | 
				
			||||||
    dirs_list = []
 | 
					    dirs_list = []
 | 
				
			||||||
    for root, dirs, files in os.walk(directory):
 | 
					    for root, dirs, files in os.walk(directory):
 | 
				
			||||||
        if dirs != []:
 | 
					        if dirs != []:
 | 
				
			||||||
            for i0 in range(len(dirs)):
 | 
					            for i0 in range(len(dirs)):
 | 
				
			||||||
                dirs_list.append(root+'/'+dirs[i0])
 | 
					                dirs_list.append(root+'/'+dirs[i0])
 | 
				
			||||||
 | 
					    count_file_array = []
 | 
				
			||||||
    for sub_dir in dirs_list:
 | 
					    for sub_dir in dirs_list:
 | 
				
			||||||
        file_list = []
 | 
					        file_list = []
 | 
				
			||||||
        for root, dirs, files in os.walk(sub_dir):
 | 
					        for root, dirs, files in os.walk(sub_dir):
 | 
				
			||||||
            for i0 in range(len(files)):
 | 
					            for i0 in range(len(files)):
 | 
				
			||||||
                file_list.append(files[i0])
 | 
					                file_list.append(files[i0])
 | 
				
			||||||
        count_file = len(file_list)
 | 
					        count_file = len(file_list)
 | 
				
			||||||
 | 
					        count_file_array.append(count_file)
 | 
				
			||||||
 | 
					        if sort == 0:
 | 
				
			||||||
            if smaller_than_num == None:
 | 
					            if smaller_than_num == None:
 | 
				
			||||||
                print(sub_dir)
 | 
					                print(sub_dir)
 | 
				
			||||||
                print(count_file)
 | 
					                print(count_file)
 | 
				
			||||||
@@ -331,8 +334,22 @@ def count_file_in_sub_directory(directory='./', smaller_than_num=None):
 | 
				
			|||||||
                    print(sub_dir)
 | 
					                    print(sub_dir)
 | 
				
			||||||
                    print(count_file)
 | 
					                    print(count_file)
 | 
				
			||||||
                    print()
 | 
					                    print()
 | 
				
			||||||
 | 
					    if sort == 1:
 | 
				
			||||||
 | 
					        index_array = np.argsort(count_file_array)
 | 
				
			||||||
 | 
					        if smaller_than_num == None:
 | 
				
			||||||
 | 
					            for i0 in index_array:
 | 
				
			||||||
 | 
					                print(dirs_list[i0])
 | 
				
			||||||
 | 
					                print(count_file_array[i0])
 | 
				
			||||||
 | 
					                print()
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            for i0 in index_array:
 | 
				
			||||||
 | 
					                if count_file_array[i0]<smaller_than_num:
 | 
				
			||||||
 | 
					                    print(dirs_list[i0])
 | 
				
			||||||
 | 
					                    print(count_file_array[i0])
 | 
				
			||||||
 | 
					                    print()
 | 
				
			||||||
    import guan
 | 
					    import guan
 | 
				
			||||||
    guan.statistics_of_guan_package()
 | 
					    guan.statistics_of_guan_package()
 | 
				
			||||||
 | 
					    return dirs_list, count_file_array
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 产生必要的文件,例如readme.md
 | 
					# 产生必要的文件,例如readme.md
 | 
				
			||||||
def creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None, ignored_directory_with_words=[]):
 | 
					def creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None, ignored_directory_with_words=[]):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user