code-loader 1.0.127__py3-none-any.whl → 1.0.128__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.

@@ -1,5 +1,6 @@
1
1
  # mypy: ignore-errors
2
2
  import os
3
+ from functools import lru_cache
3
4
  from typing import Optional, Union, Callable, List, Dict
4
5
 
5
6
  import numpy as np
@@ -21,6 +22,7 @@ import inspect
21
22
  import functools
22
23
 
23
24
  _called_from_inside_tl_decorator = 0
25
+ _called_from_inside_tl_integration_test_decorator = False
24
26
 
25
27
 
26
28
  def _add_mapping_connection(user_unique_name, connection_destinations, arg_names, name, node_mapping_type):
@@ -46,17 +48,22 @@ def integration_test():
46
48
  leap_binder.integration_test_func = integration_test_function
47
49
 
48
50
  def inner(*args, **kwargs):
49
- ret = integration_test_function(*args, **kwargs)
50
-
51
+ global _called_from_inside_tl_integration_test_decorator
51
52
  try:
52
- os.environ[mapping_runtime_mode_env_var_mame] = 'True'
53
- integration_test_function(None, None)
54
- except Exception as e:
55
- print(f'Error during integration test: Make sure to disable any non tensorleap decorators '
56
- f'functions before pushing a new TL version')
53
+ _called_from_inside_tl_integration_test_decorator = True
54
+ ret = integration_test_function(*args, **kwargs)
55
+
56
+ try:
57
+ os.environ[mapping_runtime_mode_env_var_mame] = 'True'
58
+ integration_test_function(None, None)
59
+ except Exception as e:
60
+ print(f'Error during integration test: Make sure to disable any non tensorleap decorators '
61
+ f'functions before pushing a new TL version')
62
+ finally:
63
+ if mapping_runtime_mode_env_var_mame in os.environ:
64
+ del os.environ[mapping_runtime_mode_env_var_mame]
57
65
  finally:
58
- if mapping_runtime_mode_env_var_mame in os.environ:
59
- del os.environ[mapping_runtime_mode_env_var_mame]
66
+ _called_from_inside_tl_integration_test_decorator = False
60
67
 
61
68
  return inner
62
69
 
@@ -71,6 +78,7 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
71
78
  class TempMapping:
72
79
  pass
73
80
 
81
+ @lru_cache()
74
82
  def inner():
75
83
  class ModelPlaceholder:
76
84
  def __init__(self):
@@ -762,7 +770,7 @@ def tensorleap_input_encoder(name: str, channel_dim=-1, model_input_index=None):
762
770
 
763
771
  _validate_result(result)
764
772
 
765
- if _called_from_inside_tl_decorator == 0:
773
+ if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
766
774
  result = np.expand_dims(result, axis=0)
767
775
 
768
776
  return result
@@ -846,7 +854,7 @@ def tensorleap_gt_encoder(name: str):
846
854
 
847
855
  _validate_result(result)
848
856
 
849
- if _called_from_inside_tl_decorator == 0:
857
+ if _called_from_inside_tl_decorator == 0 and _called_from_inside_tl_integration_test_decorator:
850
858
  result = np.expand_dims(result, axis=0)
851
859
 
852
860
  return result
@@ -29,7 +29,6 @@ def run_only_on_non_mapping_mode():
29
29
  def decorator(func):
30
30
  def wrapper(*args, **kwargs):
31
31
  if os.environ.get(mapping_runtime_mode_env_var_mame):
32
- print(f"Skipping {func.__name__} in mapping mode.")
33
32
  return
34
33
  return func(*args, **kwargs)
35
34
  return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.127
3
+ Version: 1.0.128
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,17 +21,17 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
21
21
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
22
22
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
23
23
  code_loader/inner_leap_binder/leapbinder.py,sha256=Q3D9yVM-GNEJfYRFvMV__BoZbcWOgnWKhrZXAv6Tu7o,33232
24
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=39Qv4VZBQ-TP1ToOo_cVcecz5s9Qx3bwj8Y8As9Z3Mw,45723
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=iECkcrKHobZV-zr3-2-R7NI9_RjqsWOrA8ZoaJy6f2M,46236
25
25
  code_loader/leaploader.py,sha256=85XUWd7Y8kup76xeqefgd8db7pGaeHMhE7QlmYlNFMw,29747
26
26
  code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
27
27
  code_loader/mixpanel_tracker.py,sha256=mJaJvs8Pc5w3FEmSSObFIMVekcs5pKdM3iZmN4wVFqA,4822
28
28
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- code_loader/plot_functions/plot_functions.py,sha256=xg6Gi4myTN9crq6JtyrhYI38HLXjPVJcbnI7CIy8f7w,14625
29
+ code_loader/plot_functions/plot_functions.py,sha256=VyVWxd7R3lALIo2z8oZlYybbN0Ip6G0OiKNTNZ77xHk,14557
30
30
  code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6LznoQIvi4vpo,657
31
31
  code_loader/utils.py,sha256=gXENTYpjdidq2dx0gVbXlErPeHoNs-4TYAZbLRe0y2c,2712
32
32
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
34
- code_loader-1.0.127.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.127.dist-info/METADATA,sha256=46ovS_hZgYd16lbtaN3NJO5s8pTQ2EpRJLm5Mmjsr60,1090
36
- code_loader-1.0.127.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.127.dist-info/RECORD,,
34
+ code_loader-1.0.128.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.128.dist-info/METADATA,sha256=RtPqk2uSCdDPHE9ohK28I7wU2ceGRp-08xUGCtd45Hc,1090
36
+ code_loader-1.0.128.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.128.dist-info/RECORD,,