sapiopycommons 2025.6.11a561__py3-none-any.whl → 2025.6.18a563__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 sapiopycommons might be problematic. Click here for more details.

Files changed (54) hide show
  1. sapiopycommons/ai/__init__.py +0 -0
  2. sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.py +43 -0
  3. sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2.pyi +31 -0
  4. sapiopycommons/ai/api/fielddefinitions/proto/fields_pb2_grpc.py +24 -0
  5. sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.py +123 -0
  6. sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2.pyi +598 -0
  7. sapiopycommons/ai/api/fielddefinitions/proto/velox_field_def_pb2_grpc.py +24 -0
  8. sapiopycommons/ai/api/plan/proto/step_output_pb2.py +45 -0
  9. sapiopycommons/ai/api/plan/proto/step_output_pb2.pyi +42 -0
  10. sapiopycommons/ai/api/plan/proto/step_output_pb2_grpc.py +24 -0
  11. sapiopycommons/ai/api/plan/proto/step_pb2.py +43 -0
  12. sapiopycommons/ai/api/plan/proto/step_pb2.pyi +43 -0
  13. sapiopycommons/ai/api/plan/proto/step_pb2_grpc.py +24 -0
  14. sapiopycommons/ai/api/plan/script/proto/script_pb2.py +53 -0
  15. sapiopycommons/ai/api/plan/script/proto/script_pb2.pyi +99 -0
  16. sapiopycommons/ai/api/plan/script/proto/script_pb2_grpc.py +153 -0
  17. sapiopycommons/ai/api/plan/tool/proto/entry_pb2.py +57 -0
  18. sapiopycommons/ai/api/plan/tool/proto/entry_pb2.pyi +96 -0
  19. sapiopycommons/ai/api/plan/tool/proto/entry_pb2_grpc.py +24 -0
  20. sapiopycommons/ai/api/plan/tool/proto/tool_pb2.py +67 -0
  21. sapiopycommons/ai/api/plan/tool/proto/tool_pb2.pyi +220 -0
  22. sapiopycommons/ai/api/plan/tool/proto/tool_pb2_grpc.py +154 -0
  23. sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.py +39 -0
  24. sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2.pyi +32 -0
  25. sapiopycommons/ai/api/session/proto/sapio_conn_info_pb2_grpc.py +24 -0
  26. sapiopycommons/ai/protobuf_utils.py +454 -0
  27. sapiopycommons/ai/tool_service_base.py +790 -0
  28. sapiopycommons/callbacks/callback_util.py +64 -116
  29. sapiopycommons/callbacks/field_builder.py +0 -2
  30. sapiopycommons/chem/IndigoMolecules.py +1 -29
  31. sapiopycommons/chem/Molecules.py +3 -3
  32. sapiopycommons/customreport/auto_pagers.py +1 -2
  33. sapiopycommons/customreport/term_builder.py +1 -1
  34. sapiopycommons/datatype/pseudo_data_types.py +326 -349
  35. sapiopycommons/eln/experiment_handler.py +719 -336
  36. sapiopycommons/eln/plate_designer.py +2 -7
  37. sapiopycommons/files/file_util.py +4 -4
  38. sapiopycommons/general/accession_service.py +2 -2
  39. sapiopycommons/general/aliases.py +1 -4
  40. sapiopycommons/processtracking/custom_workflow_handler.py +1 -2
  41. sapiopycommons/recordmodel/record_handler.py +317 -657
  42. sapiopycommons/rules/eln_rule_handler.py +1 -8
  43. sapiopycommons/rules/on_save_rule_handler.py +1 -8
  44. sapiopycommons/webhook/webhook_handlers.py +0 -3
  45. sapiopycommons/webhook/webservice_handlers.py +2 -2
  46. {sapiopycommons-2025.6.11a561.dist-info → sapiopycommons-2025.6.18a563.dist-info}/METADATA +2 -2
  47. sapiopycommons-2025.6.18a563.dist-info/RECORD +91 -0
  48. sapiopycommons/eln/experiment_cache.py +0 -188
  49. sapiopycommons/eln/experiment_step_factory.py +0 -476
  50. sapiopycommons/eln/step_creation.py +0 -236
  51. sapiopycommons/general/data_structure_util.py +0 -115
  52. sapiopycommons-2025.6.11a561.dist-info/RECORD +0 -68
  53. {sapiopycommons-2025.6.11a561.dist-info → sapiopycommons-2025.6.18a563.dist-info}/WHEEL +0 -0
  54. {sapiopycommons-2025.6.11a561.dist-info → sapiopycommons-2025.6.18a563.dist-info}/licenses/LICENSE +0 -0
@@ -167,7 +167,7 @@ class PlateDesignerEntry(ElnEntryStep):
167
167
  self._designer_elements_by_plate = {}
168
168
  self._designer_elements_by_plate.clear()
169
169
  for element in self._designer_elements:
170
- plate_id: int = element.get_field_value(WellElement.PLATE_RECORD_ID__FIELD.field_name)
170
+ plate_id: int = element.get(WellElement.PLATE_RECORD_ID__FIELD)
171
171
  self._designer_elements_by_plate.setdefault(plate_id, []).append(element)
172
172
  return self._designer_elements
173
173
 
@@ -194,8 +194,7 @@ class PlateDesignerEntry(ElnEntryStep):
194
194
  return self._designer_elements_by_plate[plate]
195
195
 
196
196
  def create_well_element(self, sample: RecordModel, plate: RecordModel, location: PlateLocation | None = None,
197
- layer: int = 1, wrapper_type: type[WrappedType] | None = None) \
198
- -> WrappedType | PyRecordModel:
197
+ wrapper_type: type[WrappedType] | None = None) -> WrappedType | PyRecordModel:
199
198
  """
200
199
  Create a new plate designer well element for the input sample and plate. A record model manager store and commit
201
200
  must be called to save this new well element to the server.
@@ -204,7 +203,6 @@ class PlateDesignerEntry(ElnEntryStep):
204
203
  :param plate: The plate that the element is for. Must exist in the system (i.e. have a >0 record ID).
205
204
  :param location: The location of the well element. If not provided, the row and column position fields of the
206
205
  sample will be used.
207
- :param layer: The layer that the well element is on.
208
206
  :param wrapper_type: The record model wrapper to use for the plate designer well element. If not provided, the
209
207
  returned record will be a PyRecordModel instead of a WrappedRecordModel.
210
208
  :return: The newly created PlateDesignerWellElementModel.
@@ -218,8 +216,6 @@ class PlateDesignerEntry(ElnEntryStep):
218
216
  raise SapioException("Sample record must be of type Sample.")
219
217
  if AliasUtil.to_data_type_name(plate) != "Plate":
220
218
  raise SapioException("Plate record must be of type Plate.")
221
- if layer < 1:
222
- raise SapioException("Layer must be greater than 0.")
223
219
 
224
220
  dt: type[WrappedType] | str = wrapper_type if wrapper_type else WellElement.DATA_TYPE_NAME
225
221
  plate_id: int = AliasUtil.to_record_id(plate)
@@ -229,7 +225,6 @@ class PlateDesignerEntry(ElnEntryStep):
229
225
  WellElement.ROW_POSITION__FIELD: location.row_pos if location else sample.get_field_value("RowPosition"),
230
226
  WellElement.COL_POSITION__FIELD: str(location.col_pos) if location else sample.get_field_value("ColPosition"),
231
227
  WellElement.SOURCE_DATA_TYPE_NAME__FIELD: "Sample",
232
- WellElement.LAYER__FIELD: layer,
233
228
  }
234
229
  element = self._rec_handler.add_models_with_data(dt, [fields])[0]
235
230
 
@@ -327,10 +327,10 @@ class FileUtil:
327
327
  :param files: A dictionary of file name to file data as a string or bytes.
328
328
  :return: The bytes for a zip file containing the input files.
329
329
  """
330
- with io.BytesIO() as zip_buffer:
331
- with zipfile.ZipFile(zip_buffer, "w", zipfile.ZIP_DEFLATED) as zip_file:
332
- for file_name, file_data in files.items():
333
- zip_file.writestr(file_name, file_data)
330
+ zip_buffer: io.BytesIO = io.BytesIO()
331
+ with zipfile.ZipFile(zip_buffer, "w", zipfile.ZIP_DEFLATED) as zip_file:
332
+ for file_name, file_data in files.items():
333
+ zip_file.writestr(file_name, file_data)
334
334
  return zip_buffer.getvalue()
335
335
 
336
336
  # Deprecated functions:
@@ -199,7 +199,7 @@ class AccessionRequestId(AbstractAccessionServiceOperator):
199
199
 
200
200
  Properties:
201
201
  numberOfCharacters: Number of characters maximum in the request ID.
202
- accessorName: This is a legacy variable from drum.getNextIdListByMapName(), which allows setting different "accessorName" from old system. We need this for compatibility patch for converting these to the new preference format.
202
+ accessorName: This is a legacy variable from drum.getNextIdListByMapName(), which allows setting different "accessorName" from old system. We need this for compability patch for converting these to the new preference format.
203
203
  """
204
204
  _num_of_characters: int
205
205
  _accessor_name: str
@@ -341,7 +341,7 @@ class AccessionService:
341
341
  def get_affixed_id_in_batch(self, data_type_name: str, data_field_name: str, num_ids: int, prefix: str | None,
342
342
  suffix: str | None, num_digits: int | None, start_num: int = 1) -> list[str]:
343
343
  """
344
- Get the batch affixed IDs that are maximal in cache and contiguous for a particular datatype.datafield under a given format.
344
+ Get the batch affixed IDs that are maximal in cache and contiguious for a particular datatype.datafield under a given format.
345
345
  :param data_type_name: The datatype name to look for max ID
346
346
  :param data_field_name: The datafield name to look for max ID
347
347
  :param num_ids: The number of IDs to accession.
@@ -7,7 +7,6 @@ from sapiopylib.rest.pojo.datatype.FieldDefinition import FieldType, AbstractVel
7
7
  from sapiopylib.rest.pojo.eln.ElnExperiment import ElnExperiment
8
8
  from sapiopylib.rest.pojo.eln.ExperimentEntry import ExperimentEntry
9
9
  from sapiopylib.rest.pojo.eln.SapioELNEnums import ElnBaseDataType
10
- from sapiopylib.rest.pojo.eln.eln_headings import ElnExperimentTab
11
10
  from sapiopylib.rest.pojo.webhook.WebhookContext import SapioWebhookContext
12
11
  from sapiopylib.rest.utils.Protocols import ElnExperimentProtocol, ElnEntryStep
13
12
  from sapiopylib.rest.utils.recordmodel.PyRecordModel import PyRecordModel, AbstractRecordModel
@@ -220,9 +219,7 @@ class AliasUtil:
220
219
  # noinspection PyTypeChecker
221
220
  fields: FieldMap = record.get_fields()
222
221
  else:
223
- # TI-47593: Copy the record's fields by using the get() method instead of copy_to_dict() so that date
224
- # macros get translated to valid field values.
225
- fields: FieldMap = {f: record.fields.get(f) for f in record.fields}
222
+ fields: FieldMap = record.fields.copy_to_dict()
226
223
  # PR-47457: Only include the record ID if the caller requests it, since including the record ID can break
227
224
  # callbacks in certain circumstances if the record ID is negative.
228
225
  if include_record_id:
@@ -105,8 +105,7 @@ class QueueItemHandler:
105
105
  """
106
106
  self.user = AliasUtil.to_sapio_user(context)
107
107
  self.rec_handler = RecordHandler(self.user)
108
- # PR-47565: Only initialize a ProcessQueueContext if the given context object has context_data.
109
- if isinstance(context, SapioWebhookContext) and context.context_data:
108
+ if isinstance(context, SapioWebhookContext):
110
109
  self.context = ProcessQueueContext(context)
111
110
  else:
112
111
  self.context = None