smartpush 1.0.3__py3-none-any.whl → 1.0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartpush/export/basic/ExcelExportChecker.py +12 -4
- smartpush/felix_test.py +1 -1
- {smartpush-1.0.3.dist-info → smartpush-1.0.3.1.dist-info}/METADATA +1 -1
- smartpush-1.0.3.1.dist-info/RECORD +10 -0
- smartpush-1.0.3.dist-info/RECORD +0 -10
- {smartpush-1.0.3.dist-info → smartpush-1.0.3.1.dist-info}/WHEEL +0 -0
- {smartpush-1.0.3.dist-info → smartpush-1.0.3.1.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,15 @@
|
|
1
1
|
import os
|
2
|
+
import re
|
2
3
|
from io import BytesIO
|
3
4
|
import pandas as pd
|
4
5
|
import numpy as np
|
6
|
+
import warnings
|
5
7
|
from requests import request
|
6
8
|
"""
|
7
9
|
用于excel校验
|
8
10
|
"""
|
9
11
|
|
12
|
+
|
10
13
|
def read_excel_from_oss(method="get", url=""):
|
11
14
|
"""读取oss的excel内容并写入到本地csv"""
|
12
15
|
try:
|
@@ -28,7 +31,9 @@ def read_excel_and_write_to_dict(excel_data=None, file_name=None):
|
|
28
31
|
pass
|
29
32
|
elif file_name is not None:
|
30
33
|
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
31
|
-
|
34
|
+
with warnings.catch_warnings():
|
35
|
+
warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
|
36
|
+
df = pd.read_excel(excel_data, engine="openpyxl")
|
32
37
|
# 将DataFrame转换为字典,以行为单位存储数据
|
33
38
|
row_dict = {} # 创建一个空字典来存储按行转换的数据
|
34
39
|
for index, row in df.iterrows(): # 遍历DataFrame中的每一行
|
@@ -48,12 +53,15 @@ def read_excel_and_write_to_list(excel_data=None, file_name=None):
|
|
48
53
|
pass
|
49
54
|
elif file_name is not None:
|
50
55
|
excel_data = os.path.join(os.path.dirname(os.getcwd()) + "/check_file/" + file_name)
|
51
|
-
|
56
|
+
|
57
|
+
with warnings.catch_warnings():
|
58
|
+
warnings.filterwarnings("ignore", category=UserWarning, module=re.escape('openpyxl.styles.stylesheet'))
|
59
|
+
df = pd.read_excel(excel_data, engine="openpyxl")
|
52
60
|
# 将DataFrame转换为字典,以行为单位存储数据
|
53
61
|
rows_list = df.values.tolist()
|
54
62
|
return rows_list
|
55
63
|
except Exception as e:
|
56
|
-
print(f"excel写入
|
64
|
+
print(f"excel写入list时出错:{e}")
|
57
65
|
|
58
66
|
|
59
67
|
def read_excel_and_write_to_csv(excel_data, file_name):
|
@@ -82,7 +90,7 @@ def check_excel(actual, expected):
|
|
82
90
|
expected_num = len(expected)
|
83
91
|
check_row = actual_num - expected_num
|
84
92
|
if check_row == 0:
|
85
|
-
|
93
|
+
errors.append("预期和实际行数相等,为" + str(actual_num) + "行")
|
86
94
|
else:
|
87
95
|
errors.append(
|
88
96
|
"行数和预期对比差" + check_row.__str__() + "行" + ", 实际:" + str(actual_num) + "预期: " + str(
|
smartpush/felix_test.py
CHANGED
@@ -6,6 +6,6 @@ if __name__ == '__main__':
|
|
6
6
|
|
7
7
|
ossurl = "https://sl-smartfile.oss-ap-southeast-1.aliyuncs.com/material_ec2/2025-01-16/8556e34c8d4d45f0bb2d42dc8871a90b/%E8%A1%A8%E5%8D%95%E4%BB%BB%E5%8A%A1%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
|
8
8
|
excelOss = ExcelExportChecker.read_excel_from_oss(url=ossurl)
|
9
|
-
excelList = ExcelExportChecker.
|
9
|
+
excelList = ExcelExportChecker.read_excel_and_write_to_dict(excel_data=excelOss)
|
10
10
|
print(excelList)
|
11
11
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
|
+
smartpush/felix_test.py,sha256=5ke2JOal9FWC5GK4Qpdzlt7Tdlab1vb4LJyBLTd3hYk,476
|
3
|
+
smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
|
4
|
+
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
5
|
+
smartpush/export/basic/ExcelExportChecker.py,sha256=N_vQL2AWX2CfakfH6QJLhkx3EcRiqFmAdX7F5HJRlMk,4794
|
6
|
+
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
7
|
+
smartpush-1.0.3.1.dist-info/METADATA,sha256=cuwVFc6-wYLsmDg9y3KQRb86JuwJ89nfdFSrzAXpg30,147
|
8
|
+
smartpush-1.0.3.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
+
smartpush-1.0.3.1.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
10
|
+
smartpush-1.0.3.1.dist-info/RECORD,,
|
smartpush-1.0.3.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
|
-
smartpush/felix_test.py,sha256=I7DkMnqRUa48ALyawoJtPh74zRR86OO3oRnkBi9qJRQ,476
|
3
|
-
smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
|
4
|
-
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
5
|
-
smartpush/export/basic/ExcelExportChecker.py,sha256=3brXFECXhTMuVnB-CLnaLBK5CZPW2TuooL0n_B6iigg,4374
|
6
|
-
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
7
|
-
smartpush-1.0.3.dist-info/METADATA,sha256=TgyZqa2PcOcQ3t1sG7qiGoGW10kwhoSji2z9mQ76pZM,145
|
8
|
-
smartpush-1.0.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
-
smartpush-1.0.3.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
10
|
-
smartpush-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|