codecheck update

This commit is contained in:
13339479676 2022-01-20 09:41:57 +08:00
parent f4c7541b1f
commit 6877f77573
3 changed files with 41 additions and 4 deletions

View File

@ -12,11 +12,10 @@
用于衡量代码复杂度(与代码可维护、测试性相关),圈复杂度越高,重构码出错的概率越高。<br>具体风险评估建议如下1-10低风险11-20中风险21-50高风险51+(极高风险)
用于衡量代码复杂度(与代码可维护、测试性相关),圈复杂度越高,重构码出错的概率越高。&lt;br&gt;具体风险评估建议如下:<font color="green">1-10低风险</font><font color=" #EEAD0E">11-20中风险</font><font color="red">21-50高风险</font><font color=" #8B2323">51+(极高风险)</font>
### 参考
- Gitee CodeCheck
- Gitee CodeCheck

View File

@ -1,2 +1,3 @@
opencv-python
PyYAML
PyYAML
tqdm

View File

@ -6,6 +6,8 @@ import zipfile
import tarfile
import sys
import os
from tqdm import tqdm
from time import sleep
ROOT_PATH = sys.path[0] # 项目根目录
COMPRESS_SUFFIX = ['zip', 'tar']
@ -18,6 +20,37 @@ def is_compressFile(compressStyle):
sys.exit()
# # webcam压缩
# def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompressFilePath, compressMode):
# if (is_autoCompressName):
# # 自动命名
# compressNameTmp = str(preCompressFilePath).split('/')[-1]
# compressName = f'{ROOT_PATH}/{compressNameTmp}.{compressStyle}'
# file_list = os.listdir(preCompressFilePath) # 获取目录下的文件名称
# # ----------压缩开始----------
# if (compressStyle == COMPRESS_SUFFIX[0]):
# # zip压缩
# compress_file = zipfile.ZipFile(compressName, compressMode)
# for i in range(len(file_list)):
# compressing_file = f'{preCompressFilePath}/{file_list[i]}'
# # print(f'正在压缩:{compressing_file}')
# compress_file.write(
# compressing_file, compress_type=zipfile.ZIP_DEFLATED)
# if (compressStyle == COMPRESS_SUFFIX[1]):
# # tar压缩
# compress_file = tarfile.open(compressName, compressMode)
# for i in range(len(file_list)):
# compressing_file = f'{preCompressFilePath}/{file_list[i]}'
# # print(f'正在压缩:{compressing_file}')
# compress_file.add(compressing_file)
# # ----------压缩结束----------
# compress_file.close()
# print(f'文件压缩成功!已保存在:{compressName}')
# webcam压缩
def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompressFilePath, compressMode):
if (is_autoCompressName):
@ -26,6 +59,10 @@ def webcam_compress(compressStyle, is_autoCompressName, compressName, preCompres
compressName = f'{ROOT_PATH}/{compressNameTmp}.{compressStyle}'
file_list = os.listdir(preCompressFilePath) # 获取目录下的文件名称
pbar = tqdm(file_list)
for char in pbar:
sleep(0.25)
pbar.set_description("Processing %s" % char)
# ----------压缩开始----------
if (compressStyle == COMPRESS_SUFFIX[0]):