ratio1 3.4.82__py3-none-any.whl → 3.4.84__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.
- ratio1/_ver.py +1 -1
- ratio1/ipfs/r1fs.py +9 -2
- ratio1/logging/logger_mixins/pickle_serialization_mixin.py +11 -5
- {ratio1-3.4.82.dist-info → ratio1-3.4.84.dist-info}/METADATA +1 -1
- {ratio1-3.4.82.dist-info → ratio1-3.4.84.dist-info}/RECORD +8 -8
- {ratio1-3.4.82.dist-info → ratio1-3.4.84.dist-info}/WHEEL +0 -0
- {ratio1-3.4.82.dist-info → ratio1-3.4.84.dist-info}/entry_points.txt +0 -0
- {ratio1-3.4.82.dist-info → ratio1-3.4.84.dist-info}/licenses/LICENSE +0 -0
ratio1/_ver.py
CHANGED
ratio1/ipfs/r1fs.py
CHANGED
|
@@ -67,6 +67,7 @@ from io import BytesIO
|
|
|
67
67
|
import ssl
|
|
68
68
|
from requests.auth import HTTPBasicAuth
|
|
69
69
|
import tempfile
|
|
70
|
+
import random
|
|
70
71
|
|
|
71
72
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
72
73
|
|
|
@@ -739,9 +740,10 @@ class R1FSEngine:
|
|
|
739
740
|
def add_file(
|
|
740
741
|
self,
|
|
741
742
|
file_path: str,
|
|
743
|
+
nonce: int = None,
|
|
742
744
|
secret: str = None,
|
|
743
745
|
raise_on_error: bool = False,
|
|
744
|
-
show_logs: bool = True
|
|
746
|
+
show_logs: bool = True,
|
|
745
747
|
) -> str:
|
|
746
748
|
"""
|
|
747
749
|
Add a file to R1FS with default encryption. The secret parameter is mandatory,
|
|
@@ -797,7 +799,12 @@ class R1FSEngine:
|
|
|
797
799
|
raise ValueError(f"File {file_path} is too large ({file_size} bytes). Maximum allowed size is 2 GB.")
|
|
798
800
|
|
|
799
801
|
key = self._hash_secret(secret) # mandatory passphrase
|
|
800
|
-
|
|
802
|
+
|
|
803
|
+
if nonce is None:
|
|
804
|
+
nonce = os.urandom(12) # recommended for GCM
|
|
805
|
+
else:
|
|
806
|
+
nonce = random.Random(nonce).randbytes(12)
|
|
807
|
+
|
|
801
808
|
original_basename = os.path.basename(file_path)
|
|
802
809
|
|
|
803
810
|
# JSON metadata storing the original filename
|
|
@@ -89,6 +89,8 @@ class _PickleSerializationMixin(object):
|
|
|
89
89
|
os.makedirs(os.path.split(datafile)[0], exist_ok=True)
|
|
90
90
|
|
|
91
91
|
tm_start = time()
|
|
92
|
+
tm_elapsed = None
|
|
93
|
+
err_msg = None
|
|
92
94
|
if compressed or '.pklz' in fn:
|
|
93
95
|
if not compressed:
|
|
94
96
|
P("Saving pickle with compression=True forced due to extension")
|
|
@@ -106,11 +108,15 @@ class _PickleSerializationMixin(object):
|
|
|
106
108
|
with open(datafile, 'wb') as fhandle:
|
|
107
109
|
pickle.dump(data, fhandle, protocol=pickle.HIGHEST_PROTOCOL)
|
|
108
110
|
tm_elapsed = time() - tm_start
|
|
109
|
-
except:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
except Exception as e:
|
|
112
|
+
err_msg = e
|
|
113
|
+
if tm_elapsed is not None:
|
|
114
|
+
if verbose:
|
|
115
|
+
P(" Saved pickle '{}' in '{}' folder in {:.1f}s".format(fn, folder, tm_elapsed))
|
|
116
|
+
else:
|
|
117
|
+
# maybe show this only if verbose?
|
|
118
|
+
P(f" FAILED pickle save! Error: {err_msg}")
|
|
119
|
+
# endif compressed or not
|
|
114
120
|
return datafile
|
|
115
121
|
|
|
116
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ratio1
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.84
|
|
4
4
|
Summary: `ratio1` or Ration1 SDK is the Python SDK required for client app development for the Ratio1 ecosystem
|
|
5
5
|
Project-URL: Homepage, https://github.com/Ratio1/ratio1_sdk
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Ratio1/ratio1_sdk/issues
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
ratio1/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
|
|
2
|
-
ratio1/_ver.py,sha256=
|
|
2
|
+
ratio1/_ver.py,sha256=_MLEuDeZiCUunApTcwOfbV0uV-7L8FXhhe9_9nS_nWk,331
|
|
3
3
|
ratio1/base_decentra_object.py,sha256=iXvAAf6wPnGWzeeiRfwLojVoan-m1e_VsyPzjUQuENo,4492
|
|
4
4
|
ratio1/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
|
5
5
|
ratio1/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
|
@@ -68,7 +68,7 @@ ratio1/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7
|
|
|
68
68
|
ratio1/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
|
|
69
69
|
ratio1/ipfs/__init__.py,sha256=vXEDLUNUO6lOTMGa8iQ9Zf7ajIQq9GZuvYraAHt3meE,38
|
|
70
70
|
ratio1/ipfs/ifps_keygen,sha256=PcoYuo4c89_C9FWrKq9K_28ruhKqnxNn1s3nLHiF1tc,879
|
|
71
|
-
ratio1/ipfs/r1fs.py,sha256=
|
|
71
|
+
ratio1/ipfs/r1fs.py,sha256=bslLpr0FTiqBsXPCoAqmH62MDki1lkvgW-oT7TvgFcQ,49458
|
|
72
72
|
ratio1/ipfs/ipfs_setup/ipfs.service,sha256=isTJQsktPy4i1yaDA9AC1OKdlTYvsCCRRAVX-EmGqAs,248
|
|
73
73
|
ratio1/ipfs/ipfs_setup/launch_service.sh,sha256=GWhZyNqtohLxJg8Q_c8YnNZduu1ddXDU-IFRRMaEyiY,141
|
|
74
74
|
ratio1/ipfs/ipfs_setup/restart.sh,sha256=9xHMgkUoAMI25jeaoDVFbCa_LjojYm3ubljW58RatKE,22
|
|
@@ -87,7 +87,7 @@ ratio1/logging/logger_mixins/download_mixin.py,sha256=ZZ1QuQ7kDcUkxhu65odD2pvBRl
|
|
|
87
87
|
ratio1/logging/logger_mixins/general_serialization_mixin.py,sha256=bNM-6AsYhKD56v79hvJDgO8un5rHH4IKv1XJ3yksseQ,7424
|
|
88
88
|
ratio1/logging/logger_mixins/json_serialization_mixin.py,sha256=JnfVOdQQTlx10sTLjQv8d7DO-1lNKuK4E8vMSE_t--Q,15198
|
|
89
89
|
ratio1/logging/logger_mixins/machine_mixin.py,sha256=VoGijSjj0CwfbSo_jjp3uvs_aovWwQHNDEqu5jzmWJE,3640
|
|
90
|
-
ratio1/logging/logger_mixins/pickle_serialization_mixin.py,sha256=
|
|
90
|
+
ratio1/logging/logger_mixins/pickle_serialization_mixin.py,sha256=T2NubHBoXPkIjSEM-9NgIiYfVbOk3qHI2VQ2BkHp_MY,9553
|
|
91
91
|
ratio1/logging/logger_mixins/process_mixin.py,sha256=eI0izBAhStPOant2SZv2ZuTDH10s2ON_CkuGQEEFew4,1888
|
|
92
92
|
ratio1/logging/logger_mixins/resource_size_mixin.py,sha256=nH0R9RmhJxatX_qSQu_CtkLD6sH2stMOylpp_Ym6mHI,2281
|
|
93
93
|
ratio1/logging/logger_mixins/timers_mixin.py,sha256=jXQvGxpemTrKZRI5ydrTUYrqAnXzZnvwzpqN4agJlGo,17299
|
|
@@ -103,8 +103,8 @@ ratio1/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,10
|
|
|
103
103
|
ratio1/utils/config.py,sha256=Elfkl7W4aDMvB5WZLiYlPXrecBncgTxb4hcKhQedMzI,10111
|
|
104
104
|
ratio1/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
|
105
105
|
ratio1/utils/oracle_sync/oracle_tester.py,sha256=aJOPcZhtbw1XPqsFG4qYpfv2Taj5-qRXbwJzrPyeXDE,27465
|
|
106
|
-
ratio1-3.4.
|
|
107
|
-
ratio1-3.4.
|
|
108
|
-
ratio1-3.4.
|
|
109
|
-
ratio1-3.4.
|
|
110
|
-
ratio1-3.4.
|
|
106
|
+
ratio1-3.4.84.dist-info/METADATA,sha256=rtoAy7UB59eVghuv0hNVKyhb-oGwBR29u2c8WajHzck,12255
|
|
107
|
+
ratio1-3.4.84.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
108
|
+
ratio1-3.4.84.dist-info/entry_points.txt,sha256=DR_olREzU1egwmgek3s4GfQslBi-KR7lXsd4ap0TFxE,46
|
|
109
|
+
ratio1-3.4.84.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
|
110
|
+
ratio1-3.4.84.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|