mdbq 2.5.5__tar.gz → 2.5.6__tar.gz

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.
Files changed (52) hide show
  1. {mdbq-2.5.5 → mdbq-2.5.6}/PKG-INFO +1 -1
  2. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/clean/clean_upload.py +65 -6
  3. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq.egg-info/PKG-INFO +1 -1
  4. {mdbq-2.5.5 → mdbq-2.5.6}/setup.py +1 -1
  5. {mdbq-2.5.5 → mdbq-2.5.6}/README.txt +0 -0
  6. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/__init__.py +0 -0
  7. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/__version__.py +0 -0
  8. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/__init__.py +0 -0
  9. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/aggregation.py +0 -0
  10. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/df_types.py +0 -0
  11. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/mysql_types.py +0 -0
  12. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/optimize_data.py +0 -0
  13. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/aggregation/query_data.py +0 -0
  14. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/bdup/__init__.py +0 -0
  15. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/bdup/bdup.py +0 -0
  16. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/clean/__init__.py +0 -0
  17. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/clean/data_clean.py +0 -0
  18. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/company/__init__.py +0 -0
  19. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/company/copysh.py +0 -0
  20. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/company/home_sh.py +0 -0
  21. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/config/__init__.py +0 -0
  22. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/config/get_myconf.py +0 -0
  23. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/config/products.py +0 -0
  24. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/config/set_support.py +0 -0
  25. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/config/update_conf.py +0 -0
  26. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/dataframe/__init__.py +0 -0
  27. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/dataframe/converter.py +0 -0
  28. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/log/__init__.py +0 -0
  29. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/log/mylogger.py +0 -0
  30. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mongo/__init__.py +0 -0
  31. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mongo/mongo.py +0 -0
  32. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mysql/__init__.py +0 -0
  33. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mysql/mysql.py +0 -0
  34. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mysql/s_query.py +0 -0
  35. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/mysql/year_month_day.py +0 -0
  36. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/other/__init__.py +0 -0
  37. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/other/porxy.py +0 -0
  38. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/other/pov_city.py +0 -0
  39. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/other/sku_picture.py +0 -0
  40. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/other/ua_sj.py +0 -0
  41. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/pbix/__init__.py +0 -0
  42. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/pbix/pbix_refresh.py +0 -0
  43. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/pbix/refresh_all.py +0 -0
  44. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/pbix/refresh_all_old.py +0 -0
  45. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/req_post/__init__.py +0 -0
  46. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/req_post/req_tb.py +0 -0
  47. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/spider/__init__.py +0 -0
  48. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq/spider/aikucun.py +0 -0
  49. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq.egg-info/SOURCES.txt +0 -0
  50. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq.egg-info/dependency_links.txt +0 -0
  51. {mdbq-2.5.5 → mdbq-2.5.6}/mdbq.egg-info/top_level.txt +0 -0
  52. {mdbq-2.5.5 → mdbq-2.5.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 2.5.5
3
+ Version: 2.5.6
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -646,6 +646,52 @@ class DataClean:
646
646
  }
647
647
  )
648
648
 
649
+ def sp_scene_clean(self, path=None, is_except=[]):
650
+ if not path:
651
+ path = self.path
652
+ for root, dirs, files in os.walk(path, topdown=False):
653
+ for name in files:
654
+ if '~$' in name or '.DS' in name or '.localized' in name or '.jpg' in name or '.png' in name:
655
+ continue
656
+ if 'py_xg' in name:
657
+ continue
658
+ is_continue = False
659
+ if is_except:
660
+ for item in is_except:
661
+ if item in os.path.join(root, name):
662
+ # print(name)
663
+ is_continue = True
664
+ break
665
+ if is_continue: # 需要排除不做处理的文件或文件夹
666
+ continue
667
+
668
+ if name.endswith('.xlsx') and '商品素材_' in name:
669
+ shop_name = re.findall(r'_([\u4e00-\u9fffA-Za-z]+店)_', name)[0]
670
+ df = pd.read_excel(os.path.join(root, name), header=0)
671
+ df.insert(loc=1, column='店铺名称', value=shop_name)
672
+ new_name = f'py_xg_{name}'
673
+ df.to_excel(os.path.join(upload_path, new_name),
674
+ index=False, header=True, engine='openpyxl', freeze_panes=(1, 0))
675
+ if '官方旗舰店' in name:
676
+ db_name = '属性设置3'
677
+ collection_name = '商品素材_天猫'
678
+ elif '官方企业店' in name:
679
+ db_name = '属性设置3'
680
+ collection_name = '商品素材_淘宝'
681
+ os.remove(os.path.join(root, name))
682
+
683
+ # 将数据传入 self.datas 等待更新进数据库
684
+ if not db_name or not collection_name:
685
+ print(f'db_name/collection_name 不能为空')
686
+ continue
687
+ self.datas.append(
688
+ {
689
+ '数据库名': db_name,
690
+ '集合名称': collection_name,
691
+ '数据主体': df,
692
+ '文件名': name,
693
+ }
694
+ )
649
695
  """
650
696
  {文件分类}
651
697
  将已处理完的文件 分类移到原始文件夹下
@@ -711,16 +757,16 @@ class DataClean:
711
757
  elif '天猫' in name and name.endswith('.csv') and 'order' in name:
712
758
  t_path = os.path.join(self.source_path, '天猫_生意经', '订单数据')
713
759
  bib(t_path, _as_month=False)
714
- elif '淘宝' in name and name.endswith('.csv') and 'baobei' in name:
760
+ elif '淘宝' in name or '企业店' in name and name.endswith('.csv') and 'baobei' in name:
715
761
  t_path = os.path.join(self.source_path, '淘宝_生意经', '宝贝指标')
716
762
  bib(t_path, _as_month=True)
717
- elif '淘宝' in name and name.endswith('.csv') and '省份城市分析' in name:
763
+ elif '淘宝' in name or '企业店' in name and name.endswith('.csv') and '省份城市分析' in name:
718
764
  t_path = os.path.join(self.source_path, '淘宝_生意经', '省份城市分析')
719
765
  bib(t_path, _as_month=True)
720
- elif '淘宝' in name and name.endswith('.csv') and '店铺销售指标' in name:
766
+ elif '淘宝' in name or '企业店' in name and name.endswith('.csv') and '店铺销售指标' in name:
721
767
  t_path = os.path.join(self.source_path, '淘宝_生意经', '店铺销售指标')
722
768
  bib(t_path, _as_month=False)
723
- elif '淘宝' in name and name.endswith('.csv') and 'order' in name:
769
+ elif '淘宝' in name or '企业店' in name and name.endswith('.csv') and 'order' in name:
724
770
  t_path = os.path.join(self.source_path, '淘宝_生意经', '订单数据')
725
771
  bib(t_path, _as_month=False)
726
772
 
@@ -850,7 +896,12 @@ class DataClean:
850
896
  elif '定向人群' in name:
851
897
  t_path = os.path.join(self.source_path, '天猫推广报表', '品销宝', '定向人群报表')
852
898
  bib(t_path, _as_month=True)
853
-
899
+ elif name.endswith('xlsx') and '商品素材_万里马官方旗舰店' in name:
900
+ t_path = os.path.join(self.source_path, '商品素材', '天猫')
901
+ bib(t_path, _as_month=True)
902
+ elif name.endswith('xlsx') and '商品素材_万里马官方企业店' in name:
903
+ t_path = os.path.join(self.source_path, '商品素材', '淘宝')
904
+ bib(t_path, _as_month=True)
854
905
 
855
906
  # @try_except
856
907
  def move_tg_tb(self, path=None, is_except=[]):
@@ -1110,9 +1161,10 @@ def main(service_databases=None):
1110
1161
  )
1111
1162
  c.new_unzip(is_move=True) # 解压文件, is_move 解压后是否删除原 zip 压缩文件
1112
1163
  c.tg_reports(is_except=['except']) # 推广报表,天猫淘宝共同清洗
1113
- c.syj_reports_tm(is_except=['except']) # 天猫=生意经
1164
+ c.syj_reports_tm(is_except=['except']) # 天猫生意经
1114
1165
  # c.syj_reports_tb(is_except=['except']) # 淘宝生意经,不可以和天猫同时运行
1115
1166
  c.jd_reports(is_except=['except']) # 清洗京东报表
1167
+ c.sp_scene_clean(is_except=['except']) # 商品素材
1116
1168
  c.upload_df(service_databases=service_databases) # 上传数据库
1117
1169
 
1118
1170
  c.move_sjy(is_except=['临时文件',]) # 生意经,移到文件到原始文件夹
@@ -1171,3 +1223,10 @@ if __name__ == '__main__':
1171
1223
  ]
1172
1224
  )
1173
1225
 
1226
+ # c = DataClean(
1227
+ # path=upload_path, # 源文件目录,下载文件夹
1228
+ # source_path=source_path3, # 原始文件保存目录
1229
+ # service_databases=[{'home_lx': 'mysql'},]
1230
+ # )
1231
+ # c.sp_scene_clean(is_except=['except']) # 商品素材
1232
+ # c.move_tg_tm(is_except=['临时文件', ]) # 天猫,移到文件到原始文件夹
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 2.5.5
3
+ Version: 2.5.6
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  setup(name='mdbq',
6
- version='2.5.5',
6
+ version='2.5.6',
7
7
  author='xigua, ',
8
8
  author_email="2587125111@qq.com",
9
9
  url='https://pypi.org/project/mdbq',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes