cloudoll 2.2.8__tar.gz → 2.2.9__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 (43) hide show
  1. {cloudoll-2.2.8 → cloudoll-2.2.9}/PKG-INFO +1 -1
  2. cloudoll-2.2.9/cloudoll/__init__.py +1 -0
  3. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/logging/__init__.py +20 -6
  4. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/__init__.py +12 -8
  5. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/model.py +1 -8
  6. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/PKG-INFO +1 -1
  7. cloudoll-2.2.8/cloudoll/__init__.py +0 -1
  8. {cloudoll-2.2.8 → cloudoll-2.2.9}/LICENSE +0 -0
  9. {cloudoll-2.2.8 → cloudoll-2.2.9}/README.md +0 -0
  10. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/__main__.py +0 -0
  11. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/cli.py +0 -0
  12. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/error/__init__.py +0 -0
  13. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/error/errors.py +0 -0
  14. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/mail/__init__.py +0 -0
  15. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/mail/smtp.py +0 -0
  16. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/base.py +0 -0
  17. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/err.py +0 -0
  18. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/field.py +0 -0
  19. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/mysql.py +0 -0
  20. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/parse.py +0 -0
  21. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/orm/postgres.py +0 -0
  22. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/__init__.py +0 -0
  23. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/dingtalk.py +0 -0
  24. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/feishu.py +0 -0
  25. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/robot/slack.py +0 -0
  26. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/__init__.py +0 -0
  27. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/common.py +0 -0
  28. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/m2d.py +0 -0
  29. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/patch_loop.py +0 -0
  30. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/utils/watch.py +0 -0
  31. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/__init__.py +0 -0
  32. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/exception.py +0 -0
  33. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/html.py +0 -0
  34. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/http.py +0 -0
  35. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/jwt.py +0 -0
  36. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll/web/settings.py +0 -0
  37. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/SOURCES.txt +0 -0
  38. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/dependency_links.txt +0 -0
  39. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/entry_points.txt +0 -0
  40. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/requires.txt +0 -0
  41. {cloudoll-2.2.8 → cloudoll-2.2.9}/cloudoll.egg-info/top_level.txt +0 -0
  42. {cloudoll-2.2.8 → cloudoll-2.2.9}/setup.cfg +0 -0
  43. {cloudoll-2.2.8 → cloudoll-2.2.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudoll
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: 辅助快速创建可分布的微服务。
5
5
  Home-page: https://gitee.com/chuchur/cloudoll-py
6
6
  Author: chuchur
@@ -0,0 +1 @@
1
+ __version__ = "2.2.9"
@@ -19,6 +19,7 @@ __ALL__ = (
19
19
  "critical",
20
20
  "print_info",
21
21
  "print_error",
22
+ "print_warn",
22
23
  )
23
24
  _COLORS = {
24
25
  # 终端输出日志颜色配置
@@ -40,9 +41,11 @@ class ColorAnsi:
40
41
 
41
42
  _FORMATS = {
42
43
  # 终端输出格式
43
- "console_format": "%(log_color)s[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
44
+ # "console_format": "%(log_color)s[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
45
+ "console_format": "%(log_color)s%(asctime)s %(levelname)s %(funcName)s %(message)s",
44
46
  # 日志输出格式
45
- "log_format": "[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
47
+ # "log_format": "[%(levelname)s]-%(asctime)s-%(pathname)s-%(module)s-%(funcName)s-[line:%(lineno)d]: %(message)s",
48
+ "log_format": "%(asctime)s %(levelname)s %(funcName)s %(message)s",
46
49
  }
47
50
 
48
51
  _LOG_SIZE = 1024 * 1024 * 1 # 1MB 日志最大1MB
@@ -138,12 +141,23 @@ class HandleLog:
138
141
  _handler = None
139
142
 
140
143
 
141
- def print_info(*msg, **kw):
142
- print(f"{ColorAnsi.GREEN}{msg}{kw}{ColorAnsi.END}")
144
+ def print_format(color_ansi, type, *args):
145
+ ft = color_ansi + "{}" + ColorAnsi.END
146
+ timestamp = ft.format(datetime.now().strftime("%Y-%m-%d %H:%M:%S") + " " + type)
147
+ text = " ".join(ft.format(str(arg)) for arg in args)
148
+ print(timestamp, text)
143
149
 
144
150
 
145
- def print_error(*msg, **kw):
146
- print(f"{ColorAnsi.RED}{msg}{kw}{ColorAnsi.END}")
151
+ def print_info(*args):
152
+ print_format(ColorAnsi.GREEN, "INFO", *args)
153
+
154
+
155
+ def print_error(*args):
156
+ print_format(ColorAnsi.RED, "ERROR", *args)
157
+
158
+
159
+ def print_warn(*args):
160
+ print_format(ColorAnsi.YELLOW, "WARN", *args)
147
161
 
148
162
 
149
163
  def _get_handle():
@@ -3,7 +3,7 @@ from .parse import parse_coon
3
3
  import aiopg, aiomysql
4
4
  from .base import MeteBase, QueryTypes
5
5
  from typing import Any
6
- from ..logging import error, print_info
6
+ from ..logging import print_info, print_error
7
7
  import traceback
8
8
 
9
9
 
@@ -35,7 +35,7 @@ async def create_engine(**kw):
35
35
  url = f"{driver}://{configs['username']}:{configs['password']}@{configs['host']}:{configs['port']}/{configs['db']}"
36
36
  return await aioredis.from_url(url, **query)
37
37
  else:
38
- error("Not suport this database type.")
38
+ print_error("Not suport this database type.")
39
39
 
40
40
 
41
41
  class Postgres(MeteBase):
@@ -104,11 +104,13 @@ class Postgres(MeteBase):
104
104
  maxsize=kw.get("maxsize", 10),
105
105
  minsize=kw.get("pool_size", 5),
106
106
  )
107
- print(f"Database connection successfuly for postgres/{kw.get('db')}")
107
+ print_info(f"Database connection successfuly for postgres/{kw.get('db')}")
108
108
  except Exception as e:
109
- error(e)
109
+ # error(e)
110
110
  # print(traceback.format_exc())
111
- error(f"Database connection failed,the instance : postgres/{kw.get('db')}")
111
+ print_error(
112
+ f"Database connection failed,the instance : postgres/{kw.get('db')}"
113
+ )
112
114
 
113
115
  return self
114
116
 
@@ -191,9 +193,11 @@ class Mysql(MeteBase):
191
193
  cursorclass=AttrDictCursor,
192
194
  loop=loop,
193
195
  )
194
- print(f"Database connection successfuly for mysql/{kw.get('db')}.")
196
+ print_info(f"Database connection successfuly for mysql/{kw.get('db')}.")
195
197
  except Exception as e:
196
- print(e)
198
+ # print(e)
197
199
  # print(traceback.format_exc())
198
- error(f"Database connection failed,the instance : mysql/{kw.get('db')}")
200
+ print_error(
201
+ f"Database connection failed,the instance : mysql/{kw.get('db')}"
202
+ )
199
203
  return self
@@ -72,14 +72,7 @@ class Model(metaclass=ModelMetaclass):
72
72
  f = getattr(self, k, None)
73
73
  f.value = None
74
74
  for k, v in kw.items():
75
- # print(f"{k}----{v}")
76
- f = getattr(self, k, None)
77
- if isinstance(f, Field):
78
- if v is None:
79
- v = f.default
80
- f.value = v
81
- else:
82
- setattr(self, k, v)
75
+ self[k] = v
83
76
 
84
77
  # super().__init__(self, **kw)
85
78
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudoll
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: 辅助快速创建可分布的微服务。
5
5
  Home-page: https://gitee.com/chuchur/cloudoll-py
6
6
  Author: chuchur
@@ -1 +0,0 @@
1
- __version__ = "2.2.8"
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