re-common 10.0.39__py3-none-any.whl → 10.0.41__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.
- re_common/baselibrary/__init__.py +4 -4
- re_common/baselibrary/baseabs/__init__.py +6 -6
- re_common/baselibrary/baseabs/baseabs.py +26 -26
- re_common/baselibrary/database/mbuilder.py +132 -132
- re_common/baselibrary/database/moudle.py +93 -93
- re_common/baselibrary/database/msqlite3.py +194 -194
- re_common/baselibrary/database/mysql.py +169 -169
- re_common/baselibrary/database/sql_factory.py +26 -26
- re_common/baselibrary/mthread/MThreadingRun.py +486 -486
- re_common/baselibrary/mthread/MThreadingRunEvent.py +349 -349
- re_common/baselibrary/mthread/__init__.py +2 -2
- re_common/baselibrary/mthread/mythreading.py +695 -695
- re_common/baselibrary/pakge_other/socks.py +404 -404
- re_common/baselibrary/readconfig/config_factory.py +18 -18
- re_common/baselibrary/readconfig/ini_config.py +317 -317
- re_common/baselibrary/readconfig/toml_config.py +49 -49
- re_common/baselibrary/temporary/envdata.py +36 -36
- re_common/baselibrary/tools/all_requests/aiohttp_request.py +118 -118
- re_common/baselibrary/tools/all_requests/httpx_requet.py +102 -102
- re_common/baselibrary/tools/all_requests/mrequest.py +412 -412
- re_common/baselibrary/tools/all_requests/requests_request.py +81 -81
- re_common/baselibrary/tools/batch_compre/bijiao_batch.py +31 -31
- re_common/baselibrary/tools/contrast_db3.py +123 -123
- re_common/baselibrary/tools/copy_file.py +39 -39
- re_common/baselibrary/tools/db3_2_sizedb3.py +102 -102
- re_common/baselibrary/tools/foreachgz.py +39 -39
- re_common/baselibrary/tools/get_attr.py +10 -10
- re_common/baselibrary/tools/image_to_pdf.py +61 -61
- re_common/baselibrary/tools/java_code_deal.py +139 -139
- re_common/baselibrary/tools/javacode.py +79 -79
- re_common/baselibrary/tools/mdb_db3.py +48 -48
- re_common/baselibrary/tools/merge_file.py +171 -171
- re_common/baselibrary/tools/merge_gz_file.py +165 -165
- re_common/baselibrary/tools/mhdfstools/down_hdfs_files.py +42 -42
- re_common/baselibrary/tools/mhdfstools/hdfst.py +42 -42
- re_common/baselibrary/tools/mhdfstools/up_hdfs_files.py +38 -38
- re_common/baselibrary/tools/mongo_tools.py +50 -50
- re_common/baselibrary/tools/move_file.py +170 -170
- re_common/baselibrary/tools/move_mongo/mongo_table_to_file.py +63 -63
- re_common/baselibrary/tools/move_mongo/move_mongo_table.py +354 -354
- re_common/baselibrary/tools/move_mongo/use_mttf.py +18 -18
- re_common/baselibrary/tools/move_mongo/use_mv.py +93 -93
- re_common/baselibrary/tools/mpandas/mpandasreadexcel.py +125 -125
- re_common/baselibrary/tools/mpandas/pandas_visualization.py +7 -7
- re_common/baselibrary/tools/myparsel.py +104 -104
- re_common/baselibrary/tools/rename_dir_file.py +37 -37
- re_common/baselibrary/tools/sequoiadb_utils.py +398 -398
- re_common/baselibrary/tools/split_line_to_many.py +25 -25
- re_common/baselibrary/tools/stringtodicts.py +33 -33
- re_common/baselibrary/tools/workwechant_bot.py +84 -84
- re_common/baselibrary/utils/baseaiohttp.py +296 -296
- re_common/baselibrary/utils/baseaiomysql.py +87 -87
- re_common/baselibrary/utils/baseallstep.py +191 -191
- re_common/baselibrary/utils/baseavro.py +19 -19
- re_common/baselibrary/utils/baseboto3.py +291 -291
- re_common/baselibrary/utils/basecsv.py +32 -32
- re_common/baselibrary/utils/basedict.py +133 -133
- re_common/baselibrary/utils/basedir.py +241 -241
- re_common/baselibrary/utils/baseencode.py +351 -351
- re_common/baselibrary/utils/baseencoding.py +28 -28
- re_common/baselibrary/utils/baseesdsl.py +86 -86
- re_common/baselibrary/utils/baseexcel.py +264 -264
- re_common/baselibrary/utils/baseexcept.py +109 -109
- re_common/baselibrary/utils/basefile.py +654 -654
- re_common/baselibrary/utils/baseftp.py +214 -214
- re_common/baselibrary/utils/basegzip.py +60 -60
- re_common/baselibrary/utils/basehdfs.py +135 -135
- re_common/baselibrary/utils/basehttpx.py +268 -268
- re_common/baselibrary/utils/baseip.py +87 -87
- re_common/baselibrary/utils/basejson.py +2 -2
- re_common/baselibrary/utils/baselist.py +32 -32
- re_common/baselibrary/utils/basemotor.py +190 -190
- re_common/baselibrary/utils/basemssql.py +98 -98
- re_common/baselibrary/utils/baseodbc.py +113 -113
- re_common/baselibrary/utils/basepandas.py +302 -302
- re_common/baselibrary/utils/basepeewee.py +11 -11
- re_common/baselibrary/utils/basepika.py +180 -180
- re_common/baselibrary/utils/basepydash.py +143 -143
- re_common/baselibrary/utils/basepymongo.py +230 -230
- re_common/baselibrary/utils/basequeue.py +22 -22
- re_common/baselibrary/utils/baserar.py +57 -57
- re_common/baselibrary/utils/baserequest.py +279 -279
- re_common/baselibrary/utils/baseset.py +8 -8
- re_common/baselibrary/utils/basesmb.py +403 -403
- re_common/baselibrary/utils/basestring.py +382 -382
- re_common/baselibrary/utils/basetime.py +320 -320
- re_common/baselibrary/utils/baseurl.py +121 -121
- re_common/baselibrary/utils/basezip.py +57 -57
- re_common/baselibrary/utils/core/__init__.py +7 -7
- re_common/baselibrary/utils/core/bottomutils.py +18 -18
- re_common/baselibrary/utils/core/mdeprecated.py +327 -327
- re_common/baselibrary/utils/core/mlamada.py +16 -16
- re_common/baselibrary/utils/core/msginfo.py +25 -25
- re_common/baselibrary/utils/core/requests_core.py +103 -103
- re_common/baselibrary/utils/fateadm.py +429 -429
- re_common/baselibrary/utils/importfun.py +123 -123
- re_common/baselibrary/utils/mfaker.py +57 -57
- re_common/baselibrary/utils/my_abc/__init__.py +3 -3
- re_common/baselibrary/utils/my_abc/better_abc.py +32 -32
- re_common/baselibrary/utils/mylogger.py +414 -414
- re_common/baselibrary/utils/myredisclient.py +861 -861
- re_common/baselibrary/utils/pipupgrade.py +21 -21
- re_common/baselibrary/utils/ringlist.py +85 -85
- re_common/baselibrary/utils/version_compare.py +36 -36
- re_common/baselibrary/utils/ydmhttp.py +126 -126
- re_common/facade/lazy_import.py +11 -11
- re_common/facade/loggerfacade.py +25 -25
- re_common/facade/mysqlfacade.py +467 -467
- re_common/facade/now.py +31 -31
- re_common/facade/sqlite3facade.py +257 -257
- re_common/facade/use/mq_use_facade.py +83 -83
- re_common/facade/use/proxy_use_facade.py +19 -19
- re_common/libtest/base_dict_test.py +19 -19
- re_common/libtest/baseavro_test.py +13 -13
- re_common/libtest/basefile_test.py +14 -14
- re_common/libtest/basemssql_test.py +77 -77
- re_common/libtest/baseodbc_test.py +7 -7
- re_common/libtest/basepandas_test.py +38 -38
- re_common/libtest/get_attr_test/get_attr_test_settings.py +14 -14
- re_common/libtest/get_attr_test/settings.py +54 -54
- re_common/libtest/idencode_test.py +53 -53
- re_common/libtest/iniconfig_test.py +35 -35
- re_common/libtest/ip_test.py +34 -34
- re_common/libtest/merge_file_test.py +20 -20
- re_common/libtest/mfaker_test.py +8 -8
- re_common/libtest/mm3_test.py +31 -31
- re_common/libtest/mylogger_test.py +88 -88
- re_common/libtest/myparsel_test.py +27 -27
- re_common/libtest/mysql_test.py +151 -151
- re_common/libtest/pymongo_test.py +21 -21
- re_common/libtest/split_test.py +11 -11
- re_common/libtest/sqlite3_merge_test.py +5 -5
- re_common/libtest/sqlite3_test.py +34 -34
- re_common/libtest/tomlconfig_test.py +30 -30
- re_common/libtest/use_tools_test/__init__.py +2 -2
- re_common/libtest/user/__init__.py +4 -4
- re_common/studio/__init__.py +4 -4
- re_common/studio/assignment_expressions.py +36 -36
- re_common/studio/mydash/test1.py +18 -18
- re_common/studio/pydashstudio/first.py +9 -9
- re_common/studio/streamlitstudio/first_app.py +65 -65
- re_common/studio/streamlitstudio/uber_pickups.py +23 -23
- re_common/studio/test.py +18 -18
- re_common/v2/baselibrary/business_utils/BusinessStringUtil.py +235 -220
- re_common/v2/baselibrary/business_utils/baseencodeid.py +100 -100
- re_common/v2/baselibrary/business_utils/full_doi_path.py +116 -116
- re_common/v2/baselibrary/business_utils/rel_tools.py +6 -6
- re_common/v2/baselibrary/decorators/utils.py +59 -59
- re_common/v2/baselibrary/helpers/search_packge/NearestNeighbors_test.py +105 -105
- re_common/v2/baselibrary/helpers/search_packge/fit_text_match.py +253 -253
- re_common/v2/baselibrary/helpers/search_packge/scikit_learn_text_matcher.py +260 -260
- re_common/v2/baselibrary/helpers/search_packge/test.py +1 -1
- re_common/v2/baselibrary/s3object/baseboto3.py +230 -230
- re_common/v2/baselibrary/tools/WeChatRobot.py +95 -95
- re_common/v2/baselibrary/tools/ac_ahocorasick.py +75 -75
- re_common/v2/baselibrary/tools/concurrency.py +35 -35
- re_common/v2/baselibrary/tools/data_processer/base.py +53 -53
- re_common/v2/baselibrary/tools/data_processer/data_processer.py +497 -508
- re_common/v2/baselibrary/tools/data_processer/data_reader.py +187 -187
- re_common/v2/baselibrary/tools/data_processer/data_writer.py +38 -38
- re_common/v2/baselibrary/tools/dict_tools.py +44 -44
- re_common/v2/baselibrary/tools/dolphinscheduler.py +187 -187
- re_common/v2/baselibrary/tools/hdfs_base_processor.py +204 -204
- re_common/v2/baselibrary/tools/hdfs_bulk_processor.py +67 -67
- re_common/v2/baselibrary/tools/hdfs_data_processer.py +338 -338
- re_common/v2/baselibrary/tools/hdfs_line_processor.py +74 -74
- re_common/v2/baselibrary/tools/list_tools.py +69 -69
- re_common/v2/baselibrary/tools/resume_tracker.py +94 -94
- re_common/v2/baselibrary/tools/search_hash_tools.py +54 -54
- re_common/v2/baselibrary/tools/text_matcher.py +326 -326
- re_common/v2/baselibrary/tools/tree_processor/__init__.py +0 -0
- re_common/v2/baselibrary/tools/tree_processor/builder.py +25 -0
- re_common/v2/baselibrary/tools/tree_processor/node.py +13 -0
- re_common/v2/baselibrary/tools/unionfind_tools.py +60 -60
- re_common/v2/baselibrary/utils/BusinessStringUtil.py +196 -196
- re_common/v2/baselibrary/utils/api_net_utils.py +270 -270
- re_common/v2/baselibrary/utils/author_smi.py +361 -361
- re_common/v2/baselibrary/utils/base_string_similarity.py +158 -158
- re_common/v2/baselibrary/utils/basedict.py +37 -37
- re_common/v2/baselibrary/utils/basehdfs.py +163 -163
- re_common/v2/baselibrary/utils/basepika.py +180 -180
- re_common/v2/baselibrary/utils/basetime.py +94 -77
- re_common/v2/baselibrary/utils/db.py +174 -156
- re_common/v2/baselibrary/utils/elasticsearch.py +46 -0
- re_common/v2/baselibrary/utils/json_cls.py +16 -16
- re_common/v2/baselibrary/utils/mq.py +83 -83
- re_common/v2/baselibrary/utils/n_ary_expression_tree.py +243 -243
- re_common/v2/baselibrary/utils/string_bool.py +187 -186
- re_common/v2/baselibrary/utils/string_clear.py +246 -246
- re_common/v2/baselibrary/utils/string_smi.py +18 -18
- re_common/v2/baselibrary/utils/stringutils.py +312 -271
- re_common/vip/base_step_process.py +11 -11
- re_common/vip/baseencodeid.py +90 -90
- re_common/vip/changetaskname.py +28 -28
- re_common/vip/core_var.py +24 -24
- re_common/vip/mmh3Hash.py +89 -89
- re_common/vip/proxy/allproxys.py +127 -127
- re_common/vip/proxy/allproxys_thread.py +159 -159
- re_common/vip/proxy/cnki_proxy.py +153 -153
- re_common/vip/proxy/kuaidaili.py +87 -87
- re_common/vip/proxy/proxy_all.py +113 -113
- re_common/vip/proxy/update_kuaidaili_0.py +42 -42
- re_common/vip/proxy/wanfang_proxy.py +152 -152
- re_common/vip/proxy/wp_proxy_all.py +181 -181
- re_common/vip/read_rawid_to_txt.py +91 -91
- re_common/vip/title/__init__.py +5 -5
- re_common/vip/title/transform/TransformBookTitleToZt.py +125 -125
- re_common/vip/title/transform/TransformConferenceTitleToZt.py +139 -139
- re_common/vip/title/transform/TransformCstadTitleToZt.py +195 -195
- re_common/vip/title/transform/TransformJournalTitleToZt.py +203 -203
- re_common/vip/title/transform/TransformPatentTitleToZt.py +132 -132
- re_common/vip/title/transform/TransformRegulationTitleToZt.py +114 -114
- re_common/vip/title/transform/TransformStandardTitleToZt.py +135 -135
- re_common/vip/title/transform/TransformThesisTitleToZt.py +135 -135
- re_common/vip/title/transform/__init__.py +10 -10
- {re_common-10.0.39.dist-info → re_common-10.0.41.dist-info}/LICENSE +201 -201
- {re_common-10.0.39.dist-info → re_common-10.0.41.dist-info}/METADATA +16 -16
- re_common-10.0.41.dist-info/RECORD +252 -0
- {re_common-10.0.39.dist-info → re_common-10.0.41.dist-info}/WHEEL +1 -1
- re_common-10.0.39.dist-info/RECORD +0 -248
- {re_common-10.0.39.dist-info → re_common-10.0.41.dist-info}/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# pip v10.0.0以上版本需要导入下面的包
|
|
3
|
-
from subprocess import call
|
|
4
|
-
|
|
5
|
-
from pip._internal.utils.misc import get_installed_distributions
|
|
6
|
-
|
|
7
|
-
'''
|
|
8
|
-
用于升级python的扩展包一次性升级所有另外提供命令行方式
|
|
9
|
-
pip install pip-review
|
|
10
|
-
pip-review --local --interactive
|
|
11
|
-
|
|
12
|
-
环境迁移
|
|
13
|
-
pip freeze > requirements.txt
|
|
14
|
-
|
|
15
|
-
pip uninstall -ry requirements.txt
|
|
16
|
-
|
|
17
|
-
pip install -r requirements.txt
|
|
18
|
-
'''
|
|
19
|
-
for dist in get_installed_distributions():
|
|
20
|
-
call("pip install --upgrade " + dist.project_name, shell=True)
|
|
21
|
-
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# pip v10.0.0以上版本需要导入下面的包
|
|
3
|
+
from subprocess import call
|
|
4
|
+
|
|
5
|
+
from pip._internal.utils.misc import get_installed_distributions
|
|
6
|
+
|
|
7
|
+
'''
|
|
8
|
+
用于升级python的扩展包一次性升级所有另外提供命令行方式
|
|
9
|
+
pip install pip-review
|
|
10
|
+
pip-review --local --interactive
|
|
11
|
+
|
|
12
|
+
环境迁移
|
|
13
|
+
pip freeze > requirements.txt
|
|
14
|
+
|
|
15
|
+
pip uninstall -ry requirements.txt
|
|
16
|
+
|
|
17
|
+
pip install -r requirements.txt
|
|
18
|
+
'''
|
|
19
|
+
for dist in get_installed_distributions():
|
|
20
|
+
call("pip install --upgrade " + dist.project_name, shell=True)
|
|
21
|
+
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import random
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class RingList(object):
|
|
5
|
-
def __init__(self):
|
|
6
|
-
"""
|
|
7
|
-
环形列表初始化
|
|
8
|
-
"""
|
|
9
|
-
self.objlist = list()
|
|
10
|
-
# 列表中数据总量
|
|
11
|
-
self.num = 0
|
|
12
|
-
self.index = 0
|
|
13
|
-
|
|
14
|
-
def append(self, p_object):
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
:param p_object: 增加到环形列表的元素
|
|
18
|
-
:return:
|
|
19
|
-
"""
|
|
20
|
-
self.num += 1
|
|
21
|
-
self.objlist.append(p_object)
|
|
22
|
-
|
|
23
|
-
def pop(self, index=None):
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
:param index: 如果给index值,将会返回固定的该索引位置的值;如果不给,将会循环输出该列表的值
|
|
27
|
-
:return:
|
|
28
|
-
"""
|
|
29
|
-
if self.num == 0:
|
|
30
|
-
return None
|
|
31
|
-
if index is not None:
|
|
32
|
-
self.index = index
|
|
33
|
-
obj = self.objlist[self.index % self.num]
|
|
34
|
-
self.index += 1
|
|
35
|
-
return obj
|
|
36
|
-
|
|
37
|
-
def exist(self, mstring):
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
:param mstring: 需要验证是否存在的字符串
|
|
41
|
-
:return:
|
|
42
|
-
"""
|
|
43
|
-
if mstring:
|
|
44
|
-
if mstring in self.objlist:
|
|
45
|
-
return True
|
|
46
|
-
else:
|
|
47
|
-
return False
|
|
48
|
-
else:
|
|
49
|
-
print("传入的string为空的")
|
|
50
|
-
return False
|
|
51
|
-
|
|
52
|
-
def remove(self, mstring):
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
:param mstring: 需要删除的字符串
|
|
56
|
-
:return:
|
|
57
|
-
"""
|
|
58
|
-
if mstring:
|
|
59
|
-
if mstring in self.objlist:
|
|
60
|
-
self.objlist.remove(mstring)
|
|
61
|
-
self.num = self.num - 1
|
|
62
|
-
|
|
63
|
-
def length(self):
|
|
64
|
-
"""
|
|
65
|
-
获取列表当前长度 及环型列表现在的长度
|
|
66
|
-
:return:
|
|
67
|
-
"""
|
|
68
|
-
return len(self.objlist)
|
|
69
|
-
|
|
70
|
-
def get_random(self):
|
|
71
|
-
"""
|
|
72
|
-
获取随机代理
|
|
73
|
-
:return:
|
|
74
|
-
"""
|
|
75
|
-
return random.choice(self.objlist)
|
|
76
|
-
|
|
77
|
-
# if __name__ == "__main__":
|
|
78
|
-
# ringList = RingList()
|
|
79
|
-
# for i in range(1,100):
|
|
80
|
-
# ringList.append(i)
|
|
81
|
-
# # print(ringList.objlist)
|
|
82
|
-
# # print(ringList.num)
|
|
83
|
-
# # print()
|
|
84
|
-
# while True:
|
|
85
|
-
# print(ringList.pop())
|
|
1
|
+
import random
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class RingList(object):
|
|
5
|
+
def __init__(self):
|
|
6
|
+
"""
|
|
7
|
+
环形列表初始化
|
|
8
|
+
"""
|
|
9
|
+
self.objlist = list()
|
|
10
|
+
# 列表中数据总量
|
|
11
|
+
self.num = 0
|
|
12
|
+
self.index = 0
|
|
13
|
+
|
|
14
|
+
def append(self, p_object):
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
:param p_object: 增加到环形列表的元素
|
|
18
|
+
:return:
|
|
19
|
+
"""
|
|
20
|
+
self.num += 1
|
|
21
|
+
self.objlist.append(p_object)
|
|
22
|
+
|
|
23
|
+
def pop(self, index=None):
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
:param index: 如果给index值,将会返回固定的该索引位置的值;如果不给,将会循环输出该列表的值
|
|
27
|
+
:return:
|
|
28
|
+
"""
|
|
29
|
+
if self.num == 0:
|
|
30
|
+
return None
|
|
31
|
+
if index is not None:
|
|
32
|
+
self.index = index
|
|
33
|
+
obj = self.objlist[self.index % self.num]
|
|
34
|
+
self.index += 1
|
|
35
|
+
return obj
|
|
36
|
+
|
|
37
|
+
def exist(self, mstring):
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
:param mstring: 需要验证是否存在的字符串
|
|
41
|
+
:return:
|
|
42
|
+
"""
|
|
43
|
+
if mstring:
|
|
44
|
+
if mstring in self.objlist:
|
|
45
|
+
return True
|
|
46
|
+
else:
|
|
47
|
+
return False
|
|
48
|
+
else:
|
|
49
|
+
print("传入的string为空的")
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
def remove(self, mstring):
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
:param mstring: 需要删除的字符串
|
|
56
|
+
:return:
|
|
57
|
+
"""
|
|
58
|
+
if mstring:
|
|
59
|
+
if mstring in self.objlist:
|
|
60
|
+
self.objlist.remove(mstring)
|
|
61
|
+
self.num = self.num - 1
|
|
62
|
+
|
|
63
|
+
def length(self):
|
|
64
|
+
"""
|
|
65
|
+
获取列表当前长度 及环型列表现在的长度
|
|
66
|
+
:return:
|
|
67
|
+
"""
|
|
68
|
+
return len(self.objlist)
|
|
69
|
+
|
|
70
|
+
def get_random(self):
|
|
71
|
+
"""
|
|
72
|
+
获取随机代理
|
|
73
|
+
:return:
|
|
74
|
+
"""
|
|
75
|
+
return random.choice(self.objlist)
|
|
76
|
+
|
|
77
|
+
# if __name__ == "__main__":
|
|
78
|
+
# ringList = RingList()
|
|
79
|
+
# for i in range(1,100):
|
|
80
|
+
# ringList.append(i)
|
|
81
|
+
# # print(ringList.objlist)
|
|
82
|
+
# # print(ringList.num)
|
|
83
|
+
# # print()
|
|
84
|
+
# while True:
|
|
85
|
+
# print(ringList.pop())
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
def compare(a: str, b: str):
|
|
2
|
-
'''
|
|
3
|
-
比较两个版本的大小,需要按.分割后比较各个部分的大小
|
|
4
|
-
:return 返回较大的版本号
|
|
5
|
-
'''
|
|
6
|
-
lena = len(a.split('.')) # 获取版本字符串的组成部分
|
|
7
|
-
lenb = len(b.split('.'))
|
|
8
|
-
a2 = a + '.0' * (lenb-lena) # b比a长的时候补全a
|
|
9
|
-
b2 = b + '.0' * (lena-lenb)
|
|
10
|
-
for i in range(max(lena, lenb)): # 对每个部分进行比较,需要转化为整数进行比较
|
|
11
|
-
if int(a2.split('.')[i]) > int(b2.split('.')[i]):
|
|
12
|
-
return a
|
|
13
|
-
elif int(a2.split('.')[i]) < int(b2.split('.')[i]):
|
|
14
|
-
return b
|
|
15
|
-
else: # 比较到最后都相等,则返回第一个版本
|
|
16
|
-
if i == max(lena, lenb)-1:
|
|
17
|
-
return a
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def compare_bool(a: str, b: str):
|
|
21
|
-
'''
|
|
22
|
-
比较两个版本的大小,需要按.分割后比较各个部分的大小
|
|
23
|
-
:return 如果 a >= b 返回true
|
|
24
|
-
'''
|
|
25
|
-
lena = len(a.split('.')) # 获取版本字符串的组成部分
|
|
26
|
-
lenb = len(b.split('.'))
|
|
27
|
-
a2 = a + '.0' * (lenb-lena) # b比a长的时候补全a
|
|
28
|
-
b2 = b + '.0' * (lena-lenb)
|
|
29
|
-
for i in range(max(lena, lenb)): # 对每个部分进行比较,需要转化为整数进行比较
|
|
30
|
-
if int(a2.split('.')[i]) > int(b2.split('.')[i]):
|
|
31
|
-
return True
|
|
32
|
-
elif int(a2.split('.')[i]) < int(b2.split('.')[i]):
|
|
33
|
-
return False
|
|
34
|
-
else: # 比较到最后都相等,则返回第一个版本
|
|
35
|
-
if i == max(lena, lenb)-1:
|
|
36
|
-
return True
|
|
1
|
+
def compare(a: str, b: str):
|
|
2
|
+
'''
|
|
3
|
+
比较两个版本的大小,需要按.分割后比较各个部分的大小
|
|
4
|
+
:return 返回较大的版本号
|
|
5
|
+
'''
|
|
6
|
+
lena = len(a.split('.')) # 获取版本字符串的组成部分
|
|
7
|
+
lenb = len(b.split('.'))
|
|
8
|
+
a2 = a + '.0' * (lenb-lena) # b比a长的时候补全a
|
|
9
|
+
b2 = b + '.0' * (lena-lenb)
|
|
10
|
+
for i in range(max(lena, lenb)): # 对每个部分进行比较,需要转化为整数进行比较
|
|
11
|
+
if int(a2.split('.')[i]) > int(b2.split('.')[i]):
|
|
12
|
+
return a
|
|
13
|
+
elif int(a2.split('.')[i]) < int(b2.split('.')[i]):
|
|
14
|
+
return b
|
|
15
|
+
else: # 比较到最后都相等,则返回第一个版本
|
|
16
|
+
if i == max(lena, lenb)-1:
|
|
17
|
+
return a
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def compare_bool(a: str, b: str):
|
|
21
|
+
'''
|
|
22
|
+
比较两个版本的大小,需要按.分割后比较各个部分的大小
|
|
23
|
+
:return 如果 a >= b 返回true
|
|
24
|
+
'''
|
|
25
|
+
lena = len(a.split('.')) # 获取版本字符串的组成部分
|
|
26
|
+
lenb = len(b.split('.'))
|
|
27
|
+
a2 = a + '.0' * (lenb-lena) # b比a长的时候补全a
|
|
28
|
+
b2 = b + '.0' * (lena-lenb)
|
|
29
|
+
for i in range(max(lena, lenb)): # 对每个部分进行比较,需要转化为整数进行比较
|
|
30
|
+
if int(a2.split('.')[i]) > int(b2.split('.')[i]):
|
|
31
|
+
return True
|
|
32
|
+
elif int(a2.split('.')[i]) < int(b2.split('.')[i]):
|
|
33
|
+
return False
|
|
34
|
+
else: # 比较到最后都相等,则返回第一个版本
|
|
35
|
+
if i == max(lena, lenb)-1:
|
|
36
|
+
return True
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import requests
|
|
3
|
-
import time
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
######################################################################
|
|
7
|
-
|
|
8
|
-
class YDMHttp(object):
|
|
9
|
-
"""
|
|
10
|
-
云打码已废弃,(跑路)
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
def __init__(self, username='office', password='officeHelper$123', appid=1, appkey='22cc5376925e9387a23cf797cb9ba745'):
|
|
14
|
-
self.username = username
|
|
15
|
-
self.password = password
|
|
16
|
-
self.appid = str(appid)
|
|
17
|
-
self.appkey = appkey
|
|
18
|
-
self.apiurl = 'http://api.yundama.com/api.php'
|
|
19
|
-
|
|
20
|
-
def request(self, fields, files=[]):
|
|
21
|
-
response = self.post_url(self.apiurl, fields, files)
|
|
22
|
-
response = json.loads(response)
|
|
23
|
-
return response
|
|
24
|
-
|
|
25
|
-
def balance(self):
|
|
26
|
-
data = {'method': 'balance', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
27
|
-
'appkey': self.appkey}
|
|
28
|
-
response = self.request(data)
|
|
29
|
-
if (response):
|
|
30
|
-
if (response['ret'] and response['ret'] < 0):
|
|
31
|
-
return response['ret']
|
|
32
|
-
else:
|
|
33
|
-
return response['balance']
|
|
34
|
-
else:
|
|
35
|
-
return -9001
|
|
36
|
-
|
|
37
|
-
def login(self):
|
|
38
|
-
data = {'method': 'login', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
39
|
-
'appkey': self.appkey}
|
|
40
|
-
response = self.request(data)
|
|
41
|
-
if (response):
|
|
42
|
-
if (response['ret'] and response['ret'] < 0):
|
|
43
|
-
return response['ret']
|
|
44
|
-
else:
|
|
45
|
-
return response['uid']
|
|
46
|
-
else:
|
|
47
|
-
return -9001
|
|
48
|
-
|
|
49
|
-
def upload(self, filename, codetype, timeout):
|
|
50
|
-
data = {'method': 'upload', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
51
|
-
'appkey': self.appkey, 'codetype': str(codetype), 'timeout': str(timeout)}
|
|
52
|
-
file = {'file': filename}
|
|
53
|
-
response = self.request(data, file)
|
|
54
|
-
if (response):
|
|
55
|
-
if (response['ret'] and response['ret'] < 0):
|
|
56
|
-
return response['ret']
|
|
57
|
-
else:
|
|
58
|
-
return response['cid']
|
|
59
|
-
else:
|
|
60
|
-
return -9001
|
|
61
|
-
|
|
62
|
-
def result(self, cid):
|
|
63
|
-
data = {'method': 'result', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
64
|
-
'appkey': self.appkey, 'cid': str(cid)}
|
|
65
|
-
response = self.request(data)
|
|
66
|
-
return response and response['text'] or ''
|
|
67
|
-
|
|
68
|
-
def decode(self, filename, codetype, timeout):
|
|
69
|
-
cid = self.upload(filename, codetype, timeout)
|
|
70
|
-
if (cid > 0):
|
|
71
|
-
for i in range(0, timeout):
|
|
72
|
-
result = self.result(cid)
|
|
73
|
-
if (result != ''):
|
|
74
|
-
return cid, result
|
|
75
|
-
else:
|
|
76
|
-
time.sleep(1)
|
|
77
|
-
return -3003, ''
|
|
78
|
-
else:
|
|
79
|
-
return cid, ''
|
|
80
|
-
|
|
81
|
-
def report(self, cid):
|
|
82
|
-
data = {'method': 'report', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
83
|
-
'appkey': self.appkey, 'cid': str(cid), 'flag': '0'}
|
|
84
|
-
response = self.request(data)
|
|
85
|
-
if (response):
|
|
86
|
-
return response['ret']
|
|
87
|
-
else:
|
|
88
|
-
return -9001
|
|
89
|
-
|
|
90
|
-
def post_url(self, url, fields, files=[]):
|
|
91
|
-
# 在传入二进制时,下面两行官方代码需注释掉
|
|
92
|
-
# for key in files:
|
|
93
|
-
# files[key] = open(files[key], 'rb');
|
|
94
|
-
res = requests.post(url, files=files, data=fields)
|
|
95
|
-
return res.text
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
######################################################################
|
|
99
|
-
|
|
100
|
-
def Img2Code(self, content, codetype='1004', timeout=5):
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
:param content: 图片文件
|
|
104
|
-
:param codetype: 验证码类型,
|
|
105
|
-
例:1004表示4位字母数字,不同类型收费不同。请准确填写,否则影响识别率。
|
|
106
|
-
在此查询所有类型 http://www.yundama.com/price.html
|
|
107
|
-
:param timeout: 超时时间,秒
|
|
108
|
-
:return: 验证码
|
|
109
|
-
"""
|
|
110
|
-
|
|
111
|
-
# 登陆云打码
|
|
112
|
-
uid = self.login()
|
|
113
|
-
print('uid: %s' % uid)
|
|
114
|
-
|
|
115
|
-
# 查询余额
|
|
116
|
-
balance = self.balance()
|
|
117
|
-
print('balance: %s' % balance)
|
|
118
|
-
if int(balance) < 100000:
|
|
119
|
-
print('Warning: Need Money !!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
120
|
-
|
|
121
|
-
# 开始识别,图片路径,验证码类型ID,超时时间(秒),识别结果
|
|
122
|
-
cid, result = self.decode(content, codetype, timeout)
|
|
123
|
-
print('cid: %s, result: %s' % (cid, result))
|
|
124
|
-
return result
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
import json
|
|
2
|
+
import requests
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
######################################################################
|
|
7
|
+
|
|
8
|
+
class YDMHttp(object):
|
|
9
|
+
"""
|
|
10
|
+
云打码已废弃,(跑路)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, username='office', password='officeHelper$123', appid=1, appkey='22cc5376925e9387a23cf797cb9ba745'):
|
|
14
|
+
self.username = username
|
|
15
|
+
self.password = password
|
|
16
|
+
self.appid = str(appid)
|
|
17
|
+
self.appkey = appkey
|
|
18
|
+
self.apiurl = 'http://api.yundama.com/api.php'
|
|
19
|
+
|
|
20
|
+
def request(self, fields, files=[]):
|
|
21
|
+
response = self.post_url(self.apiurl, fields, files)
|
|
22
|
+
response = json.loads(response)
|
|
23
|
+
return response
|
|
24
|
+
|
|
25
|
+
def balance(self):
|
|
26
|
+
data = {'method': 'balance', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
27
|
+
'appkey': self.appkey}
|
|
28
|
+
response = self.request(data)
|
|
29
|
+
if (response):
|
|
30
|
+
if (response['ret'] and response['ret'] < 0):
|
|
31
|
+
return response['ret']
|
|
32
|
+
else:
|
|
33
|
+
return response['balance']
|
|
34
|
+
else:
|
|
35
|
+
return -9001
|
|
36
|
+
|
|
37
|
+
def login(self):
|
|
38
|
+
data = {'method': 'login', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
39
|
+
'appkey': self.appkey}
|
|
40
|
+
response = self.request(data)
|
|
41
|
+
if (response):
|
|
42
|
+
if (response['ret'] and response['ret'] < 0):
|
|
43
|
+
return response['ret']
|
|
44
|
+
else:
|
|
45
|
+
return response['uid']
|
|
46
|
+
else:
|
|
47
|
+
return -9001
|
|
48
|
+
|
|
49
|
+
def upload(self, filename, codetype, timeout):
|
|
50
|
+
data = {'method': 'upload', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
51
|
+
'appkey': self.appkey, 'codetype': str(codetype), 'timeout': str(timeout)}
|
|
52
|
+
file = {'file': filename}
|
|
53
|
+
response = self.request(data, file)
|
|
54
|
+
if (response):
|
|
55
|
+
if (response['ret'] and response['ret'] < 0):
|
|
56
|
+
return response['ret']
|
|
57
|
+
else:
|
|
58
|
+
return response['cid']
|
|
59
|
+
else:
|
|
60
|
+
return -9001
|
|
61
|
+
|
|
62
|
+
def result(self, cid):
|
|
63
|
+
data = {'method': 'result', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
64
|
+
'appkey': self.appkey, 'cid': str(cid)}
|
|
65
|
+
response = self.request(data)
|
|
66
|
+
return response and response['text'] or ''
|
|
67
|
+
|
|
68
|
+
def decode(self, filename, codetype, timeout):
|
|
69
|
+
cid = self.upload(filename, codetype, timeout)
|
|
70
|
+
if (cid > 0):
|
|
71
|
+
for i in range(0, timeout):
|
|
72
|
+
result = self.result(cid)
|
|
73
|
+
if (result != ''):
|
|
74
|
+
return cid, result
|
|
75
|
+
else:
|
|
76
|
+
time.sleep(1)
|
|
77
|
+
return -3003, ''
|
|
78
|
+
else:
|
|
79
|
+
return cid, ''
|
|
80
|
+
|
|
81
|
+
def report(self, cid):
|
|
82
|
+
data = {'method': 'report', 'username': self.username, 'password': self.password, 'appid': self.appid,
|
|
83
|
+
'appkey': self.appkey, 'cid': str(cid), 'flag': '0'}
|
|
84
|
+
response = self.request(data)
|
|
85
|
+
if (response):
|
|
86
|
+
return response['ret']
|
|
87
|
+
else:
|
|
88
|
+
return -9001
|
|
89
|
+
|
|
90
|
+
def post_url(self, url, fields, files=[]):
|
|
91
|
+
# 在传入二进制时,下面两行官方代码需注释掉
|
|
92
|
+
# for key in files:
|
|
93
|
+
# files[key] = open(files[key], 'rb');
|
|
94
|
+
res = requests.post(url, files=files, data=fields)
|
|
95
|
+
return res.text
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
######################################################################
|
|
99
|
+
|
|
100
|
+
def Img2Code(self, content, codetype='1004', timeout=5):
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
:param content: 图片文件
|
|
104
|
+
:param codetype: 验证码类型,
|
|
105
|
+
例:1004表示4位字母数字,不同类型收费不同。请准确填写,否则影响识别率。
|
|
106
|
+
在此查询所有类型 http://www.yundama.com/price.html
|
|
107
|
+
:param timeout: 超时时间,秒
|
|
108
|
+
:return: 验证码
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
# 登陆云打码
|
|
112
|
+
uid = self.login()
|
|
113
|
+
print('uid: %s' % uid)
|
|
114
|
+
|
|
115
|
+
# 查询余额
|
|
116
|
+
balance = self.balance()
|
|
117
|
+
print('balance: %s' % balance)
|
|
118
|
+
if int(balance) < 100000:
|
|
119
|
+
print('Warning: Need Money !!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
120
|
+
|
|
121
|
+
# 开始识别,图片路径,验证码类型ID,超时时间(秒),识别结果
|
|
122
|
+
cid, result = self.decode(content, codetype, timeout)
|
|
123
|
+
print('cid: %s, result: %s' % (cid, result))
|
|
124
|
+
return result
|
|
125
|
+
|
|
126
|
+
|
re_common/facade/lazy_import.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# 延迟导入 主要是为了使用时不去安装多余的
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def get_TomlConfig():
|
|
5
|
-
from re_common.baselibrary.readconfig.toml_config import TomlConfig
|
|
6
|
-
return TomlConfig
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_streamlogger():
|
|
10
|
-
from re_common.baselibrary import MLogger
|
|
11
|
-
return MLogger().streamlogger
|
|
1
|
+
# 延迟导入 主要是为了使用时不去安装多余的
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def get_TomlConfig():
|
|
5
|
+
from re_common.baselibrary.readconfig.toml_config import TomlConfig
|
|
6
|
+
return TomlConfig
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_streamlogger():
|
|
10
|
+
from re_common.baselibrary import MLogger
|
|
11
|
+
return MLogger().streamlogger
|
re_common/facade/loggerfacade.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"""
|
|
2
|
-
提供logger的使用外观 外观模式
|
|
3
|
-
"""
|
|
4
|
-
from re_common.baselibrary import MLogger
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def get_streamlogger():
|
|
8
|
-
"""
|
|
9
|
-
提供一个输出流的logger
|
|
10
|
-
:return:
|
|
11
|
-
"""
|
|
12
|
-
return MLogger().streamlogger
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def get_filelogger(filedir):
|
|
16
|
-
"""
|
|
17
|
-
文件流的logger
|
|
18
|
-
:param filedir:
|
|
19
|
-
:return:
|
|
20
|
-
"""
|
|
21
|
-
return MLogger(filedir).filelogger
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def get_timerotatingfilelogger(filedir, fileter=None):
|
|
25
|
-
return MLogger(filedir, fileter).timerotatingfilelogger
|
|
1
|
+
"""
|
|
2
|
+
提供logger的使用外观 外观模式
|
|
3
|
+
"""
|
|
4
|
+
from re_common.baselibrary import MLogger
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_streamlogger():
|
|
8
|
+
"""
|
|
9
|
+
提供一个输出流的logger
|
|
10
|
+
:return:
|
|
11
|
+
"""
|
|
12
|
+
return MLogger().streamlogger
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_filelogger(filedir):
|
|
16
|
+
"""
|
|
17
|
+
文件流的logger
|
|
18
|
+
:param filedir:
|
|
19
|
+
:return:
|
|
20
|
+
"""
|
|
21
|
+
return MLogger(filedir).filelogger
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_timerotatingfilelogger(filedir, fileter=None):
|
|
25
|
+
return MLogger(filedir, fileter).timerotatingfilelogger
|