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

@@ -2,6 +2,7 @@
2
2
  import os
3
3
  from collections import defaultdict
4
4
  from functools import lru_cache
5
+ from pathlib import Path
5
6
  from typing import Optional, Union, Callable, List, Dict
6
7
 
7
8
  import numpy as np
@@ -12,7 +13,7 @@ from code_loader.contract.datasetclasses import CustomCallableInterfaceMultiArgs
12
13
  VisualizerCallableInterface, MetadataSectionCallableInterface, PreprocessResponse, SectionCallableInterface, \
13
14
  ConfusionMatrixElement, SamplePreprocessResponse, PredictionTypeHandler, InstanceCallableInterface, ElementInstance, \
14
15
  InstanceLengthCallableInterface
15
- from code_loader.contract.enums import MetricDirection, LeapDataType, DatasetMetadataType
16
+ from code_loader.contract.enums import MetricDirection, LeapDataType, DatasetMetadataType, DataStateType
16
17
  from code_loader import leap_binder
17
18
  from code_loader.contract.mapping import NodeMapping, NodeMappingType, NodeConnection
18
19
  from code_loader.contract.visualizer_classes import LeapImage, LeapImageMask, LeapTextMask, LeapText, LeapGraph, \
@@ -44,7 +45,7 @@ def _add_mapping_connections(connects_to, arg_names, node_mapping_type, name):
44
45
  _add_mapping_connection(user_unique_name, connection_destinations, arg_names, name, node_mapping_type)
45
46
 
46
47
 
47
- def integration_test():
48
+ def tensorleap_integration_test():
48
49
  def decorating_function(integration_test_function: Callable):
49
50
  leap_binder.integration_test_func = integration_test_function
50
51
 
@@ -56,10 +57,19 @@ def integration_test():
56
57
 
57
58
  try:
58
59
  os.environ[mapping_runtime_mode_env_var_mame] = 'True'
59
- integration_test_function(None, None)
60
+ integration_test_function(None, PreprocessResponse(state=DataStateType.training, length=0))
60
61
  except Exception as e:
61
- print(f'Error during integration test: Make sure to disable any non tensorleap decorators '
62
- f'functions before pushing a new TL version')
62
+ import traceback
63
+ first_tb = traceback.extract_tb(e.__traceback__)[-1]
64
+ file_name = Path(first_tb.filename).name
65
+ line_number = first_tb.lineno
66
+ if isinstance(e, TypeError) and 'is not subscriptable' in str(e):
67
+ print(f'Invalid integration code. File {file_name}, line {line_number}: '
68
+ f'Please remove this indexing operation usage from the integration test code.')
69
+ else:
70
+ print(f'Invalid integration code. File {file_name}, line {line_number}: '
71
+ f'Integration test is only allowed to call Tensorleap decorators. '
72
+ f'Ensure any arithmetics, external library use, Python logic is placed within Tensorleap decoders')
63
73
  finally:
64
74
  if mapping_runtime_mode_env_var_mame in os.environ:
65
75
  del os.environ[mapping_runtime_mode_env_var_mame]
@@ -78,7 +88,7 @@ def _safe_get_item(key):
78
88
  except ValueError:
79
89
  raise Exception(f'Tensorleap currently supports models with no more then 10 inputs')
80
90
 
81
- def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]] = None):
91
+ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]] = []):
82
92
  for i, prediction_type in enumerate(prediction_types):
83
93
  leap_binder.add_prediction(prediction_type.name, prediction_type.labels, prediction_type.channel_dim, i)
84
94
 
code_loader/leaploader.py CHANGED
@@ -51,7 +51,7 @@ class LeapLoader(LeapLoaderBase):
51
51
  os.environ[mapping_runtime_mode_env_var_mame] = 'TRUE'
52
52
  self.evaluate_module()
53
53
  if global_leap_binder.integration_test_func is not None:
54
- global_leap_binder.integration_test_func(None, None)
54
+ global_leap_binder.integration_test_func(None, PreprocessResponse(state=DataStateType.training, length=0))
55
55
  except TypeError as e:
56
56
  import traceback
57
57
  if "leap_binder.set_metadata(" in traceback.format_exc(5):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.136
3
+ Version: 1.0.137
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,8 +21,8 @@ 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=EptQhu4dPVXmAfUnv_Whzmess0ueRYy5RLpm7WYe6Ho,50981
25
- code_loader/leaploader.py,sha256=85XUWd7Y8kup76xeqefgd8db7pGaeHMhE7QlmYlNFMw,29747
24
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=7lykS1VoaO58HIf_ysegvFxYDVI8x3AYMMa_ODz2fXA,51767
25
+ code_loader/leaploader.py,sha256=PC7d36_v_7RWO67uOVffsmAllT-KXCJAqpMYM5GjHoU,29801
26
26
  code_loader/leaploaderbase.py,sha256=LIFcC6xo6V_iiGN3BjibXETu_l84EWM_WIOKAvkfTiM,4458
27
27
  code_loader/mixpanel_tracker.py,sha256=l9z_szKKQ7apEbdNZpGH1TKAiT_TsBHb9AQnePaWTyo,4942
28
28
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -31,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
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.136.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
- code_loader-1.0.136.dist-info/METADATA,sha256=pNpIswJBMtQtorkL80niuBszYQ38F9repsK8WOCHRJ8,1090
36
- code_loader-1.0.136.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- code_loader-1.0.136.dist-info/RECORD,,
34
+ code_loader-1.0.137.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
35
+ code_loader-1.0.137.dist-info/METADATA,sha256=NSUMwxhMsdTdfuD5zuztuUa8ZcBzlOhdPhhd0CuMjJw,1090
36
+ code_loader-1.0.137.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ code_loader-1.0.137.dist-info/RECORD,,