imt-ring 1.6.36__py3-none-any.whl → 1.6.37__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: imt-ring
3
- Version: 1.6.36
3
+ Version: 1.6.37
4
4
  Summary: RING: Recurrent Inertial Graph-based Estimator
5
5
  Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
6
  Project-URL: Homepage, https://github.com/SimiPixel/ring
@@ -83,10 +83,10 @@ ring/utils/hdf5.py,sha256=BzXwVypZmEZeHVgeGZ78YYdi10NEQtnPhdrb8dQAXo0,5856
83
83
  ring/utils/normalizer.py,sha256=67L2BU1MRsMT4pD41ta3JJMppLN0ozFmnwrmXDtnqrQ,1698
84
84
  ring/utils/path.py,sha256=zRPfxYNesvgefkddd26oar6f9433LkMGkhp9dF3rPUs,1926
85
85
  ring/utils/randomize_sys.py,sha256=G_vBIo0OwQkXL2u0djwbaoaeb02C4LQCTNNloOYIU2M,3699
86
- ring/utils/utils.py,sha256=tJaWXLGOTwkxJQj2l23dX97wO3aZYhM2qd7eNuMRs84,6907
86
+ ring/utils/utils.py,sha256=gKwOXLxWraeZfX6EbBcg3hkq30DcXN0mcRUeOSTNiMo,7336
87
87
  ring/utils/register_gym_envs/__init__.py,sha256=PtPIRBQJ16339xZ9G9VpvqrvcGbQ_Pk_SUz4tQPa9nQ,94
88
88
  ring/utils/register_gym_envs/saddle.py,sha256=tA5CyW_akSXyDm0xJ83CtOrUMVElH0f9vZtEDDJQalI,4422
89
- imt_ring-1.6.36.dist-info/METADATA,sha256=a-uW_s0jWJEBX9kW1q36Br4SNXPK7eGIVhlsyKDWruE,4251
90
- imt_ring-1.6.36.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
91
- imt_ring-1.6.36.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
92
- imt_ring-1.6.36.dist-info/RECORD,,
89
+ imt_ring-1.6.37.dist-info/METADATA,sha256=NN6c8jI6u0PjCtw3ZXs9Ktk6ODPI9igC-qyS1aUIUsI,4251
90
+ imt_ring-1.6.37.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
91
+ imt_ring-1.6.37.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
92
+ imt_ring-1.6.37.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
ring/utils/utils.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from importlib import import_module as _import_module
2
2
  import io
3
+ from pathlib import Path
3
4
  import pickle
4
5
  import random
5
6
  from typing import Optional
@@ -152,13 +153,28 @@ def import_lib(
152
153
 
153
154
  def pickle_save(obj, path, overwrite: bool = False):
154
155
  path = parse_path(path, extension="pickle", file_exists_ok=overwrite)
155
- with open(path, "wb") as file:
156
- pickle.dump(obj, file, protocol=5)
156
+ try:
157
+ with open(path, "wb") as file:
158
+ pickle.dump(obj, file, protocol=5)
159
+ except OSError as e:
160
+ print(
161
+ f"saving with `pickle` throws exception {e}. "
162
+ + "Attempting to save using `joblib`"
163
+ )
164
+ path = parse_path(path, extension="joblib", file_exists_ok=overwrite)
165
+ import joblib
166
+
167
+ joblib.dump(obj, path)
157
168
 
158
169
 
159
170
  def pickle_load(
160
171
  path,
161
172
  ):
173
+ if Path(path).suffix == ".joblib":
174
+ import joblib
175
+
176
+ return joblib.load(path)
177
+
162
178
  path = parse_path(path, extension="pickle", require_is_file=True)
163
179
  with open(path, "rb") as file:
164
180
  obj = pickle.load(file)