rdxz2-utill 0.0.9__py3-none-any.whl → 0.0.10__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 rdxz2-utill might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdxz2-utill
3
- Version: 0.0.9
3
+ Version: 0.0.10
4
4
  Summary: Your daily Python utility
5
5
  Author-email: Richard Dharmawan <richard.dharmawan@gmail.com>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- rdxz2_utill-0.0.9.dist-info/licenses/LICENSE,sha256=PF9CUvzP8XFYopEAzrMzSCovF7RdBdscPqJCDC6KjPc,1073
1
+ rdxz2_utill-0.0.10.dist-info/licenses/LICENSE,sha256=PF9CUvzP8XFYopEAzrMzSCovF7RdBdscPqJCDC6KjPc,1073
2
2
  utill/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  utill/my_bq.py,sha256=zxmQJUojJCHSZ7fo20ybbwz_cXnbCh9XNw4feKQJcZc,14848
4
4
  utill/my_compare.py,sha256=619QbVk3GihWxen95yVnivKHkah8GgPTLGiSkgHxykw,886
@@ -12,7 +12,7 @@ utill/my_file.py,sha256=H3QmIOwubQCUMoOuk7jwf6AnqsljWZIuM7OjelyZby4,1865
12
12
  utill/my_gcs.py,sha256=KUx89rZx2-dq-GV1LbbvbZ79Qr9NznjG1Zipop4hMZE,4216
13
13
  utill/my_input.py,sha256=OyKLoutXpwISReltuL_Gw2oojv16tYWJqQpqabBOQx4,350
14
14
  utill/my_json.py,sha256=WgW6mavGhfs4h1N5XbhsDnRk2dbh_ttJWdJUj4iWDN4,1473
15
- utill/my_mb.py,sha256=TnbeS38zFCz0TwDl5WeJ7dj3ohwPTam9EID7NNgqVqo,14843
15
+ utill/my_mb.py,sha256=IyrySs92TqtjBUvPMeUN3P2kRK8EttTFRPZsv5Cr-xw,15090
16
16
  utill/my_pg.py,sha256=ltNPAsrOJurcCQTDZfAdsOXBSnbmxPzu4E-VtMvUxcM,6708
17
17
  utill/my_queue.py,sha256=hINP4_yjmboSjHgo1J3CtPm2X9SE3HfczyED3ip7nfk,1930
18
18
  utill/my_string.py,sha256=pINYFR1ligTyVZYzV8P_FolCsZQwYE1jaFNTuQ3XS_8,833
@@ -28,8 +28,8 @@ utill/cmd/_pg.py,sha256=RVxEiSifyIwMDYDM69vt6WSLdVDr1cMzY6r4T2PzNRA,492
28
28
  utill/cmd/utill.py,sha256=TlHfiwOUcK1m58PrRCjX9sARiPYZUsoTk-KOTCOz1vM,3558
29
29
  utill/templates/mb.json,sha256=M46ZHSaSh4rbD_KGUViGr2B2ZV8_PC-O5Evqi35JK5g,59
30
30
  utill/templates/pg.json,sha256=LkJt0VV3zcyt7Tpn6gulsoVQgUc-9uImXOStvzu8cdU,271
31
- rdxz2_utill-0.0.9.dist-info/METADATA,sha256=kcJh1U-xguJncIsRiFaWECm4_FzTF0FrEa8hj_14h6Y,4401
32
- rdxz2_utill-0.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- rdxz2_utill-0.0.9.dist-info/entry_points.txt,sha256=9n5NWz5Wi9jDvYhB_81_4icgT5xABZ-QivHD8ibcafg,47
34
- rdxz2_utill-0.0.9.dist-info/top_level.txt,sha256=tuAYZoCsr02JYbpZj7I6fl1IIo53v3GG0uoj-_fINVk,6
35
- rdxz2_utill-0.0.9.dist-info/RECORD,,
31
+ rdxz2_utill-0.0.10.dist-info/METADATA,sha256=XNWgh3Y8eF9C7yX_VGUSTtoMB0Cc9A9m9x4Q-1g2PLk,4402
32
+ rdxz2_utill-0.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ rdxz2_utill-0.0.10.dist-info/entry_points.txt,sha256=9n5NWz5Wi9jDvYhB_81_4icgT5xABZ-QivHD8ibcafg,47
34
+ rdxz2_utill-0.0.10.dist-info/top_level.txt,sha256=tuAYZoCsr02JYbpZj7I6fl1IIo53v3GG0uoj-_fINVk,6
35
+ rdxz2_utill-0.0.10.dist-info/RECORD,,
utill/my_mb.py CHANGED
@@ -12,6 +12,12 @@ from .my_dict import AutoPopulatingDict
12
12
  from .my_env import MB_FILENAME
13
13
 
14
14
 
15
+ class UsersNotFoundException(Exception):
16
+ def __init__(self, username: list[str]):
17
+ self.message = f'User(s) {username} not exists'
18
+ super().__init__(self.message)
19
+
20
+
15
21
  def _decode_collection_location_to_group(collections_dict: dict, location: str):
16
22
  return ' > '.join(map(lambda x: collections_dict[x], map(int, location.strip('/').split('/'))))
17
23
 
@@ -98,7 +104,7 @@ class MB:
98
104
  not_exists.append(email)
99
105
 
100
106
  if not_exists:
101
- raise ValueError(f'Email not exists: {not_exists}')
107
+ raise UsersNotFoundException(not_exists)
102
108
 
103
109
  def create_user(self, first_name: str, last_name: str, email: str, group_ids: list):
104
110
  self.send_request(HttpMethod.POST, 'api/user', {
@@ -111,7 +117,11 @@ class MB:
111
117
  logger.info(f'✅ Create user {email}')
112
118
 
113
119
  def deactivate_user_by_email(self, email: str):
114
- user = self.dict__user_email__user[email]
120
+ try:
121
+ user = self.dict__user_email__user[email]
122
+ except KeyError as e:
123
+ raise UsersNotFoundException([email])
124
+
115
125
  self.send_request(HttpMethod.DELETE, f'api/user/{user["id"]}')
116
126
  del self.dict__user_email__user[email]
117
127
  logger.info(f'✅ Deactivate user [{user["id"]}] {email}')
@@ -120,8 +130,7 @@ class MB:
120
130
  try:
121
131
  self.dict__user_email__user[email]
122
132
  except KeyError as e:
123
- logger.error(f'User {email} not exists')
124
- raise e
133
+ raise UsersNotFoundException([email])
125
134
  self.send_request(HttpMethod.POST, 'api/session/forgot_password', {'email': email})
126
135
  logger.info(f'✅ Reset password {email}')
127
136