0.0.159
This commit is contained in:
parent
ef4dacfc25
commit
40497af8f5
@ -357,11 +357,11 @@ rgb = guan.hex_to_rgb(hex)
|
|||||||
|
|
||||||
guan.write_file_list_in_markdown(directory='./', filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None)
|
guan.write_file_list_in_markdown(directory='./', filename='a', reverse_positive_or_negative=1, starting_from_h1=None, banned_file_format=[], hide_file_format=None, divided_line=None, show_second_number=None, show_third_number=None)
|
||||||
|
|
||||||
repeated_file = guan.find_repeated_file_with_same_filename(directory='./', missed_directory='./missed_directory', num=1000)
|
repeated_file = guan.find_repeated_file_with_same_filename(directory='./', missed_directory_with_words=[], missed_file_with_words=[], num=1000)
|
||||||
|
|
||||||
guan.count_file_in_sub_directory(directory='./', smaller_than_num=None)
|
guan.count_file_in_sub_directory(directory='./', smaller_than_num=None)
|
||||||
|
|
||||||
guan.creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None)
|
guan.creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None, missed_directory_with_words=[])
|
||||||
|
|
||||||
guan.delete_file_with_specific_name(directory, filename='readme', file_format='.md')
|
guan.delete_file_with_specific_name(directory, filename='readme', file_format='.md')
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
# replace with your username:
|
# replace with your username:
|
||||||
name = guan
|
name = guan
|
||||||
version = 0.0.157
|
version = 0.0.159
|
||||||
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.0.157
|
Version: 0.0.159
|
||||||
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
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
|
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
|
||||||
|
|
||||||
# The current version is guan-0.0.157, updated on November 30, 2022.
|
# The current version is guan-0.0.159, updated on January 02, 2023.
|
||||||
|
|
||||||
# Installation: pip install --upgrade guan
|
# Installation: pip install --upgrade guan
|
||||||
|
|
||||||
@ -2823,14 +2823,19 @@ def write_file_list_in_markdown(directory='./', filename='a', reverse_positive_o
|
|||||||
f.write('###### '+str(filename6)+'\n\n')
|
f.write('###### '+str(filename6)+'\n\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def find_repeated_file_with_same_filename(directory='./', missed_directory='./missed_directory', num=1000):
|
def find_repeated_file_with_same_filename(directory='./', missed_directory_with_words=[], missed_file_with_words=[], num=1000):
|
||||||
import os
|
import os
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
file_list = []
|
file_list = []
|
||||||
for root, dirs, files in os.walk(directory):
|
for root, dirs, files in os.walk(directory):
|
||||||
for i0 in range(len(files)):
|
for i0 in range(len(files)):
|
||||||
if missed_directory not in root:
|
|
||||||
file_list.append(files[i0])
|
file_list.append(files[i0])
|
||||||
|
for word in missed_file_with_words:
|
||||||
|
if word in files[i0]:
|
||||||
|
file_list.remove(files[i0])
|
||||||
|
for word in missed_directory_with_words:
|
||||||
|
if word in root:
|
||||||
|
file_list.remove(files[i0])
|
||||||
count_file = Counter(file_list).most_common(num)
|
count_file = Counter(file_list).most_common(num)
|
||||||
repeated_file = []
|
repeated_file = []
|
||||||
for item in count_file:
|
for item in count_file:
|
||||||
@ -2862,7 +2867,7 @@ def count_file_in_sub_directory(directory='./', smaller_than_num=None):
|
|||||||
print(count_file)
|
print(count_file)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None):
|
def creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None, missed_directory_with_words=[]):
|
||||||
import os
|
import os
|
||||||
directory_with_file = []
|
directory_with_file = []
|
||||||
missed_directory = []
|
missed_directory = []
|
||||||
@ -2876,6 +2881,14 @@ def creat_necessary_file(directory, filename='readme', file_format='.md', conten
|
|||||||
if overwrite == None:
|
if overwrite == None:
|
||||||
for root in missed_directory:
|
for root in missed_directory:
|
||||||
directory_with_file.remove(root)
|
directory_with_file.remove(root)
|
||||||
|
missed_directory_more =[]
|
||||||
|
for root in directory_with_file:
|
||||||
|
for word in missed_directory_with_words:
|
||||||
|
if word in root:
|
||||||
|
if root not in missed_directory_more:
|
||||||
|
missed_directory_more.append(root)
|
||||||
|
for root in missed_directory_more:
|
||||||
|
directory_with_file.remove(root)
|
||||||
for root in directory_with_file:
|
for root in directory_with_file:
|
||||||
os.chdir(root)
|
os.chdir(root)
|
||||||
f = open(filename+file_format, 'w', encoding="utf-8")
|
f = open(filename+file_format, 'w', encoding="utf-8")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user