@opentrons/shared-data 0.0.1-alpha.19 → 0.0.1-alpha.21

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.
Files changed (156) hide show
  1. package/lib/{bundle.673284981fd97184260c.js → opentrons-shared-data.js} +2 -2
  2. package/lib/opentrons-shared-data.js.map +1 -0
  3. package/package.json +1 -1
  4. package/webpack.config.js +1 -0
  5. package/js/__tests__/__snapshots__/pipettes.test.ts.snap +0 -5969
  6. package/js/__tests__/deckSchemas.test.ts +0 -87
  7. package/js/__tests__/errors.test.js +0 -21
  8. package/js/__tests__/getAreSlotsAdjacent.test.ts +0 -128
  9. package/js/__tests__/getWellNamePerMultiTip.test.ts +0 -162
  10. package/js/__tests__/labwareDefQuirks.test.ts +0 -37
  11. package/js/__tests__/labwareDefSchemaV1.test.ts +0 -82
  12. package/js/__tests__/labwareDefSchemaV2.test.ts +0 -298
  13. package/js/__tests__/moduleAccessors.test.ts +0 -50
  14. package/js/__tests__/moduleSpecsSchema.test.ts +0 -77
  15. package/js/__tests__/pipetteSchemaV2.test.ts +0 -107
  16. package/js/__tests__/pipetteSpecSchemas.test.ts +0 -48
  17. package/js/__tests__/pipettes.test.ts +0 -58
  18. package/js/__tests__/protocolSchemaV4.test.ts +0 -137
  19. package/js/__tests__/protocolSchemaV5.test.ts +0 -137
  20. package/js/__tests__/protocolSchemaV6.test.ts +0 -132
  21. package/js/__tests__/protocolSchemaV7.test.ts +0 -64
  22. package/js/__tests__/protocolValidation.test.ts +0 -83
  23. package/js/__tests__/sortWells.test.ts +0 -40
  24. package/js/__tests__/splitWellsOnColumn.test.ts +0 -21
  25. package/js/__tests__/validateErrors.test.js +0 -34
  26. package/js/constants.ts +0 -338
  27. package/js/cypressUtils.ts +0 -35
  28. package/js/errors.ts +0 -33
  29. package/js/fixtures.ts +0 -161
  30. package/js/getLabware.ts +0 -154
  31. package/js/gripper.ts +0 -29
  32. package/js/helpers/__tests__/getAdapterName.test.ts +0 -31
  33. package/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts +0 -12
  34. package/js/helpers/__tests__/getVectorDifference.test.ts +0 -25
  35. package/js/helpers/__tests__/getVectorSum.test.ts +0 -21
  36. package/js/helpers/__tests__/labwareInference.test.ts +0 -84
  37. package/js/helpers/__tests__/orderWells.test.ts +0 -87
  38. package/js/helpers/__tests__/parseProtocolData.test.ts +0 -165
  39. package/js/helpers/__tests__/volume.test.ts +0 -108
  40. package/js/helpers/__tests__/wellSets.test.ts +0 -352
  41. package/js/helpers/get96Channel384WellPlateWells.ts +0 -44
  42. package/js/helpers/getAddressableAreasInProtocol.ts +0 -59
  43. package/js/helpers/getLoadedLabwareDefinitionsByUri.ts +0 -30
  44. package/js/helpers/getModuleVizDims.ts +0 -118
  45. package/js/helpers/getOccludedSlotCountForModule.ts +0 -13
  46. package/js/helpers/getVectorDifference.ts +0 -12
  47. package/js/helpers/getVectorSum.ts +0 -12
  48. package/js/helpers/getWellNamePerMultiTip.ts +0 -86
  49. package/js/helpers/getWellTotalVolume.ts +0 -16
  50. package/js/helpers/index.ts +0 -347
  51. package/js/helpers/labwareInference.ts +0 -92
  52. package/js/helpers/orderWells.ts +0 -69
  53. package/js/helpers/parseProtocolData.ts +0 -141
  54. package/js/helpers/volume.ts +0 -35
  55. package/js/helpers/wellIsRect.ts +0 -6
  56. package/js/helpers/wellSets.ts +0 -155
  57. package/js/index.ts +0 -14
  58. package/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap +0 -3
  59. package/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap +0 -3
  60. package/js/labwareTools/__tests__/createDefaultDisplayName.test.ts +0 -111
  61. package/js/labwareTools/__tests__/createIrregularLabware.test.ts +0 -226
  62. package/js/labwareTools/__tests__/createLabware.test.ts +0 -147
  63. package/js/labwareTools/index.ts +0 -452
  64. package/js/modules.ts +0 -97
  65. package/js/pipettes.ts +0 -89
  66. package/js/protocols.ts +0 -290
  67. package/js/schema.ts +0 -80
  68. package/js/scripts/generateDeckLayersFromSVG.js +0 -46
  69. package/js/titleCase.ts +0 -30
  70. package/js/types.ts +0 -600
  71. package/lib/bundle.673284981fd97184260c.js.map +0 -1
  72. package/python/.coveragerc +0 -4
  73. package/python/.flake8 +0 -32
  74. package/python/Config.in +0 -10
  75. package/python/Makefile +0 -134
  76. package/python/Pipfile +0 -28
  77. package/python/Pipfile.lock +0 -645
  78. package/python/buildroot.mk +0 -30
  79. package/python/mypy.ini +0 -41
  80. package/python/opentrons_shared_data/__init__.py +0 -17
  81. package/python/opentrons_shared_data/_version.py +0 -20
  82. package/python/opentrons_shared_data/command/__init__.py +0 -52
  83. package/python/opentrons_shared_data/deck/__init__.py +0 -96
  84. package/python/opentrons_shared_data/deck/dev_types.py +0 -180
  85. package/python/opentrons_shared_data/errors/__init__.py +0 -30
  86. package/python/opentrons_shared_data/errors/categories.py +0 -60
  87. package/python/opentrons_shared_data/errors/codes.py +0 -108
  88. package/python/opentrons_shared_data/errors/exceptions.py +0 -915
  89. package/python/opentrons_shared_data/gripper/__init__.py +0 -63
  90. package/python/opentrons_shared_data/gripper/constants.py +0 -6
  91. package/python/opentrons_shared_data/gripper/gripper_definition.py +0 -101
  92. package/python/opentrons_shared_data/labware/__init__.py +0 -22
  93. package/python/opentrons_shared_data/labware/constants.py +0 -7
  94. package/python/opentrons_shared_data/labware/dev_types.py +0 -140
  95. package/python/opentrons_shared_data/labware/labware_definition.py +0 -328
  96. package/python/opentrons_shared_data/load.py +0 -57
  97. package/python/opentrons_shared_data/module/__init__.py +0 -74
  98. package/python/opentrons_shared_data/module/dev_types.py +0 -141
  99. package/python/opentrons_shared_data/pipette/__init__.py +0 -107
  100. package/python/opentrons_shared_data/pipette/dev_types.py +0 -177
  101. package/python/opentrons_shared_data/pipette/file_operation_helpers.py +0 -37
  102. package/python/opentrons_shared_data/pipette/load_data.py +0 -261
  103. package/python/opentrons_shared_data/pipette/model_constants.py +0 -123
  104. package/python/opentrons_shared_data/pipette/mutable_configurations.py +0 -431
  105. package/python/opentrons_shared_data/pipette/pipette_definition.py +0 -503
  106. package/python/opentrons_shared_data/pipette/pipette_load_name_conversions.py +0 -240
  107. package/python/opentrons_shared_data/pipette/scripts/__init__.py +0 -0
  108. package/python/opentrons_shared_data/pipette/scripts/build_json_script.py +0 -469
  109. package/python/opentrons_shared_data/pipette/scripts/update_configuration_files.py +0 -450
  110. package/python/opentrons_shared_data/pipette/types.py +0 -193
  111. package/python/opentrons_shared_data/protocol/__init__.py +0 -13
  112. package/python/opentrons_shared_data/protocol/constants.py +0 -98
  113. package/python/opentrons_shared_data/protocol/dev_types.py +0 -436
  114. package/python/opentrons_shared_data/protocol/models/__init__.py +0 -48
  115. package/python/opentrons_shared_data/protocol/models/protocol_schema_v6.py +0 -145
  116. package/python/opentrons_shared_data/protocol/models/protocol_schema_v7.py +0 -95
  117. package/python/opentrons_shared_data/protocol/models/protocol_schema_v8.py +0 -110
  118. package/python/opentrons_shared_data/protocol/models/shared_models.py +0 -111
  119. package/python/opentrons_shared_data/py.typed +0 -0
  120. package/python/opentrons_shared_data/robot/__init__.py +0 -33
  121. package/python/opentrons_shared_data/robot/dev_types.py +0 -37
  122. package/python/pytest.ini +0 -2
  123. package/python/setup.cfg +0 -5
  124. package/python/setup.py +0 -179
  125. package/python/tests/__init__.py +0 -1
  126. package/python/tests/conftest.py +0 -0
  127. package/python/tests/deck/__init__.py +0 -0
  128. package/python/tests/deck/test_list_names.py +0 -12
  129. package/python/tests/deck/test_position.py +0 -113
  130. package/python/tests/deck/test_typechecks.py +0 -28
  131. package/python/tests/errors/__init__.py +0 -1
  132. package/python/tests/errors/test_error_completeness.py +0 -19
  133. package/python/tests/errors/test_exceptions.py +0 -74
  134. package/python/tests/gripper/__init__.py +0 -0
  135. package/python/tests/gripper/test_definition.py +0 -30
  136. package/python/tests/gripper/test_load.py +0 -16
  137. package/python/tests/labware/__init__.py +0 -13
  138. package/python/tests/labware/test_typechecks.py +0 -21
  139. package/python/tests/module/__init__.py +0 -20
  140. package/python/tests/module/test_load.py +0 -49
  141. package/python/tests/module/test_typechecks.py +0 -34
  142. package/python/tests/pipette/__init__.py +0 -0
  143. package/python/tests/pipette/test_load_data.py +0 -103
  144. package/python/tests/pipette/test_mutable_configurations.py +0 -266
  145. package/python/tests/pipette/test_pipette_definition.py +0 -183
  146. package/python/tests/pipette/test_pipette_load_name_conversions.py +0 -222
  147. package/python/tests/pipette/test_typechecks.py +0 -50
  148. package/python/tests/pipette/test_validate_schema.py +0 -37
  149. package/python/tests/protocol/__init__.py +0 -15
  150. package/python/tests/protocol/test_protocol_schema_v6.py +0 -107
  151. package/python/tests/protocol/test_protocol_schema_v7.py +0 -34
  152. package/python/tests/protocol/test_protocol_schema_v8.py +0 -20
  153. package/python/tests/protocol/test_typechecks.py +0 -36
  154. package/python/tests/robot/__init__.py +0 -0
  155. package/python/tests/robot/test_typechecks.py +0 -20
  156. /package/lib/{bundle.673284981fd97184260c.js.LICENSE.txt → opentrons-shared-data.js.LICENSE.txt} +0 -0
@@ -1,240 +0,0 @@
1
- import re
2
- from typing import List, Optional, Union, cast
3
- from .dev_types import PipetteModel, PipetteName
4
- from .types import (
5
- PipetteChannelType,
6
- PipetteModelType,
7
- PipetteVersionType,
8
- PipetteGenerationType,
9
- PipetteModelMajorVersionType,
10
- PipetteModelMinorVersionType,
11
- )
12
- from .pipette_definition import (
13
- PipetteNameType,
14
- PipetteModelVersionType,
15
- )
16
-
17
- DEFAULT_CALIBRATION_OFFSET = [0.0, 0.0, 0.0]
18
- DEFAULT_MODEL = PipetteModelType.p1000
19
- DEFAULT_CHANNELS = PipetteChannelType.SINGLE_CHANNEL
20
- DEFAULT_MODEL_VERSION = PipetteVersionType(major=1, minor=0)
21
-
22
- PIPETTE_AVAILABLE_TYPES = [m.name for m in PipetteModelType]
23
- PIPETTE_CHANNELS_INTS = [c.value for c in PipetteChannelType]
24
-
25
-
26
- def is_model(model_or_name: Union[PipetteName, PipetteModel, None]) -> bool:
27
- """Determine if we have a real model or just a PipetteName.
28
-
29
- Args:
30
- model_or_name (Union[PipetteName, PipetteModel, None]): The pipette we want to check.
31
-
32
- Returns:
33
- bool: Whether or not the given string is a PipetteModel
34
- """
35
- if not model_or_name:
36
- return False
37
- return "v" in model_or_name
38
-
39
-
40
- def supported_pipette(model_or_name: Union[PipetteName, PipetteModel, None]) -> bool:
41
- """Determine if a pipette type is supported.
42
-
43
- Args:
44
- model_or_name (Union[PipetteName, PipetteModel, None]): The pipette we want to check.
45
-
46
- Returns:
47
- bool: Whether or not the given pipette name or model is supported.
48
- """
49
- if not model_or_name:
50
- return False
51
- split_model_or_name = model_or_name.split("_")
52
- try:
53
- channels_as_int = int(channels_from_string(split_model_or_name[1]))
54
- except ValueError:
55
- channels_as_int = 0
56
- if (
57
- split_model_or_name[0] in PIPETTE_AVAILABLE_TYPES
58
- and channels_as_int in PIPETTE_CHANNELS_INTS
59
- ):
60
- return True
61
- return False
62
-
63
-
64
- def channels_from_string(channels: str) -> PipetteChannelType:
65
- """Convert channels from a string.
66
-
67
- With both `py:data:PipetteName` and `py:data:PipetteObject`, we refer to channel types
68
- as `single`, `multi` or `96`.
69
-
70
- Args:
71
- channels (str): The channel string we wish to convert.
72
-
73
- Returns:
74
- PipetteChannelType: A `py:obj:PipetteChannelType`
75
- representing the number of channels on a pipette.
76
-
77
- """
78
- if channels == "96":
79
- return PipetteChannelType.NINETY_SIX_CHANNEL
80
- elif channels == "multi":
81
- return PipetteChannelType.EIGHT_CHANNEL
82
- elif channels == "single":
83
- return PipetteChannelType.SINGLE_CHANNEL
84
- else:
85
- raise ValueError("Invalid number of channels")
86
-
87
-
88
- def version_from_string(version: str) -> PipetteVersionType:
89
- """Convert a version string to a py:obj:PipetteVersionType.
90
-
91
- The version string will either be in the format of `int.int` or `vint.int`.
92
-
93
- Args:
94
- version (str): The string version we wish to convert.
95
-
96
- Returns:
97
- PipetteVersionType: A pipette version object.
98
-
99
- """
100
- version_list = [v for v in re.split("\\.|[v]", version) if v]
101
- major = cast(PipetteModelMajorVersionType, int(version_list[0]))
102
- if len(version_list) > 1:
103
- minor = cast(PipetteModelMinorVersionType, int(version_list[1]))
104
- else:
105
- minor = 0
106
- return PipetteVersionType(major, minor)
107
-
108
-
109
- def version_from_generation(pipette_name_list: List[str]) -> PipetteVersionType:
110
- """Convert a string generation name to a py:obj:PipetteVersionType.
111
-
112
- Pipette generations are strings in the format of "gen1" or "gen2", and
113
- usually associated withe :py:data:PipetteName.
114
-
115
- Args:
116
- pipette_name_list (List[str]): A list of strings from the separated by `_`
117
- py:data:PipetteName.
118
-
119
- Returns:
120
- PipetteVersionType: A pipette version object.
121
-
122
- """
123
- if "flex" in pipette_name_list or "gen3" in pipette_name_list:
124
- return PipetteVersionType(3, 0)
125
- elif "gen2" in pipette_name_list:
126
- return PipetteVersionType(2, 0)
127
- else:
128
- return PipetteVersionType(1, 0)
129
-
130
-
131
- def generation_from_string(pipette_name_list: List[str]) -> PipetteGenerationType:
132
- """Convert a string generation name to a py:obj:PipetteGenerationType.
133
-
134
- Args:
135
- pipette_name_list (List[str]): A list of strings from the separated by `_`
136
- py:data:PipetteName or py:data:PipetteModel.
137
-
138
- Returns:
139
- PipetteGenerationType: A pipette version object.
140
-
141
- """
142
- if (
143
- "flex" in pipette_name_list
144
- or "3." in pipette_name_list[-1]
145
- or pipette_name_list == ["p1000", "96"]
146
- ):
147
- return PipetteGenerationType.FLEX
148
- elif "gen2" in pipette_name_list or "2." in pipette_name_list[-1]:
149
- return PipetteGenerationType.GEN2
150
- else:
151
- return PipetteGenerationType.GEN1
152
-
153
-
154
- def convert_to_pipette_name_type(
155
- model_or_name: Union[PipetteName, PipetteModel]
156
- ) -> PipetteNameType:
157
- """Convert the py:data:PipetteName to a py:obj:PipetteModelVersionType.
158
-
159
- `PipetteNames` are in the format of "p300_single" or "p300_single_gen1".
160
-
161
- Args:
162
- name (PipetteName): The pipette name we want to convert.
163
-
164
- Returns:
165
- PipetteNameType: An object representing a broken out PipetteName
166
- string.
167
-
168
- """
169
- split_pipette_model_or_name = model_or_name.split("_")
170
- channels = channels_from_string(split_pipette_model_or_name[1])
171
- generation = generation_from_string(split_pipette_model_or_name)
172
- pipette_type = PipetteModelType[split_pipette_model_or_name[0]]
173
-
174
- return PipetteNameType(pipette_type, channels, generation)
175
-
176
-
177
- def convert_pipette_name(
178
- name: PipetteName, provided_version: Optional[str] = None
179
- ) -> PipetteModelVersionType:
180
- """Convert the py:data:PipetteName to a py:obj:PipetteModelVersionType.
181
-
182
- `PipetteNames` are in the format of "p300_single" or "p300_single_gen1".
183
-
184
- Args:
185
- name (PipetteName): The pipette name we want to convert.
186
-
187
- Returns:
188
- PipetteModelVersionType: An object representing a broken out PipetteName
189
- string.
190
-
191
- """
192
- split_pipette_name = name.split("_")
193
- channels = channels_from_string(split_pipette_name[1])
194
- if provided_version:
195
- version = version_from_string(provided_version)
196
- else:
197
- version = version_from_generation(split_pipette_name)
198
-
199
- pipette_type = PipetteModelType[split_pipette_name[0]]
200
-
201
- return PipetteModelVersionType(pipette_type, channels, version)
202
-
203
-
204
- def convert_pipette_model(
205
- model: Optional[PipetteModel], provided_version: Optional[str] = ""
206
- ) -> PipetteModelVersionType:
207
- """Convert the py:data:PipetteModel to a py:obj:PipetteModelVersionType.
208
-
209
- `PipetteModel` are in the format of "p300_single_v1.0" or "p300_single_v3.3".
210
-
211
- Sometimes, models may not have a version, in which case the `provided_version` arg
212
- allows you to specify a version to search for.
213
-
214
- Args:
215
- model (PipetteModel): The pipette model we want to convert.
216
- provided_version (str, Optional): The provided version we'd like to look for.
217
-
218
- Returns:
219
- PipetteModelVersionType: An object representing a broken out PipetteName
220
- string.
221
-
222
- """
223
- # TODO (lc 12-5-2022) This helper function is needed
224
- # until we stop using "name" and "model" to refer
225
- # to attached pipettes.
226
- # We need to figure out how to default the pipette model as well
227
- # rather than returning a p1000
228
- if model and not provided_version:
229
- pipette_type, parsed_channels, parsed_version = model.split("_")
230
- channels = channels_from_string(parsed_channels)
231
- version = version_from_string(parsed_version)
232
- elif model and provided_version:
233
- pipette_type, parsed_channels = model.split("_")
234
- channels = channels_from_string(parsed_channels)
235
- version = version_from_string(provided_version)
236
- else:
237
- pipette_type = DEFAULT_MODEL.value
238
- channels = DEFAULT_CHANNELS
239
- version = DEFAULT_MODEL_VERSION
240
- return PipetteModelVersionType(PipetteModelType[pipette_type], channels, version)