guan-0.0.138
This commit is contained in:
		| @@ -343,6 +343,10 @@ guan.write_file_list_in_markdown(directory, filename='a', reverse_positive_or_ne | ||||
|  | ||||
| repeated_file = guan.find_repeated_file_with_same_filename(directory, num=1000) | ||||
|  | ||||
| guan.creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None) | ||||
|  | ||||
| guan.delete_file_with_specific_name(directory, filename='readme', file_format='.md') | ||||
|  | ||||
| guan.move_all_files_to_root_directory(directory) | ||||
|  | ||||
| guan.change_directory_by_replacement(current_key_word='code', new_key_word='data') | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| [metadata] | ||||
| # replace with your username: | ||||
| name = guan | ||||
| version = 0.0.137 | ||||
| version = 0.0.138 | ||||
| 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.0.137 | ||||
| Version: 0.0.138 | ||||
| Summary: An open source python package | ||||
| Home-page: https://py.guanjihuan.com | ||||
| 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. | ||||
|  | ||||
| # The current version is guan-0.0.137, updated on September 14, 2022. | ||||
| # The current version is guan-0.0.138, updated on September 15, 2022. | ||||
|  | ||||
| # Installation: pip install --upgrade guan | ||||
|  | ||||
| @@ -2679,13 +2679,20 @@ def find_repeated_file_with_same_filename(directory, num=1000): | ||||
|             repeated_file.append(item) | ||||
|     return repeated_file | ||||
|  | ||||
| def creat_necessary_file(directory, filename='readme', file_format='.md', content=''): | ||||
| def creat_necessary_file(directory, filename='readme', file_format='.md', content='', overwrite=None): | ||||
|     import os | ||||
|     directory_with_file = [] | ||||
|     missed_directory = [] | ||||
|     for root, dirs, files in os.walk(directory): | ||||
|         for i0 in range(len(files)): | ||||
|             if root not in directory_with_file: | ||||
|                 directory_with_file.append(root) | ||||
|             if files[i0] == filename+file_format: | ||||
|                 if root not in missed_directory: | ||||
|                     missed_directory.append(root) | ||||
|     if overwrite == None: | ||||
|         for root in missed_directory: | ||||
|             directory_with_file.remove(root) | ||||
|     for root in directory_with_file: | ||||
|         os.chdir(root) | ||||
|         f = open(filename+file_format, 'w', encoding="utf-8") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user