mdbq 2.8.2__py3-none-any.whl → 2.8.4__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.
- mdbq/clean/clean_upload.py +5 -1
- mdbq/company/copysh.py +25 -24
- mdbq/pbix/refresh_all.py +1 -1
- {mdbq-2.8.2.dist-info → mdbq-2.8.4.dist-info}/METADATA +1 -1
- {mdbq-2.8.2.dist-info → mdbq-2.8.4.dist-info}/RECORD +7 -7
- {mdbq-2.8.2.dist-info → mdbq-2.8.4.dist-info}/WHEEL +1 -1
- {mdbq-2.8.2.dist-info → mdbq-2.8.4.dist-info}/top_level.txt +0 -0
mdbq/clean/clean_upload.py
CHANGED
@@ -832,6 +832,8 @@ class DataClean:
|
|
832
832
|
# df = pd.read_excel(os.path.join(root, name), header=0, engine='openpyxl')
|
833
833
|
df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
|
834
834
|
new_name = f'py_xg_{name}'
|
835
|
+
if os.path.isfile(os.path.join(root, new_name)):
|
836
|
+
os.remove(os.path.join(root, new_name))
|
835
837
|
os.rename(os.path.join(root, name), os.path.join(root, new_name))
|
836
838
|
elif name.endswith('.xlsx') and '京东商智_sku_商品明细' in name:
|
837
839
|
df = pd.read_excel(os.path.join(root, name), header=0, engine='openpyxl')
|
@@ -950,6 +952,8 @@ class DataClean:
|
|
950
952
|
elif name.endswith('.csv') and ('商品类目属性' in name or '商品主图视频' in name or '商品sku属性' in name):
|
951
953
|
df = pd.read_csv(os.path.join(root, name), encoding='utf-8_sig', header=0, na_filter=False)
|
952
954
|
new_name = f'py_xg_{os.path.splitext(name)[0]}.csv'
|
955
|
+
if os.path.isfile(os.path.join(root, new_name)):
|
956
|
+
os.remove(os.path.join(root, new_name))
|
953
957
|
os.rename(os.path.join(root, name), os.path.join(root, new_name))
|
954
958
|
|
955
959
|
# 将数据传入 self.datas 等待更新进数据库
|
@@ -1585,7 +1589,7 @@ def main(is_mysql=False, is_company=False):
|
|
1585
1589
|
# 清理聚合数据, mongodb 中没有聚合数据,所以只需要清理 mysql 即可
|
1586
1590
|
optimize_data.op_data(
|
1587
1591
|
db_name_lists=['聚合数据'],
|
1588
|
-
days=
|
1592
|
+
days=100,
|
1589
1593
|
is_mongo=False,
|
1590
1594
|
is_mysql=True,
|
1591
1595
|
)
|
mdbq/company/copysh.py
CHANGED
@@ -16,13 +16,13 @@ from mdbq.aggregation import optimize_data
|
|
16
16
|
from mdbq.config import set_support
|
17
17
|
from mdbq.config import myconfig
|
18
18
|
from mdbq.mysql import mysql
|
19
|
-
from mdbq.pbix import refresh_all
|
20
19
|
from mdbq.clean import clean_upload
|
21
20
|
warnings.filterwarnings('ignore')
|
22
21
|
|
23
22
|
|
24
23
|
if platform.system() == 'Windows':
|
25
24
|
# windows版本
|
25
|
+
from mdbq.pbix import refresh_all
|
26
26
|
Data_Path = r'C:\同步空间\BaiduSyncdisk'
|
27
27
|
D_PATH = os.path.join(f'C:\\Users\\{getpass.getuser()}\\Downloads')
|
28
28
|
Share_Path = os.path.join(r'\\192.168.1.198\时尚事业部\01.运营部\天猫报表') # 共享文件根目录
|
@@ -275,25 +275,26 @@ class TbFiles:
|
|
275
275
|
print(f'{src} 所需同步的文件不存在,请检查:pd_list参数')
|
276
276
|
|
277
277
|
# 刷新共享位置的指定文件/文件夹
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
278
|
+
if platform.system() == 'Windows':
|
279
|
+
excel_path = os.path.join(self.share_path, 'EXCEL报表')
|
280
|
+
files = os.listdir(excel_path)
|
281
|
+
files = [f'{excel_path}\\{item}' for item in files if item.endswith('.xlsx') or item.endswith('.xls')]
|
282
|
+
r = refresh_all.RefreshAll()
|
283
|
+
for file in files:
|
284
|
+
if '~' in file or 'DS_Store' in file or 'baidu' in file or 'xunlei' in file:
|
285
|
+
continue
|
286
|
+
if file.endswith('.xlsx') or file.endswith('.xls'):
|
287
|
+
r.refresh_excel(file=file)
|
288
|
+
time.sleep(5)
|
289
|
+
|
290
|
+
# 临时加的
|
291
|
+
# excel_file = f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\0-电商周报-每周五更新\\0-WLM_运营周报-1012输出.xlsx'
|
292
|
+
dir_files = f'\\\\192.168.1.198\\时尚事业部\\01.运营部\\0-电商周报-每周五更新'
|
293
|
+
files = os.listdir(dir_files)
|
294
|
+
for file in files:
|
295
|
+
if file.endswith('.xlsx') and file.startswith('0-WLM_运营周报') and '~' not in file and 'baidu' not in file:
|
296
|
+
excel_file = os.path.join(dir_files, file)
|
297
|
+
r.refresh_excel(file=excel_file)
|
297
298
|
|
298
299
|
self.before_max_time = self.check_change() # 重置值, 避免重复同步
|
299
300
|
|
@@ -339,9 +340,9 @@ def op_data(days: int =100):
|
|
339
340
|
|
340
341
|
|
341
342
|
def main():
|
342
|
-
if platform.system() != 'Windows':
|
343
|
-
|
344
|
-
|
343
|
+
# if platform.system() != 'Windows':
|
344
|
+
# print(f'只可以在 windows 运行')
|
345
|
+
# return
|
345
346
|
t = TbFiles()
|
346
347
|
while True:
|
347
348
|
system = platform.system() # 本机系统
|
@@ -357,7 +358,7 @@ def main():
|
|
357
358
|
b.download_dir(local_path=upload_path, remote_path=bd_remoto_path)
|
358
359
|
|
359
360
|
clean_upload.main(
|
360
|
-
is_mysql=True, # 调试时加,False:
|
361
|
+
is_mysql=True, # 调试时加,False: 不进行后续的聚合数据及清理
|
361
362
|
is_company=True, # 公司电脑不需要移动文件到原始文件
|
362
363
|
)
|
363
364
|
|
mdbq/pbix/refresh_all.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import os
|
2
2
|
import sys
|
3
|
-
import win32com.client
|
4
3
|
import time
|
5
4
|
import psutil
|
6
5
|
from pywinauto.application import Application
|
@@ -51,6 +50,7 @@ class RefreshAll:
|
|
51
50
|
|
52
51
|
def refresh_excel(self, file):
|
53
52
|
# 刷新 excel
|
53
|
+
import win32com.client
|
54
54
|
if not os.path.isfile(file):
|
55
55
|
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S ')
|
56
56
|
print(f'{now}{file} -> 文件不存在')
|
@@ -9,10 +9,10 @@ mdbq/aggregation/query_data.py,sha256=sLjCO5yDhGdVouA8x42sX5rugT2w9itYKanpk3iywC
|
|
9
9
|
mdbq/bdup/__init__.py,sha256=AkhsGk81SkG1c8FqDH5tRq-8MZmFobVbN60DTyukYTY,28
|
10
10
|
mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
|
11
11
|
mdbq/clean/__init__.py,sha256=A1d6x3L27j4NtLgiFV5TANwEkLuaDfPHDQNrPBbNWtU,41
|
12
|
-
mdbq/clean/clean_upload.py,sha256=
|
12
|
+
mdbq/clean/clean_upload.py,sha256=Cwcp4CR9RSlu6P9XjDcFtqlB8KQJUh8DfiL0uEFxhJM,83583
|
13
13
|
mdbq/clean/data_clean.py,sha256=ucfslhqXVZoH2QaXHSAWDky0GhIvH9f4GeNaHg4SrFE,104790
|
14
14
|
mdbq/company/__init__.py,sha256=qz8F_GsP_pMB5PblgJAUAMjasuZbOEp3qQOCB39E8f0,21
|
15
|
-
mdbq/company/copysh.py,sha256=
|
15
|
+
mdbq/company/copysh.py,sha256=tWSD7ZnPxSFrguKzI837glg90xoaxK4JL0IavtnMyGM,19943
|
16
16
|
mdbq/company/copysh_bak.py,sha256=NvlXCBZBcO2GIT5nLRYYqhOyHWM1-1RE7DHvgbj6jmQ,19723
|
17
17
|
mdbq/company/home_sh.py,sha256=42CZ2tZIXHLl2mOl2gk2fZnjH2IHh1VJ1s3qHABjonY,18021
|
18
18
|
mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
@@ -39,13 +39,13 @@ mdbq/other/sku_picture.py,sha256=JwSXYlzamVqcKCD2tRH2VqYVZNr8fM6f--kcGlTVRnM,500
|
|
39
39
|
mdbq/other/ua_sj.py,sha256=JuVYzc_5QZ9s_oQSrTHVKkQv4S_7-CWx4oIKOARn_9U,22178
|
40
40
|
mdbq/pbix/__init__.py,sha256=Trtfaynu9RjoTyLLYBN2xdRxTvm_zhCniUkVTAYwcjo,24
|
41
41
|
mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,2396
|
42
|
-
mdbq/pbix/refresh_all.py,sha256=
|
42
|
+
mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
|
43
43
|
mdbq/pbix/refresh_all_old.py,sha256=_pq3WSQ728GPtEG5pfsZI2uTJhU8D6ra-htIk1JXYzw,7192
|
44
44
|
mdbq/req_post/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
45
45
|
mdbq/req_post/req_tb.py,sha256=PexWSCPJNM6Tv0ol4lAWIhlOwsAr_frnjtcdSHCFiek,36179
|
46
46
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
47
47
|
mdbq/spider/aikucun.py,sha256=jHrdGWBJQaSywx7V-U4YuM6vWkwC5SR5tTOOdB3YU_c,17306
|
48
|
-
mdbq-2.8.
|
49
|
-
mdbq-2.8.
|
50
|
-
mdbq-2.8.
|
51
|
-
mdbq-2.8.
|
48
|
+
mdbq-2.8.4.dist-info/METADATA,sha256=oFkZxR2At0Mn7VA8NXBc5Bp5nZaH1g-XYAqoJkvmXFc,243
|
49
|
+
mdbq-2.8.4.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
50
|
+
mdbq-2.8.4.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
51
|
+
mdbq-2.8.4.dist-info/RECORD,,
|
File without changes
|