supervisely 6.73.415__py3-none-any.whl → 6.73.417__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.
@@ -0,0 +1,3 @@
1
+ .wide-transfer .el-transfer-panel {
2
+ width: var(--panel-width, 150px);
3
+ }
@@ -1,4 +1,6 @@
1
- <div>
1
+ <link rel="stylesheet" href="./sly/css/app/widgets/transfer/style.css" />
2
+
3
+ <div class="wide-transfer" style="--panel-width: {{{widget._width}}}px;">
2
4
  <el-transfer
3
5
  {% if widget._filterable is true %}
4
6
  filterable
@@ -41,7 +41,9 @@ class Transfer(Widget):
41
41
  :param right_checked: A list of keys of the items in the right (target) list, which should be checked at widget
42
42
  initialization. Defaults to None.
43
43
  :type right_checked: List[str], optional
44
-
44
+ :param width: The width of the widget in pixels. The default and minimum width is 150 pixels.
45
+ :type width: int, optional
46
+
45
47
  :Methods:
46
48
  get_transferred_items(): returns the list of keys of the items, which are currently displayed in the
47
49
  right (target) list.
@@ -88,7 +90,7 @@ class Transfer(Widget):
88
90
  """
89
91
  class Routes:
90
92
  VALUE_CHANGED = "value_changed"
91
-
93
+
92
94
  class Item:
93
95
  """
94
96
  Class for representing items in the Transfer widget.
@@ -123,45 +125,49 @@ class Transfer(Widget):
123
125
  else:
124
126
  self.label = label
125
127
  self.disabled = disabled
126
-
128
+
127
129
  def to_json(self):
128
130
  return {"key": self.key, "label": self.label, "disabled": self.disabled}
129
-
130
- def __init__(self,
131
- items: Optional[Union[List[Item], List[str]]] = None,
132
- transferred_items: Optional[List[str]] = None,
133
- widget_id: Optional[str] = None,
134
- filterable: Optional[bool] = False,
135
- filter_placeholder: Optional[str] = None,
136
- titles: Optional[List[str]] = None,
137
- button_texts: Optional[List[str]] = None,
138
- left_checked: Optional[List[str]] = None,
139
- right_checked: Optional[List[str]] = None):
140
-
131
+
132
+ def __init__(
133
+ self,
134
+ items: Optional[Union[List[Item], List[str]]] = None,
135
+ transferred_items: Optional[List[str]] = None,
136
+ widget_id: Optional[str] = None,
137
+ filterable: Optional[bool] = False,
138
+ filter_placeholder: Optional[str] = None,
139
+ titles: Optional[List[str]] = None,
140
+ button_texts: Optional[List[str]] = None,
141
+ left_checked: Optional[List[str]] = None,
142
+ right_checked: Optional[List[str]] = None,
143
+ width: int = 150,
144
+ ):
145
+
141
146
  self._changes_handled = False
142
147
  self._items = []
143
148
  self._transferred_items = []
144
-
149
+
145
150
  if items:
146
151
  self._items = self.__checked_items(items)
147
-
152
+
148
153
  if transferred_items:
149
154
  self._transferred_items = self.__checked_transferred_items(transferred_items)
150
-
155
+
151
156
  # If wrong items are specified, items won't be checked.
152
157
  self._left_checked = left_checked
153
158
  self._right_checked = right_checked
154
-
159
+
155
160
  self._filterable = filterable
156
161
  self._filter_placeholder = filter_placeholder
157
-
162
+
163
+ self._width = max(width, 150)
164
+
158
165
  self._titles = titles if titles is not None else ["Source", "Target"]
159
-
166
+
160
167
  self._button_texts = button_texts
161
-
168
+
162
169
  super().__init__(widget_id=widget_id, file_path=__file__)
163
-
164
-
170
+
165
171
  def __checked_items(self, items: Optional[Union[List[Item], List[str]]]) -> List[Transfer.Item]:
166
172
  """
167
173
  If the list of items is specified as a list of strings, they will be converted to Transfer.Item objects. List of
@@ -183,17 +189,17 @@ class Transfer(Widget):
183
189
  if len(set(items)) != len(items):
184
190
  # If the keys of the items are not unique, an error will be raised.
185
191
  raise ValueError("The keys of the items should be unique.")
186
-
192
+
187
193
  checked_items = [Transfer.Item(key=item) for item in items]
188
194
  else:
189
195
  # If items are specified as Transfer.Item objects, they will be checked for uniqueness.
190
196
  if len({item.key for item in items}) != len(items):
191
197
  # If the keys of the items are not unique, an error will be raised.
192
198
  raise ValueError("The keys of the items should be unique.")
193
-
199
+
194
200
  checked_items = items
195
201
  return checked_items
196
-
202
+
197
203
  def __checked_transferred_items(self, transferred_items: List[str]) -> List[str]:
198
204
  """
199
205
  If the self._items is specified, the list of transferred items will be checked for the keys of the items. Since
@@ -223,7 +229,7 @@ class Transfer(Widget):
223
229
  "the keys of the items specified in the 'items' argument.")
224
230
  else:
225
231
  return transferred_items
226
-
232
+
227
233
  def get_json_data(self) -> Dict[str, Union[List[Dict[str, Union[str, bool]]], None]]:
228
234
  """
229
235
  Returns the data of the widget in JSON format.
@@ -243,7 +249,7 @@ class Transfer(Widget):
243
249
  res["items"] = [item.to_json() for item in self._items]
244
250
 
245
251
  return res
246
-
252
+
247
253
  def get_json_state(self) -> Dict[str, List[str]]:
248
254
  """
249
255
  Returns the state of the widget in JSON format.
@@ -256,9 +262,9 @@ class Transfer(Widget):
256
262
  """
257
263
 
258
264
  transferred_items = self._transferred_items
259
-
265
+
260
266
  return {"transferred_items": transferred_items}
261
-
267
+
262
268
  def get_transferred_items(self) -> List[str]:
263
269
  """
264
270
  Returns the list of transferred items.
@@ -268,8 +274,7 @@ class Transfer(Widget):
268
274
  """
269
275
 
270
276
  return StateJson()[self.widget_id]["transferred_items"]
271
-
272
-
277
+
273
278
  def get_untransferred_items(self) -> List[str]:
274
279
  """
275
280
  Returns the list of untransferred items.
@@ -279,8 +284,7 @@ class Transfer(Widget):
279
284
  """
280
285
 
281
286
  return [item.key for item in self._items if item.key not in self.get_transferred_items()]
282
-
283
-
287
+
284
288
  def value_changed(self, func: Callable) -> Callable:
285
289
  """
286
290
  Decorates a function which will be called when the the items in right list are changed (moved in or out of the list).
@@ -305,22 +309,21 @@ class Transfer(Widget):
305
309
  print(items.untransferred_items) # ["item3"]
306
310
  """
307
311
 
308
-
309
312
  route_path = self.get_route_path(Transfer.Routes.VALUE_CHANGED)
310
313
  server = self._sly_app.get_server()
311
314
  self._changes_handled = True
312
315
 
313
316
  @server.post(route_path)
314
317
  def _click():
315
-
318
+
316
319
  Items = namedtuple("Items", ["transferred_items", "untransferred_items"])
317
-
320
+
318
321
  res = Items(transferred_items=self.get_transferred_items(), untransferred_items=self.get_untransferred_items())
319
-
322
+
320
323
  func(res)
321
324
 
322
325
  return _click
323
-
326
+
324
327
  def set_items(self, items: Union[List[Transfer.Item], List[str]]):
325
328
  """
326
329
  Sets the list of items for the widget.
@@ -345,7 +348,7 @@ class Transfer(Widget):
345
348
 
346
349
  # As you can see, the list of items was replaced with the new one.
347
350
  """
348
-
351
+
349
352
  if items:
350
353
  self._items = self.__checked_items(items)
351
354
  else:
@@ -365,7 +368,7 @@ class Transfer(Widget):
365
368
  self._transferred_items = self.__checked_transferred_items(transferred_items)
366
369
  self.update_state()
367
370
  StateJson().send_changes()
368
-
371
+
369
372
  def add(self, items: Union[List[Item], List[str]]):
370
373
  """
371
374
  Adds new items to the current list of items.
@@ -391,14 +394,14 @@ class Transfer(Widget):
391
394
  """
392
395
 
393
396
  items = self.__checked_items(items)
394
-
397
+
395
398
  if any([item.key in [item.key for item in self._items] for item in items]):
396
399
  raise ValueError("The 'items' argument should not contain any items with the same key as the items in the current list.")
397
400
  else:
398
401
  self._items.extend(items)
399
402
  self.update_data()
400
403
  DataJson().send_changes()
401
-
404
+
402
405
  def remove(self, items_keys: List[str]):
403
406
  """
404
407
  Removes items from the current list of items.
@@ -416,7 +419,7 @@ class Transfer(Widget):
416
419
  self.update_state()
417
420
  DataJson().send_changes()
418
421
  StateJson().send_changes()
419
-
422
+
420
423
  def get_items_keys(self) -> List[str]:
421
424
  """
422
425
  Returns the list of keys of the items.
@@ -2,6 +2,7 @@
2
2
  """load and inference models"""
3
3
 
4
4
  from __future__ import annotations
5
+
5
6
  import os
6
7
  from os import PathLike
7
8
  from typing import List, Union
@@ -11,6 +12,7 @@ import requests
11
12
 
12
13
  import supervisely.io.env as sly_env
13
14
  import supervisely.io.json as sly_json
15
+ from supervisely.api.api import Api
14
16
  from supervisely.api.module_api import ApiField
15
17
  from supervisely.api.task_api import TaskApi
16
18
  from supervisely.nn.experiments import ExperimentInfo
@@ -18,7 +20,6 @@ from supervisely.nn.model.prediction import Prediction
18
20
  from supervisely.nn.model.prediction_session import PredictionSession
19
21
  from supervisely.nn.utils import ModelSource
20
22
  from supervisely.project.project_meta import ProjectMeta
21
- from supervisely.api.api import Api
22
23
 
23
24
 
24
25
  class ModelAPI:
@@ -126,7 +127,8 @@ class ModelAPI:
126
127
  device: str = None,
127
128
  runtime: str = None,
128
129
  ):
129
- if self.url is not None:
130
+ if self.task_id is None:
131
+ # TODO: proper check
130
132
  if os.path.exists(model):
131
133
  self._load_local_custom_model(model, device, runtime)
132
134
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.415
3
+ Version: 6.73.417
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -537,8 +537,9 @@ supervisely/app/widgets/train_val_splits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
537
537
  supervisely/app/widgets/train_val_splits/template.html,sha256=_uvKCMP0nkpSl3FiTUxqy10JZw3q8-9hXCv22W3BDF0,38
538
538
  supervisely/app/widgets/train_val_splits/train_val_splits.py,sha256=KN7sW_IWs8UJO8JeLS_bS6L7NU1Qrqc7_fLBa6cettg,20493
539
539
  supervisely/app/widgets/transfer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
540
- supervisely/app/widgets/transfer/template.html,sha256=w9T5TrityCeHUBPPyzRBBSm48zeuGPxh5HwAZsS0buM,851
541
- supervisely/app/widgets/transfer/transfer.py,sha256=tZ6HhRH11xOrEhz3TAH0Redw3NE2GFSDHuHCmKBSY_s,19986
540
+ supervisely/app/widgets/transfer/style.css,sha256=lPIeJMc4lqkLtPwRuAcxGok6L5sYIVoN77AId9LO2h0,73
541
+ supervisely/app/widgets/transfer/template.html,sha256=R9lKq4xsQhyAT0GOdZV7T7Myc3C999apSMBVacf4pzI,994
542
+ supervisely/app/widgets/transfer/transfer.py,sha256=y8Rg9AH7sNd342tSJwVmTO9Rwi5F5fTmxEMOa353bJo,19847
542
543
  supervisely/app/widgets/tree_select/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
543
544
  supervisely/app/widgets/tree_select/template.html,sha256=eUHN0yn_llRRozAOvdc8SjhY-KX12TcgOUXCemHWGew,613
544
545
  supervisely/app/widgets/tree_select/tree_select.py,sha256=A86TCS_gXHi6UvHmsvZUyijnKgTvQ6UGnrHPJ19U_IY,14499
@@ -969,7 +970,7 @@ supervisely/nn/legacy/pytorch/weights.py,sha256=Zb9kcpUCg6ykr7seO53CkKSQa2K44wo8
969
970
  supervisely/nn/legacy/training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
970
971
  supervisely/nn/legacy/training/eval_planner.py,sha256=zN9b0_CX7sWGdC8e6riTvD-NOUc3_Xduyhj00S7PEIo,1311
971
972
  supervisely/nn/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
972
- supervisely/nn/model/model_api.py,sha256=rq-08BrQmWKqUxWnBB5yKBfnjxw8Lg88mhva848Ae2I,9911
973
+ supervisely/nn/model/model_api.py,sha256=jR1vCVHj70xbuYyYrpcBhUZYdnw8w5DsP_ZcQlo24qE,9945
973
974
  supervisely/nn/model/prediction.py,sha256=N3oO9s3NDiC5CFvW8utfU8rz3bfpCl37Sk4VEBH94Bc,11307
974
975
  supervisely/nn/model/prediction_session.py,sha256=sy0FSQaWSmT8i0RkR4J8oIn3Ek4IDVJNBR1Tg4mulkM,25523
975
976
  supervisely/nn/tracker/__init__.py,sha256=LiojByb5kGsTQ49lWuboEh7B4JUwM1vfz81J8kJlLYo,337
@@ -1115,9 +1116,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1115
1116
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1116
1117
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1117
1118
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1118
- supervisely-6.73.415.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1119
- supervisely-6.73.415.dist-info/METADATA,sha256=xVB8_oba-x_gqhVFESXvrcyA2vcgOvW0qCaaPPu42wQ,35254
1120
- supervisely-6.73.415.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1121
- supervisely-6.73.415.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1122
- supervisely-6.73.415.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1123
- supervisely-6.73.415.dist-info/RECORD,,
1119
+ supervisely-6.73.417.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1120
+ supervisely-6.73.417.dist-info/METADATA,sha256=aaq2Z7iTkRFy2PpXSCPFEbOpeaFwVBkFuh4sSy_8Awg,35254
1121
+ supervisely-6.73.417.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1122
+ supervisely-6.73.417.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1123
+ supervisely-6.73.417.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1124
+ supervisely-6.73.417.dist-info/RECORD,,