code-loader 1.0.102__py3-none-any.whl → 1.0.102.dev1__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 code-loader might be problematic. Click here for more details.
- code_loader/helpers/plot_functions.py +22 -4
- code_loader/inner_leap_binder/leapbinder.py +1 -0
- code_loader/inner_leap_binder/leapbinder_decorators.py +28 -0
- {code_loader-1.0.102.dist-info → code_loader-1.0.102.dev1.dist-info}/METADATA +1 -1
- {code_loader-1.0.102.dist-info → code_loader-1.0.102.dev1.dist-info}/RECORD +7 -7
- {code_loader-1.0.102.dist-info → code_loader-1.0.102.dev1.dist-info}/LICENSE +0 -0
- {code_loader-1.0.102.dist-info → code_loader-1.0.102.dev1.dist-info}/WHEEL +0 -0
|
@@ -20,7 +20,21 @@ import math
|
|
|
20
20
|
from code_loader.contract.visualizer_classes import LeapImage, LeapImageWithBBox, LeapGraph, LeapText, \
|
|
21
21
|
LeapHorizontalBar, LeapImageMask, LeapTextMask, LeapImageWithHeatmap
|
|
22
22
|
|
|
23
|
+
def run_only_on_non_mapping_mode():
|
|
24
|
+
"""
|
|
25
|
+
Decorator to ensure that the function is only run when not in mapping mode.
|
|
26
|
+
"""
|
|
27
|
+
def decorator(func):
|
|
28
|
+
def wrapper(*args, **kwargs):
|
|
29
|
+
if os.environ.get(mapping_runtime_mode_env_var_mame):
|
|
30
|
+
print(f"Skipping {func.__name__} in mapping mode.")
|
|
31
|
+
return
|
|
32
|
+
return func(*args, **kwargs)
|
|
33
|
+
return wrapper
|
|
34
|
+
return decorator
|
|
23
35
|
|
|
36
|
+
|
|
37
|
+
@run_only_on_non_mapping_mode()
|
|
24
38
|
def plot_image_with_b_box(leap_data: LeapImageWithBBox, title: str) -> None:
|
|
25
39
|
"""
|
|
26
40
|
Plot an image with overlaid bounding boxes.
|
|
@@ -78,6 +92,7 @@ def plot_image_with_b_box(leap_data: LeapImageWithBBox, title: str) -> None:
|
|
|
78
92
|
plt.show()
|
|
79
93
|
|
|
80
94
|
|
|
95
|
+
@run_only_on_non_mapping_mode()
|
|
81
96
|
def plot_image(leap_data: LeapImage, title: str) -> None:
|
|
82
97
|
"""
|
|
83
98
|
Display the image contained in the LeapImage object.
|
|
@@ -108,6 +123,7 @@ def plot_image(leap_data: LeapImage, title: str) -> None:
|
|
|
108
123
|
plt.show()
|
|
109
124
|
|
|
110
125
|
|
|
126
|
+
@run_only_on_non_mapping_mode()
|
|
111
127
|
def plot_graph(leap_data: LeapGraph, title: str) -> None:
|
|
112
128
|
"""
|
|
113
129
|
Display the line chart contained in the LeapGraph object.
|
|
@@ -145,6 +161,7 @@ def plot_graph(leap_data: LeapGraph, title: str) -> None:
|
|
|
145
161
|
plt.show()
|
|
146
162
|
|
|
147
163
|
|
|
164
|
+
@run_only_on_non_mapping_mode()
|
|
148
165
|
def plot_text_with_heatmap(leap_data: LeapText, title: str) -> None:
|
|
149
166
|
"""
|
|
150
167
|
Display the text contained in the LeapText object with a heatmap overlay.
|
|
@@ -213,7 +230,7 @@ def plot_text_with_heatmap(leap_data: LeapText, title: str) -> None:
|
|
|
213
230
|
plt.tight_layout()
|
|
214
231
|
plt.show()
|
|
215
232
|
|
|
216
|
-
|
|
233
|
+
@run_only_on_non_mapping_mode()
|
|
217
234
|
def plot_hbar(leap_data: LeapHorizontalBar, title: str) -> None:
|
|
218
235
|
"""
|
|
219
236
|
Display the horizontal bar chart contained in the LeapHorizontalBar object.
|
|
@@ -269,7 +286,7 @@ def plot_hbar(leap_data: LeapHorizontalBar, title: str) -> None:
|
|
|
269
286
|
|
|
270
287
|
plt.show()
|
|
271
288
|
|
|
272
|
-
|
|
289
|
+
@run_only_on_non_mapping_mode()
|
|
273
290
|
def plot_image_mask(leap_data: LeapImageMask, title: str) -> None:
|
|
274
291
|
"""
|
|
275
292
|
Plots an image with overlaid masks given a LeapImageMask visualizer object.
|
|
@@ -318,7 +335,7 @@ def plot_image_mask(leap_data: LeapImageMask, title: str) -> None:
|
|
|
318
335
|
plt.axis('off') # Hide the axis
|
|
319
336
|
plt.show()
|
|
320
337
|
|
|
321
|
-
|
|
338
|
+
@run_only_on_non_mapping_mode()
|
|
322
339
|
def plot_text_mask(leap_data: LeapTextMask, title: str) -> None:
|
|
323
340
|
"""
|
|
324
341
|
Plots text with overlaid masks given a LeapTextMask visualizer object.
|
|
@@ -370,7 +387,7 @@ def plot_text_mask(leap_data: LeapTextMask, title: str) -> None:
|
|
|
370
387
|
|
|
371
388
|
plt.show()
|
|
372
389
|
|
|
373
|
-
|
|
390
|
+
@run_only_on_non_mapping_mode()
|
|
374
391
|
def plot_image_with_heatmap(leap_data: LeapImageWithHeatmap, title: str) -> None:
|
|
375
392
|
"""
|
|
376
393
|
Display the image with overlaid heatmaps contained in the LeapImageWithHeatmap object.
|
|
@@ -413,6 +430,7 @@ def plot_image_with_heatmap(leap_data: LeapImageWithHeatmap, title: str) -> None
|
|
|
413
430
|
plt.show()
|
|
414
431
|
|
|
415
432
|
|
|
433
|
+
|
|
416
434
|
plot_switch = {
|
|
417
435
|
LeapDataType.Image: plot_image,
|
|
418
436
|
LeapDataType.Text: plot_text_with_heatmap,
|
|
@@ -35,6 +35,34 @@ def _add_mapping_connections(connects_to, arg_names, node_mapping_type, name):
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
def integration_test():
|
|
39
|
+
def decorating_function(integration_test_function: Callable):
|
|
40
|
+
leap_binder.integration_test_func = integration_test_function
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def inner(*args, **kwargs):
|
|
44
|
+
ret = integration_test_function(*args, **kwargs)
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
os.environ[mapping_runtime_mode_env_var_mame] = 'True'
|
|
48
|
+
integration_test_function(None, None)
|
|
49
|
+
except Exception as e:
|
|
50
|
+
print(f'Error during integration test: Make sure to disable any non tensorleap decorators '
|
|
51
|
+
f'functions before pushing a new TL version')
|
|
52
|
+
finally:
|
|
53
|
+
if mapping_runtime_mode_env_var_mame in os.environ:
|
|
54
|
+
del os.environ[mapping_runtime_mode_env_var_mame]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
return inner
|
|
58
|
+
|
|
59
|
+
return decorating_function
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
38
66
|
|
|
39
67
|
def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]] = None):
|
|
40
68
|
for i, prediction_type in enumerate(prediction_types):
|
|
@@ -20,17 +20,17 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
|
|
|
20
20
|
code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
|
|
21
21
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
22
22
|
code_loader/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
code_loader/helpers/plot_functions.py,sha256=
|
|
23
|
+
code_loader/helpers/plot_functions.py,sha256=91wHSewc_y75hdCL-4ghrsGpg0u-IlK_7aoxbu6-jd0,14602
|
|
24
24
|
code_loader/helpers/visualize.py,sha256=RusWyJax9qSkz2JItMb_IxOLskUvfGSWajTJHY4hCuE,565
|
|
25
25
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
26
|
-
code_loader/inner_leap_binder/leapbinder.py,sha256=
|
|
27
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
26
|
+
code_loader/inner_leap_binder/leapbinder.py,sha256=tiWrRBZCuQDeWOP0GGRUvzFHRFKG0uX0mWADdiSP-ho,32570
|
|
27
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=0-Itrq_rBzx4InpmcfkSmUX6lOmrzlqGKxtkAMD8H5I,39356
|
|
28
28
|
code_loader/leaploader.py,sha256=vfN92-uoLeo8pojhwzPh4iu3gaoIQNqQklYwOy0kbtM,29225
|
|
29
29
|
code_loader/leaploaderbase.py,sha256=lKdw2pd6H9hFsxVmc7jJMoZd_vlG5He1ooqT-cR_yq8,4496
|
|
30
30
|
code_loader/utils.py,sha256=_j8b60pimoNAvWMRj7hEkkT6C76qES6cZoBFHpXHMxA,2698
|
|
31
31
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
|
|
33
|
-
code_loader-1.0.102.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
34
|
-
code_loader-1.0.102.dist-info/METADATA,sha256=
|
|
35
|
-
code_loader-1.0.102.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
-
code_loader-1.0.102.dist-info/RECORD,,
|
|
33
|
+
code_loader-1.0.102.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
34
|
+
code_loader-1.0.102.dev1.dist-info/METADATA,sha256=QFOrHLfO7eTASzOF-Cyvu9Nf-pI5Rur-w27OlxES3lc,855
|
|
35
|
+
code_loader-1.0.102.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
code_loader-1.0.102.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|