iris-pex-embedded-python 3.2.0b5__py3-none-any.whl → 3.2.0b6__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 iris-pex-embedded-python might be problematic. Click here for more details.
- iop/cls/IOP/Message.cls +64 -23
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/METADATA +1 -1
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/RECORD +7 -7
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/LICENSE +0 -0
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/top_level.txt +0 -0
iop/cls/IOP/Message.cls
CHANGED
|
@@ -157,6 +157,12 @@ Method CopyValues(
|
|
|
157
157
|
Return tSC
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/// Sets a value at the specified property path in the JSON document
|
|
161
|
+
/// @param pValue Value to set
|
|
162
|
+
/// @param pPropertyPath Path to the property (e.g. "property1.property2" or "array()")
|
|
163
|
+
/// @param pAction Action to perform ("set", "append", "remove", "insert")
|
|
164
|
+
/// @param pKey Optional key for specialized operations, required for insert
|
|
165
|
+
/// @returns %Status
|
|
160
166
|
Method SetValueAt(
|
|
161
167
|
pValue As %String = "",
|
|
162
168
|
pPropertyPath As %String = "",
|
|
@@ -164,51 +170,86 @@ Method SetValueAt(
|
|
|
164
170
|
pKey As %String = "") As %Status
|
|
165
171
|
{
|
|
166
172
|
Set tSC = $$$OK
|
|
167
|
-
// if pAction is set, use jsonpath to set the value
|
|
168
173
|
Try {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// Convert pPropertyPath to a a jsonpath
|
|
176
|
-
Set tPath = ..ConvertPath(pPropertyPath)
|
|
174
|
+
// Validate input parameters
|
|
175
|
+
If pPropertyPath = "" Return $$$ERROR($$$GeneralError, "Property path cannot be empty")
|
|
176
|
+
If '$LISTFIND($LISTBUILD("set","append","remove","insert"), pAction) Return $$$ERROR($$$GeneralError, "Invalid action: "_pAction)
|
|
177
|
+
If (pAction = "insert") && (pKey = "") Return $$$ERROR($$$GeneralError, "Key is required for insert action")
|
|
177
178
|
|
|
179
|
+
// Initialize Python objects
|
|
178
180
|
Set pyjson = ##class(%SYS.Python).Import("json")
|
|
179
181
|
Set jp = ##class(%SYS.Python).Import("jsonpath_ng")
|
|
180
182
|
Set builtins = ##class(%SYS.Python).Builtins()
|
|
181
183
|
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
// Handle append operations
|
|
185
|
+
Set tAppend = (pAction = "append")
|
|
186
|
+
If tAppend, $EXTRACT(pPropertyPath, *-1, *) = "()" {
|
|
187
|
+
Set pPropertyPath = $EXTRACT(pPropertyPath, 1, *-2)
|
|
185
188
|
}
|
|
186
|
-
Set tJSON = pyjson.loads(..json)
|
|
187
189
|
|
|
190
|
+
// Initialize empty JSON if needed
|
|
191
|
+
Set:..json="" ..json = "{}"
|
|
192
|
+
|
|
193
|
+
// Parse JSON and prepare path
|
|
194
|
+
Set tJSON = pyjson.loads(..json)
|
|
195
|
+
Set tPath = ..ConvertPath(pPropertyPath)
|
|
188
196
|
Set parser = jp.parse(tPath)
|
|
189
|
-
|
|
197
|
+
|
|
198
|
+
If pAction = "set" {
|
|
199
|
+
// Simple set operation
|
|
190
200
|
Set tJSON = parser."update_or_create"(tJSON, pValue)
|
|
191
201
|
}
|
|
192
|
-
ElseIf pAction = "
|
|
202
|
+
ElseIf pAction = "remove" {
|
|
203
|
+
// Remove operation
|
|
204
|
+
Set matches = parser.find(tJSON)
|
|
205
|
+
If matches."__len__"() > 0 {
|
|
206
|
+
// Not yet implemented
|
|
207
|
+
Set tSC = $$$ERROR($$$GeneralError, "Remove operation not yet implemented")
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
ElseIf pAction = "insert" {
|
|
211
|
+
// Handle dictionary insert/update
|
|
212
|
+
Set matches = parser.find(tJSON)
|
|
213
|
+
If matches."__len__"() = 0 {
|
|
214
|
+
// Create new dictionary if path doesn't exist
|
|
215
|
+
Set tDict = builtins.dict()
|
|
216
|
+
Do tDict."__setitem__"(pKey, pValue)
|
|
217
|
+
Set tJSON = parser."update_or_create"(tJSON, tDict)
|
|
218
|
+
}
|
|
219
|
+
Else {
|
|
220
|
+
// Update existing dictionary
|
|
221
|
+
Set tDict = matches."__getitem__"(0)."value"
|
|
222
|
+
Do tDict."__setitem__"(pKey, pValue)
|
|
223
|
+
Set tJSON = parser."update"(tJSON, tDict)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
ElseIf tAppend {
|
|
227
|
+
// Handle append operation
|
|
193
228
|
Set tFindValue = parser."find"(tJSON)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
229
|
+
If tFindValue."__len__"() = 0 {
|
|
230
|
+
// Create new array if path doesn't exist
|
|
231
|
+
Set:(tAppend) tValue = builtins.list()
|
|
232
|
+
Do:tAppend tValue.append(pValue)
|
|
233
|
+
Set tJSON = parser."update_or_create"(tJSON, $Select(tAppend: tValue, 1: pValue))
|
|
198
234
|
}
|
|
199
235
|
Else {
|
|
236
|
+
// Append to existing array
|
|
200
237
|
Do tFindValue."__getitem__"(0)."value".append(pValue)
|
|
201
238
|
Set tJSON = parser."update"(tJSON, tFindValue."__getitem__"(0)."value")
|
|
202
239
|
}
|
|
203
240
|
}
|
|
204
241
|
|
|
205
|
-
|
|
206
|
-
Set ..json =
|
|
242
|
+
// Update JSON storage
|
|
243
|
+
Set ..json = pyjson.dumps(tJSON)
|
|
207
244
|
Set ..classname = ..DocType
|
|
208
|
-
|
|
209
|
-
}
|
|
245
|
+
|
|
246
|
+
}
|
|
247
|
+
Catch ex {
|
|
210
248
|
Set tSC = ex.AsStatus()
|
|
249
|
+
// Log error details
|
|
250
|
+
$$$LOGWARNING("Error in SetValueAt: "_$System.Status.GetErrorText(tSC))
|
|
211
251
|
}
|
|
252
|
+
|
|
212
253
|
Return tSC
|
|
213
254
|
}
|
|
214
255
|
|
{iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/RECORD
RENAMED
|
@@ -112,7 +112,7 @@ iop/cls/IOP/BusinessService.cls,sha256=7ebn32J9PiZXUgXuh5Xxm_7X6zHBiqkJr9c_dWxbP
|
|
|
112
112
|
iop/cls/IOP/Common.cls,sha256=4f4ZpLj8fsj8IKJDNb9pKoCokzo522JHWX0OqpAaC5g,11192
|
|
113
113
|
iop/cls/IOP/Director.cls,sha256=M43LoTb6lwSr0J81RFxi1YLW1mwda09wQ7Xqr3nBtxo,2008
|
|
114
114
|
iop/cls/IOP/InboundAdapter.cls,sha256=GeoCm6q5HcLJ5e4VxgqXiErJXqolBbpKwpunaNzpvjU,610
|
|
115
|
-
iop/cls/IOP/Message.cls,sha256=
|
|
115
|
+
iop/cls/IOP/Message.cls,sha256=EJWt0ifN3v-QxFit-xvU4Brodx58_jWeYZDoiyHuHa8,25156
|
|
116
116
|
iop/cls/IOP/OutboundAdapter.cls,sha256=9eOwy5ojwcTzwrHs6LNrFQvUD8aqcoNCZrILN1ycdDM,958
|
|
117
117
|
iop/cls/IOP/PickleMessage.cls,sha256=S3y7AClQ8mAILjxPuHdCjGosBZYzGbUQ5WTv4mYPNMQ,1673
|
|
118
118
|
iop/cls/IOP/Test.cls,sha256=gAC9PEfMZsvAEWIa241-ug2FWAhITbN1SOispZzJPnI,2094
|
|
@@ -130,9 +130,9 @@ iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,
|
|
|
130
130
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
131
131
|
irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
132
132
|
irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
|
|
133
|
-
iris_pex_embedded_python-3.2.
|
|
134
|
-
iris_pex_embedded_python-3.2.
|
|
135
|
-
iris_pex_embedded_python-3.2.
|
|
136
|
-
iris_pex_embedded_python-3.2.
|
|
137
|
-
iris_pex_embedded_python-3.2.
|
|
138
|
-
iris_pex_embedded_python-3.2.
|
|
133
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
134
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/METADATA,sha256=68jl5P_-7_zKoJsIQM-kqrNCMTSOP-PtBzg6vW6_3xM,4427
|
|
135
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
136
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
137
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
138
|
+
iris_pex_embedded_python-3.2.0b6.dist-info/RECORD,,
|
{iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/LICENSE
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.2.0b5.dist-info → iris_pex_embedded_python-3.2.0b6.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|