mdbq 0.3.4__py3-none-any.whl → 0.3.5__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/company/copysh.py +2 -2
- mdbq/config/update_conf.py +51 -17
- mdbq/pbix/refresh_all.py +1 -1
- {mdbq-0.3.4.dist-info → mdbq-0.3.5.dist-info}/METADATA +1 -1
- {mdbq-0.3.4.dist-info → mdbq-0.3.5.dist-info}/RECORD +7 -7
- {mdbq-0.3.4.dist-info → mdbq-0.3.5.dist-info}/WHEEL +0 -0
- {mdbq-0.3.4.dist-info → mdbq-0.3.5.dist-info}/top_level.txt +0 -0
mdbq/company/copysh.py
CHANGED
@@ -339,8 +339,8 @@ def main():
|
|
339
339
|
dp.upload_df(service_databases=[{'company': 'mysql'}])
|
340
340
|
|
341
341
|
# 此操作用于修改 .copysh_conf 文件,将 ch_record 改为 false (更新完成)
|
342
|
-
w = update_conf.UpdateConf(
|
343
|
-
w.update_config(option='ch_record', new_value='False')
|
342
|
+
w = update_conf.UpdateConf()
|
343
|
+
w.update_config(filename='.copysh_conf', option='ch_record', new_value='False')
|
344
344
|
time.sleep(60)
|
345
345
|
op_data(days=3650) # 数据清理和聚合
|
346
346
|
|
mdbq/config/update_conf.py
CHANGED
@@ -4,6 +4,10 @@ import getpass
|
|
4
4
|
import configparser
|
5
5
|
import os
|
6
6
|
from urllib import parse
|
7
|
+
"""
|
8
|
+
文件被 copysh.py / all-datas.py 调用, update_config 函数
|
9
|
+
更新完成后修改 conf 中值为 True
|
10
|
+
"""
|
7
11
|
|
8
12
|
|
9
13
|
class UpdateConf:
|
@@ -11,31 +15,56 @@ class UpdateConf:
|
|
11
15
|
读取配置文件信息
|
12
16
|
理论上,在本程序的根目录需要有一个文件夹 support/.myconf 配置文件放在其下
|
13
17
|
"""
|
14
|
-
def __init__(self
|
18
|
+
def __init__(self):
|
15
19
|
if platform.system() == 'Darwin':
|
16
|
-
path = os.path.join('/Users', getpass.getuser(), '数据中心/自动0备份/py/数据更新/support')
|
20
|
+
self.path = os.path.join('/Users', getpass.getuser(), '数据中心/自动0备份/py/数据更新/support')
|
17
21
|
elif platform.system() == 'Windows':
|
18
|
-
path = os.path.join('C:\\同步空间\\BaiduSyncdisk\\自动0备份\\py\\数据更新\\support')
|
22
|
+
self.path = os.path.join('C:\\同步空间\\BaiduSyncdisk\\自动0备份\\py\\数据更新\\support')
|
19
23
|
else:
|
20
|
-
path = os.path.join('/Users', getpass.getuser(), 'support')
|
21
|
-
self.
|
22
|
-
self.filename =
|
23
|
-
self.conf_file =
|
24
|
+
self.path = os.path.join('/Users', getpass.getuser(), 'support')
|
25
|
+
self.section = 'database' # 默认 文件头标记
|
26
|
+
self.filename = None
|
27
|
+
self.conf_file = None
|
24
28
|
self.config = None
|
25
|
-
self.section = 'database'
|
26
29
|
|
30
|
+
def read_txt(self, filename, option=None):
|
31
|
+
self.filename = filename
|
32
|
+
self.conf_file = os.path.join(self.path, self.filename)
|
33
|
+
if not os.path.exists(self.conf_file):
|
34
|
+
print(f'缺少配置文件: {self.conf_file}')
|
35
|
+
return
|
36
|
+
with open(self.conf_file, 'r', encoding='utf-8') as f:
|
37
|
+
content = f.readlines()
|
38
|
+
content = [item.strip() for item in content if not item.strip().startswith('#') and not item.strip().startswith('[')]
|
39
|
+
pbix_list = [item for item in content if item]
|
40
|
+
return pbix_list # ['推广数据.pbix', '市场数据新.pbix']
|
27
41
|
|
28
|
-
def read_conf(self,
|
42
|
+
def read_conf(self, filename, option=None):
|
43
|
+
self.filename = filename
|
44
|
+
self.conf_file = os.path.join(self.path, self.filename)
|
29
45
|
if not os.path.exists(self.conf_file):
|
30
|
-
print(f'
|
46
|
+
print(f'缺少配置文件: {self.conf_file}')
|
31
47
|
return
|
32
48
|
self.config = configparser.ConfigParser()
|
33
49
|
self.config.read(self.conf_file, 'UTF-8')
|
34
|
-
|
35
|
-
|
50
|
+
if not option:
|
51
|
+
results = []
|
52
|
+
for option in self.config.options(self.section):
|
53
|
+
results.append({option: self.config.get(self.section, option)})
|
54
|
+
return results
|
55
|
+
else:
|
56
|
+
if option not in self.config.options(self.section):
|
57
|
+
print(f'不存在的配置项: {option},文件: {self.conf_file}')
|
58
|
+
else:
|
59
|
+
return self.config.get(self.section, option)
|
36
60
|
|
37
|
-
def update_config(self, option, new_value):
|
38
|
-
"""
|
61
|
+
def update_config(self, filename, option, new_value):
|
62
|
+
"""
|
63
|
+
更新配置文件
|
64
|
+
copysh.py / all-datas.py 调用
|
65
|
+
"""
|
66
|
+
self.filename = filename
|
67
|
+
self.conf_file = os.path.join(self.path, self.filename)
|
39
68
|
with open(self.conf_file, 'r', encoding='utf-8') as file:
|
40
69
|
lines = file.readlines()
|
41
70
|
config = configparser.ConfigParser(allow_no_value=True) # 读取配置(不包括注释和空白行)
|
@@ -67,7 +96,12 @@ class UpdateConf:
|
|
67
96
|
file.write(f"\n[{self.section}]\n{option} = {new_value}\n")
|
68
97
|
|
69
98
|
|
70
|
-
|
71
|
-
# w = UpdateConf(filename='.copysh_conf')
|
72
|
-
# w.update_config(option='ch_record', new_value='false')
|
99
|
+
def main():
|
73
100
|
pass
|
101
|
+
|
102
|
+
|
103
|
+
if __name__ == '__main__':
|
104
|
+
w = UpdateConf()
|
105
|
+
# w.update_config(filename='.copysh_conf', option='ch_record', new_value='false')
|
106
|
+
res = w.read_txt(filename='tb_list.txt')
|
107
|
+
print(res)
|
mdbq/pbix/refresh_all.py
CHANGED
@@ -27,7 +27,7 @@ class RefreshAll:
|
|
27
27
|
return
|
28
28
|
with open(self.pbix_path, 'r', encoding='utf-8') as f:
|
29
29
|
content = f.readlines()
|
30
|
-
content = [item.strip() for item in content if not item.strip().startswith('#')]
|
30
|
+
content = [item.strip() for item in content if not item.strip().startswith('#') and not item.strip().startswith('[')]
|
31
31
|
pbix_list = [item for item in content if item]
|
32
32
|
|
33
33
|
if not pbix_list:
|
@@ -9,11 +9,11 @@ mdbq/bdup/bdup.py,sha256=LAV0TgnQpc-LB-YuJthxb0U42_VkPidzQzAagan46lU,4234
|
|
9
9
|
mdbq/clean/__init__.py,sha256=A1d6x3L27j4NtLgiFV5TANwEkLuaDfPHDQNrPBbNWtU,41
|
10
10
|
mdbq/clean/data_clean.py,sha256=33OmeQFl9AW21P5EOay52W_S8DF96H5oHwCg4fSuBxA,85359
|
11
11
|
mdbq/company/__init__.py,sha256=qz8F_GsP_pMB5PblgJAUAMjasuZbOEp3qQOCB39E8f0,21
|
12
|
-
mdbq/company/copysh.py,sha256=
|
12
|
+
mdbq/company/copysh.py,sha256=kJCvFym4eu8r8kesKlAgO_T-popl3_WdvN6pasihph8,17026
|
13
13
|
mdbq/config/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
14
14
|
mdbq/config/get_myconf.py,sha256=9v3xebfcS1tptxpvk3_tGxfXjAehGVCveYe4iRUzLQQ,6372
|
15
15
|
mdbq/config/products.py,sha256=tFqSfFSXyZXcof0gAeHq0Ftn4F5i9ucoMyIqZ1H_D2Q,4260
|
16
|
-
mdbq/config/update_conf.py,sha256=
|
16
|
+
mdbq/config/update_conf.py,sha256=8uOiV7CY5HCzg2PVjuKHNqYJNwJR0M7B-a7egta3wWw,4952
|
17
17
|
mdbq/dataframe/__init__.py,sha256=2HtCN8AdRj53teXDqzysC1h8aPL-mMFy561ESmhehGQ,22
|
18
18
|
mdbq/dataframe/converter.py,sha256=h_BDc6oNmMCVFOUzZJq4nXNGDyJFJyycpWqlyrv7U04,3089
|
19
19
|
mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
|
@@ -31,9 +31,9 @@ mdbq/other/pov_city.py,sha256=AEOmCOzOwyjHi9LLZWPKi6DUuSC-_M163664I52u9qw,21050
|
|
31
31
|
mdbq/other/ua_sj.py,sha256=JuVYzc_5QZ9s_oQSrTHVKkQv4S_7-CWx4oIKOARn_9U,22178
|
32
32
|
mdbq/pbix/__init__.py,sha256=Trtfaynu9RjoTyLLYBN2xdRxTvm_zhCniUkVTAYwcjo,24
|
33
33
|
mdbq/pbix/pbix_refresh.py,sha256=JUjKW3bNEyoMVfVfo77UhguvS5AWkixvVhDbw4_MHco,2396
|
34
|
-
mdbq/pbix/refresh_all.py,sha256=
|
34
|
+
mdbq/pbix/refresh_all.py,sha256=USe3s5ws2Q-Gp9yUoFOAXJ4t0KVaekFULtAJaZkp448,5976
|
35
35
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
36
|
-
mdbq-0.3.
|
37
|
-
mdbq-0.3.
|
38
|
-
mdbq-0.3.
|
39
|
-
mdbq-0.3.
|
36
|
+
mdbq-0.3.5.dist-info/METADATA,sha256=dLI22tO0ZRrr-bH-e55BpBIEV8jUn_L8y3y13VeBaGw,245
|
37
|
+
mdbq-0.3.5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
38
|
+
mdbq-0.3.5.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
39
|
+
mdbq-0.3.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|