ezKit 1.6.1__tar.gz → 1.7.0__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 (28) hide show
  1. {ezKit-1.6.1/ezKit.egg-info → ezkit-1.7.0}/PKG-INFO +1 -3
  2. {ezKit-1.6.1 → ezkit-1.7.0}/README.md +9 -0
  3. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/cipher.py +1 -0
  4. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/mongo.py +9 -7
  5. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/utils.py +474 -394
  6. {ezKit-1.6.1 → ezkit-1.7.0/ezKit.egg-info}/PKG-INFO +1 -3
  7. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit.egg-info/SOURCES.txt +0 -1
  8. {ezKit-1.6.1 → ezkit-1.7.0}/setup.py +6 -5
  9. ezKit-1.6.1/ezKit.egg-info/requires.txt +0 -2
  10. {ezKit-1.6.1 → ezkit-1.7.0}/LICENSE +0 -0
  11. {ezKit-1.6.1 → ezkit-1.7.0}/MANIFEST.in +0 -0
  12. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/__init__.py +0 -0
  13. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/bottle.py +0 -0
  14. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/bottle_extensions.py +0 -0
  15. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/database.py +0 -0
  16. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/files.py +0 -0
  17. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/http.py +0 -0
  18. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/plots.py +0 -0
  19. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/qywx.py +0 -0
  20. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/redis.py +0 -0
  21. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/reports.py +0 -0
  22. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/sendemail.py +0 -0
  23. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/token.py +0 -0
  24. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/xftp.py +0 -0
  25. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit/zabbix.py +0 -0
  26. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit.egg-info/dependency_links.txt +0 -0
  27. {ezKit-1.6.1 → ezkit-1.7.0}/ezKit.egg-info/top_level.txt +0 -0
  28. {ezKit-1.6.1 → ezkit-1.7.0}/setup.cfg +0 -0
@@ -1,10 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.6.1
3
+ Version: 1.7.0
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
7
7
  Requires-Python: >=3.10
8
8
  License-File: LICENSE
9
- Requires-Dist: loguru>=0.7.0
10
- Requires-Dist: tomlkit>=0.12.0
@@ -151,6 +151,15 @@ pip install ezKit-1.1.3.tar.gz
151
151
 
152
152
  版本号说明: [PEP 440 – Version Identification and Dependency Specification](https://peps.python.org/pep-0440/)
153
153
 
154
+ ## 函数
155
+
156
+ - 明确 参数 和 返回值 的类型
157
+ - 必须有返回值
158
+ - 添加一个 debug 参数, 用于调试
159
+ - 如果 debug 为 True, 则输出相关信息, 否则一律不输出任何信息
160
+ - 必须有说明
161
+ - 必须用 try ... except ... 包裹
162
+
154
163
  try ... except ... 一律输出 Exception:
155
164
 
156
165
  ```py
@@ -2,6 +2,7 @@
2
2
  https://docs.python.org/3.10/library/hashlib.html
3
3
  https://www.pycrypto.org/
4
4
  https://stackoverflow.com/a/21928790
5
+ pip install pycryptodome
5
6
  '''
6
7
  import base64
7
8
  import hashlib
@@ -1,3 +1,4 @@
1
+ """MongoDB"""
1
2
  from loguru import logger
2
3
  from pymongo import MongoClient
3
4
 
@@ -5,21 +6,19 @@ from . import utils
5
6
 
6
7
 
7
8
  class Mongo():
9
+ """MongoDB"""
8
10
 
9
11
  client = MongoClient()
10
12
 
11
- def __init__(self, mongo_url=None):
12
- ''' Initiation '''
13
- if mongo_url != None:
14
- self.client = MongoClient(mongo_url)
15
-
16
13
  def close(self):
14
+ """client close"""
17
15
  try:
18
16
  self.client.close()
19
17
  except Exception as e:
20
18
  logger.exception(e)
21
19
 
22
20
  def connect_test(self, debug: bool = False):
21
+ """client connect test"""
23
22
  info = 'MongoDB连接测试'
24
23
  try:
25
24
  logger.info(f'{info}[执行]')
@@ -28,19 +27,22 @@ class Mongo():
28
27
  return True
29
28
  except Exception as e:
30
29
  logger.error(f'{info}[失败]')
31
- logger.exception(e) if utils.v_true(debug, bool) else next
30
+ if utils.v_true(debug, bool):
31
+ logger.exception(e)
32
32
  return False
33
33
 
34
34
  def collection(self, database, name):
35
+ """client collection"""
35
36
  return self.client[database][name]
36
37
 
37
38
  def collection_insert(self, database, collection, data, drop=None):
39
+ """client collection insert"""
38
40
  db_collection = self.client[database][collection]
39
41
  info = '插入数据'
40
42
  try:
41
43
  logger.info(f'{info}[执行]')
42
44
  # 是否删除 collection
43
- if drop == True:
45
+ if drop is True:
44
46
  # 删除 collection
45
47
  db_collection.drop()
46
48
  # 插入数据