internal 1.0.50__py3-none-any.whl → 1.0.52__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.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

@@ -42,6 +42,12 @@ async def async_response(data=None, message=None, code=None, page_no=None, total
42
42
  if data[field_name]:
43
43
  data[field_name] = arrow.get(data[field_name]).to(time_zone).format(date_format)
44
44
 
45
+ if "create_time" in data.keys() and data.get("create_time"):
46
+ data["create_time"] = arrow.get(data["create_time"]).to(time_zone).format(ARR_HUMAN_READ_FMT)
47
+
48
+ if "update_time" in data.keys() and data.get("update_time"):
49
+ data["update_time"] = arrow.get(data["update_time"]).to(time_zone).format(ARR_HUMAN_READ_FMT)
50
+
45
51
  return data
46
52
 
47
53
  if isinstance(data, httpx.Response):
internal/model/operate.py CHANGED
@@ -1,3 +1,5 @@
1
+ import arrow
2
+ from datetime import datetime
1
3
  from typing import Optional
2
4
 
3
5
  import dictdiffer
@@ -13,11 +15,13 @@ class Operate(BaseModel):
13
15
  async def generate_operate(cls, original: dict = None, compare: dict = None):
14
16
  if original:
15
17
  original = await cls.remove_ignore_field(original)
18
+ await cls.convert_datetime_timezone_utc_field(original)
16
19
  else:
17
20
  original = {}
18
21
 
19
22
  if compare:
20
23
  compare = await cls.remove_ignore_field(compare)
24
+ await cls.convert_datetime_timezone_utc_field(compare)
21
25
  else:
22
26
  compare = {}
23
27
 
@@ -43,3 +47,10 @@ class Operate(BaseModel):
43
47
  @classmethod
44
48
  async def remove_ignore_field(cls, model_dict: dict):
45
49
  return {k: v for k, v in model_dict.items() if k not in ['create_time', 'update_time']}
50
+
51
+ @classmethod
52
+ async def convert_datetime_timezone_utc_field(cls, model_dict: dict):
53
+ # 統一使用arrow.get取代datetime,使其包含tzinfo,避免diff因時區有無判斷錯誤
54
+ for k, v in model_dict.items():
55
+ if isinstance(v, datetime):
56
+ model_dict[k] = arrow.get(v).datetime
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: internal
3
- Version: 1.0.50
3
+ Version: 1.0.52
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -19,15 +19,15 @@ internal/ext/amazon/aws/__init__.py,sha256=2YFjb-rHG1JaZGZiZffYDesgTAJjDshOqQbsw
19
19
  internal/ext/amazon/aws/const.py,sha256=l4WMg5bKWujwOKABBkCO2zclNg3abnYOfbhD7DG8GsA,109
20
20
  internal/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  internal/http/requests.py,sha256=4Mdu_HIGDEgpgey8IPusqBn9s-3-oYGU0S49NK-khc4,1821
22
- internal/http/responses.py,sha256=1TuSCHEm9ygLE3Y8adP46h39cHLLdqMZPwFmJCsKrBg,2555
22
+ internal/http/responses.py,sha256=_xhp52Y4T8tGQ4g6U8gh71WADLECibOAV42jKSvtvtw,2923
23
23
  internal/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  internal/interface/base_interface.py,sha256=3YaVjIgLi_pZpLk5SEIk8WVkuICM8qPavT8rB0MdB5U,1536
25
25
  internal/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  internal/middleware/log_request.py,sha256=bXAxmvvsYDhObXzfUw4ZNreKAWOo8ee_vpb6Xin5ztc,854
27
27
  internal/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  internal/model/base_model.py,sha256=NS_GZvw_IqU1aZPHPpyQs6A741O34ybmzVzBPm9nGWU,3014
29
- internal/model/operate.py,sha256=luEoP_Asvso_11qz1SAE1Kn5KxAnDRptM0VylC5tNik,1493
29
+ internal/model/operate.py,sha256=kufXKxDknAneXTL_ycb7THBVvOmXFftYLx18bvdSARI,2004
30
30
  internal/utils.py,sha256=0SubS0iUhDvjSX1F4TykasA5-enYJzt2VH-f7_0BnjI,1509
31
- internal-1.0.50.dist-info/METADATA,sha256=21ZTXLdhaJ_Wm_YWqy5pE-JtsYdHhZ08Ycv0cm5LE7o,625
32
- internal-1.0.50.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
- internal-1.0.50.dist-info/RECORD,,
31
+ internal-1.0.52.dist-info/METADATA,sha256=r1OKZvB56EeglRAYrVBNli3oFvDjUdjvpLu-fz6M9a0,625
32
+ internal-1.0.52.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
33
+ internal-1.0.52.dist-info/RECORD,,