osbot-utils 1.68.0__py3-none-any.whl → 1.69.0__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.
- osbot_utils/base_classes/Type_Safe.py +8 -1
- osbot_utils/utils/Json.py +4 -0
- osbot_utils/version +1 -1
- {osbot_utils-1.68.0.dist-info → osbot_utils-1.69.0.dist-info}/METADATA +2 -2
- {osbot_utils-1.68.0.dist-info → osbot_utils-1.69.0.dist-info}/RECORD +7 -7
- {osbot_utils-1.68.0.dist-info → osbot_utils-1.69.0.dist-info}/LICENSE +0 -0
- {osbot_utils-1.68.0.dist-info → osbot_utils-1.69.0.dist-info}/WHEEL +0 -0
@@ -14,7 +14,7 @@ from osbot_utils.helpers.Random_Guid import Random_Guid
|
|
14
14
|
from osbot_utils.helpers.Random_Guid_Short import Random_Guid_Short
|
15
15
|
from osbot_utils.helpers.Timestamp_Now import Timestamp_Now
|
16
16
|
from osbot_utils.utils.Dev import pprint
|
17
|
-
from osbot_utils.utils.Json import json_parse
|
17
|
+
from osbot_utils.utils.Json import json_parse, json_to_bytes, json_to_gz
|
18
18
|
from osbot_utils.utils.Misc import list_set
|
19
19
|
from osbot_utils.utils.Objects import default_value, value_type_matches_obj_annotation_for_attr, \
|
20
20
|
raise_exception_on_obj_type_annotation_mismatch, obj_is_attribute_annotation_of_type, enum_from_value, \
|
@@ -230,9 +230,16 @@ class Type_Safe:
|
|
230
230
|
# global methods added to any class that base classes this
|
231
231
|
# todo: see if there should be a prefix on these methods, to make it easier to spot them
|
232
232
|
# of if these are actually that useful that they should be added like this
|
233
|
+
def bytes(self):
|
234
|
+
return json_to_bytes(self.json())
|
235
|
+
|
236
|
+
def bytes_gz(self):
|
237
|
+
return json_to_gz(self.json())
|
238
|
+
|
233
239
|
def json(self):
|
234
240
|
return self.serialize_to_dict()
|
235
241
|
|
242
|
+
|
236
243
|
def merge_with(self, target):
|
237
244
|
original_attrs = {k: v for k, v in self.__dict__.items() if k not in target.__dict__} # Store the original attributes of self that should be retained.
|
238
245
|
self.__dict__ = target.__dict__ # Set the target's __dict__ to self, now self and target share the same __dict__.
|
osbot_utils/utils/Json.py
CHANGED
@@ -5,6 +5,8 @@ from osbot_utils.utils.Misc import str_lines, str_md5, str_sha256
|
|
5
5
|
from osbot_utils.utils.Files import file_create_gz, file_create, load_file_gz, file_contents, file_lines, file_lines_gz
|
6
6
|
from osbot_utils.utils.Zip import str_to_gz, gz_to_str
|
7
7
|
|
8
|
+
def bytes_to_json_loads(data):
|
9
|
+
return json.loads(data.decode())
|
8
10
|
|
9
11
|
def json_dumps(python_object, indent=4, pretty=True, sort_keys=False, default=str, raise_exception=False):
|
10
12
|
if python_object:
|
@@ -135,6 +137,7 @@ class Json:
|
|
135
137
|
def json_save_tmp_file(python_object, pretty=True):
|
136
138
|
return Json.save_file(python_object=python_object, pretty=pretty, path=None)
|
137
139
|
|
140
|
+
bytes_to_json = bytes_to_json_loads
|
138
141
|
file_create_json = Json.save_file_pretty
|
139
142
|
file_contents_json = Json.load_file
|
140
143
|
|
@@ -158,6 +161,7 @@ json_md5 = Json.md5
|
|
158
161
|
json_lines_loads = Json.loads_json_lines
|
159
162
|
json_parse = Json.loads
|
160
163
|
json_lines_parse = Json.loads_json_lines
|
164
|
+
json_to_bytes = json_dumps_to_bytes
|
161
165
|
json_to_str = json_dumps
|
162
166
|
json_round_trip = Json.round_trip
|
163
167
|
json_save = Json.save_file
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v1.
|
1
|
+
v1.69.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.69.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
Home-page: https://github.com/owasp-sbot/OSBot-Utils
|
6
6
|
License: MIT
|
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
|
|
23
23
|
|
24
24
|
Powerful Python util methods and classes that simplify common apis and tasks.
|
25
25
|
|
26
|
-

|
27
27
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
28
28
|
|
29
29
|
|
@@ -2,7 +2,7 @@ osbot_utils/__init__.py,sha256=DdJDmQc9zbQUlPVyTJOww6Ixrn9n4bD3ami5ItQfzJI,16
|
|
2
2
|
osbot_utils/base_classes/Cache_Pickle.py,sha256=kPCwrgUbf_dEdxUz7vW1GuvIPwlNXxuRhb-H3AbSpII,5884
|
3
3
|
osbot_utils/base_classes/Kwargs_To_Disk.py,sha256=HHoy05NC_w35WcT-OnSKoSIV_cLqaU9rdjH0_KNTM0E,1096
|
4
4
|
osbot_utils/base_classes/Kwargs_To_Self.py,sha256=weFNsBfBNV9W_qBkN-IdBD4yYcJV_zgTxBRO-ZlcPS4,141
|
5
|
-
osbot_utils/base_classes/Type_Safe.py,sha256=
|
5
|
+
osbot_utils/base_classes/Type_Safe.py,sha256=D8hxrU8LhuzZCuvijfYsLZzOWkQvIP5bxWtDjx-KB20,18962
|
6
6
|
osbot_utils/base_classes/Type_Safe__List.py,sha256=-80C9OhsK6iDR2dAG8yNLAZV0qg5x3faqvSUigFCMJw,517
|
7
7
|
osbot_utils/base_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
osbot_utils/context_managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -289,7 +289,7 @@ osbot_utils/utils/Files.py,sha256=7fdqbfFyo6Ow5Repi_dZAzHqGb0XYh6tDALYAy42pBY,22
|
|
289
289
|
osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
|
290
290
|
osbot_utils/utils/Http.py,sha256=Cm_-b2EgxKoQJ47ThZp-dgHCdeGv4UcCNLfTOH94-7s,7790
|
291
291
|
osbot_utils/utils/Int.py,sha256=PmlUdU4lSwf4gJdmTVdqclulkEp7KPCVUDO6AcISMF4,116
|
292
|
-
osbot_utils/utils/Json.py,sha256=
|
292
|
+
osbot_utils/utils/Json.py,sha256=8fpYFXzNPSrwYfXMt3eGKpe-lhxh1kEaCRae1X1943A,6662
|
293
293
|
osbot_utils/utils/Json_Cache.py,sha256=mLPkkDZN-3ZVJiDvV1KBJXILtKkTZ4OepzOsDoBPhWg,2006
|
294
294
|
osbot_utils/utils/Lists.py,sha256=tPz5x5s3sRO97WZ_nsxREBPC5cwaHrhgaYBhsrffTT8,5599
|
295
295
|
osbot_utils/utils/Misc.py,sha256=4MkG2BE1VzZfV4KPzYZ4jVAoUwoA3pTTVPi609ldLGA,16961
|
@@ -305,8 +305,8 @@ osbot_utils/utils/Toml.py,sha256=-_Yv5T8ZhGGoDSSoNEdFhSsXiK_JPjGkPijm4JoeHSk,166
|
|
305
305
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
306
306
|
osbot_utils/utils/Zip.py,sha256=G6Hk_hDcm9yvWzhTKzhT0R_6f0NBIAchHqMxGb3kfh4,14037
|
307
307
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
308
|
-
osbot_utils/version,sha256=
|
309
|
-
osbot_utils-1.
|
310
|
-
osbot_utils-1.
|
311
|
-
osbot_utils-1.
|
312
|
-
osbot_utils-1.
|
308
|
+
osbot_utils/version,sha256=uFIGtf3R9DfyFN5OlM7YUkWOP1gOA1X0TI8thjX5L24,8
|
309
|
+
osbot_utils-1.69.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
310
|
+
osbot_utils-1.69.0.dist-info/METADATA,sha256=Anbjvy6tfA7jEncTOegpC9l05QWOsbiQxFtKm6gLJAg,1317
|
311
|
+
osbot_utils-1.69.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
312
|
+
osbot_utils-1.69.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|