smartpush 1.1.8__py3-none-any.whl → 1.2.0__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.
@@ -23,19 +23,22 @@ def read_excel_from_oss(url="", method="get"):
23
23
  print(f"读取oss报错 {url} 时出错:{e}")
24
24
 
25
25
 
26
- def read_excel_header(excel_data, return_type='list', **kwargs) -> list | dict:
26
+ def read_excel_header(excel_data, return_type='list', **kwargs):
27
27
  """
28
28
  1、读出excel的头列 list
29
29
  """
30
30
  try:
31
31
  result = []
32
32
  result_dict = {}
33
- skip_rows = kwargs.pop('skiprows', 0) - 1 if 'skiprows' in kwargs else 0
33
+ skip_rows, skip_flags = (kwargs.pop('skiprows'), True) if 'skiprows' in kwargs else (0, False)
34
34
  dfs = read_excel_csv_data(excel_data, **kwargs)
35
35
  if kwargs.get('type', None) in excel_extensions:
36
36
  for sheet_name, df in dfs.items():
37
- # result.append(df.keys().values.tolist())
38
- headers = df.iloc[skip_rows].tolist()
37
+ if skip_flags:
38
+ # 因为单元格合并并且跳过存在动态参数,所以这里简单粗暴set去重
39
+ headers = list(set(df.iloc[skip_rows - 1].tolist()))
40
+ else:
41
+ headers = df.iloc[skip_rows].tolist()
39
42
  result.append(headers)
40
43
  result_dict[sheet_name] = headers
41
44
  if return_type == 'list':
@@ -84,12 +87,14 @@ def read_excel_and_write_to_dict(excel_data=None, file_name=None, **kwargs):
84
87
  for sheet_name, row in dfs.items():
85
88
  row = row.to_dict(orient='records')
86
89
  if kwargs.get("ignore_sort", False):
87
- sorted_data_asc = sorted(row[0:], key=lambda x: x[0], reverse=True) # 内部排序
90
+ sorted_data_asc = sorted(row[1:], key=lambda x: x[1], reverse=True) # 内部排序
91
+ sorted_data_asc = [row[0]]+sorted_data_asc
88
92
  row_dict[sheet_name] = sorted_data_asc
89
93
  else:
90
94
  row_dict[sheet_name] = row
91
95
  else:
92
96
  row_dict = dfs.to_dict()
97
+ print(row_dict)
93
98
  return row_dict
94
99
  except zipfile.BadZipFile:
95
100
  print(f"文件读取错误,请检查文件是否为无效文件:{dfs}")
smartpush/test.py CHANGED
@@ -13,15 +13,16 @@ if __name__ == '__main__':
13
13
  oss1 = "https://cdn.smartpushedm.com/material_ec2/2025-02-20/ad9e1534b8134dd098e96813f17d4b4d/%E6%B5%8B%E8%AF%95flow%E6%95%B0%E6%8D%AE%E6%8A%A5%E5%91%8A%E5%AF%BC%E5%87%BA%E5%8B%BF%E5%8A%A8%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
14
14
  oss2 = "https://cdn.smartpushedm.com/material_ec2/2025-02-21/bbe660950493411d88b4a75ed0893ec8/%E6%B5%8B%E8%AF%95flow%E6%95%B0%E6%8D%AE%E6%8A%A5%E5%91%8A%E5%AF%BC%E5%87%BA%E5%8B%BF%E5%8A%A8%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
15
15
  # # print(check_excel_all(oss1, oss1))
16
- # oss3 = "https://cdn.smartpushedm.com/material_ec2/2025-02-25/58c4a3a885884741b22380c360ac2894/【自动化导出】营销活动URL点击与热图.xlsx"
17
- # oss4 = "https://cdn.smartpushedm.com/material_ec2/2025-02-26/58cee630b4c84eec9572b867af4ce692/%E3%80%90%E8%87%AA%E5%8A%A8%E5%8C%96%E5%AF%BC%E5%87%BA%E3%80%91%E8%90%A5%E9%94%80%E6%B4%BB%E5%8A%A8URL%E7%82%B9%E5%87%BB%E4%B8%8E%E7%83%AD%E5%9B%BE.xlsx"
16
+ oss3 = "https://cdn.smartpushedm.com/material_ec2/2025-02-25/58c4a3a885884741b22380c360ac2894/【自动化导出】营销活动URL点击与热图.xlsx"
17
+ oss4 = "https://cdn.smartpushedm.com/material_ec2/2025-02-26/58cee630b4c84eec9572b867af4ce692/%E3%80%90%E8%87%AA%E5%8A%A8%E5%8C%96%E5%AF%BC%E5%87%BA%E3%80%91%E8%90%A5%E9%94%80%E6%B4%BB%E5%8A%A8URL%E7%82%B9%E5%87%BB%E4%B8%8E%E7%83%AD%E5%9B%BE.xlsx"
18
18
  expected_oss ="https://cdn.smartpushedm.com/material_ec2/2025-02-26/757df7e77ce544e193257c0da35a4983/%E3%80%90%E8%87%AA%E5%8A%A8%E5%8C%96%E5%AF%BC%E5%87%BA%E3%80%91%E8%90%A5%E9%94%80%E6%B4%BB%E5%8A%A8%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
19
19
  actual_oss = "https://cdn.smartpushedm.com/material_ec2/2025-02-26/757df7e77ce544e193257c0da35a4983/%E3%80%90%E8%87%AA%E5%8A%A8%E5%8C%96%E5%AF%BC%E5%87%BA%E3%80%91%E8%90%A5%E9%94%80%E6%B4%BB%E5%8A%A8%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
20
20
  # # #actual_oss= get_oss_address_with_retry("23161","https://cdn.smartpushedm.com/material_ec2_prod/2025-02-20/dae941ec20964ca5b106407858676f89/%E7%BE%A4%E7%BB%84%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx","",'{"page":1,"pageSize":10,"type":null,"status":null,"startTime":null,"endTime":null}')
21
21
  # # res=read_excel_and_write_to_dict(read_excel_from_oss(actual_oss))
22
22
  # # print(res)
23
23
  # # print(read_excel_and_write_to_dict(read_excel_from_oss(oss1), type=".xlsx"))
24
- print(check_excel(check_type="all", actual_oss=actual_oss, expected_oss=expected_oss))
25
- # print(check_excel_all(actual_oss=oss1, expected_oss=oss2,skiprows=1))
26
- # print(check_excel_all(actual_oss=oss1, expected_oss=oss2,ignore_sort =True))
24
+ # print(check_excel(check_type="all", actual_oss=actual_oss, expected_oss=expected_oss))
25
+ # print(check_excel_all(actual_oss=oss1, expected_oss=oss2,skiprows =1))
26
+ print(check_excel_all(actual_oss=oss3, expected_oss=oss4,ignore_sort =True))
27
27
  # read_excel_csv_data(type=)
28
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpush
3
- Version: 1.1.8
3
+ Version: 1.2.0
4
4
  Summary: 用于smartpush自动化测试工具包
5
5
  Author: 卢泽彬、邵宇飞、周彦龙
6
6
 
@@ -1,14 +1,14 @@
1
1
  smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
2
2
  smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
3
- smartpush/test.py,sha256=34f8LgTj6bGO6LFukTo5yeiGq65sXReXGG7a9hgbACc,2668
3
+ smartpush/test.py,sha256=3yHz44AZaalSQtxgsRlIDK5qFla8JiPp8sBgMfkVNJQ,2666
4
4
  smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
5
5
  smartpush/export/basic/ExcelExportChecker.py,sha256=Ku-UoBKqTE7VwAWA644DNGUmXmXnnjmY6ifLV4rznUI,13593
6
6
  smartpush/export/basic/GetOssUrl.py,sha256=oCbPRGa5SqdPWzzeQ8sG10uZJByhrLAzUtwZi_IZgrg,3062
7
- smartpush/export/basic/ReadExcel.py,sha256=4UbM0MB--fQmjlBSTAALBlip0aFEyieo6zUlMqxUrcs,6334
7
+ smartpush/export/basic/ReadExcel.py,sha256=MqhfJuqjz8PQYJgV4v26LtO1_5moFLn4dHeqfKXifjg,6609
8
8
  smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
9
9
  smartpush/utils/StringUtils.py,sha256=NXomJ4qmyBRAFnGj5hrFRWwQnRQMTcPzy20fk1dunSw,3980
10
10
  smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- smartpush-1.1.8.dist-info/METADATA,sha256=fm6qLk2nBEPnLwnqLkuy1ahF5WphfsYs2EQb48-9n5U,145
12
- smartpush-1.1.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
13
- smartpush-1.1.8.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
14
- smartpush-1.1.8.dist-info/RECORD,,
11
+ smartpush-1.2.0.dist-info/METADATA,sha256=g00rcKwBscfVLpZkhczQ5WZVPCtsKqgGod4DLonOB3o,145
12
+ smartpush-1.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
13
+ smartpush-1.2.0.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
14
+ smartpush-1.2.0.dist-info/RECORD,,