iris-pex-embedded-python 2.3.19__py3-none-any.whl → 2.3.21b1__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.

Files changed (54) hide show
  1. grongier/cls/Grongier/PEX/Common.cls +115 -74
  2. grongier/pex/wsgi/handlers.py +51 -0
  3. intersystems_iris/_IRISOREF.py +6 -1
  4. intersystems_iris/dbapi/_DBAPI.py +16 -1
  5. intersystems_iris/dbapi/_Parameter.py +2 -0
  6. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/METADATA +32 -10
  7. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/RECORD +11 -53
  8. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/WHEEL +1 -1
  9. grongier/iris/Grongier/PEX/BusinessOperation.cls +0 -33
  10. grongier/iris/Grongier/PEX/BusinessProcess.cls +0 -100
  11. grongier/iris/Grongier/PEX/BusinessService.cls +0 -33
  12. grongier/iris/Grongier/PEX/Common.cls +0 -133
  13. grongier/iris/Grongier/PEX/Director.cls +0 -15
  14. grongier/iris/Grongier/PEX/Duplex/Operation.cls +0 -27
  15. grongier/iris/Grongier/PEX/Duplex/Process.cls +0 -211
  16. grongier/iris/Grongier/PEX/Duplex/Service.cls +0 -9
  17. grongier/iris/Grongier/PEX/InboundAdapter.cls +0 -22
  18. grongier/iris/Grongier/PEX/Message.cls +0 -126
  19. grongier/iris/Grongier/PEX/OutboundAdapter.cls +0 -34
  20. grongier/iris/Grongier/PEX/PickleMessage.cls +0 -58
  21. grongier/iris/Grongier/PEX/PrivateSession/Duplex.cls +0 -247
  22. grongier/iris/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -32
  23. grongier/iris/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -32
  24. grongier/iris/Grongier/PEX/PrivateSession/Message/Start.cls +0 -32
  25. grongier/iris/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -48
  26. grongier/iris/Grongier/PEX/Python.cls +0 -27
  27. grongier/iris/Grongier/PEX/Test.cls +0 -62
  28. grongier/iris/Grongier/PEX/Utils.cls +0 -312
  29. grongier/iris/__init__.py +0 -0
  30. grongier/pex/data/PEX/BusinessOperation.cls +0 -35
  31. grongier/pex/data/PEX/BusinessProcess.cls +0 -113
  32. grongier/pex/data/PEX/BusinessService.cls +0 -35
  33. grongier/pex/data/PEX/Common.cls +0 -146
  34. grongier/pex/data/PEX/Director.cls +0 -57
  35. grongier/pex/data/PEX/Duplex/Operation.cls +0 -29
  36. grongier/pex/data/PEX/Duplex/Process.cls +0 -229
  37. grongier/pex/data/PEX/Duplex/Service.cls +0 -9
  38. grongier/pex/data/PEX/InboundAdapter.cls +0 -22
  39. grongier/pex/data/PEX/Message.cls +0 -128
  40. grongier/pex/data/PEX/OutboundAdapter.cls +0 -36
  41. grongier/pex/data/PEX/PickleMessage.cls +0 -58
  42. grongier/pex/data/PEX/PrivateSession/Duplex.cls +0 -260
  43. grongier/pex/data/PEX/PrivateSession/Message/Ack.cls +0 -32
  44. grongier/pex/data/PEX/PrivateSession/Message/Poll.cls +0 -32
  45. grongier/pex/data/PEX/PrivateSession/Message/Start.cls +0 -32
  46. grongier/pex/data/PEX/PrivateSession/Message/Stop.cls +0 -48
  47. grongier/pex/data/PEX/Test.cls +0 -62
  48. grongier/pex/data/PEX/Utils.cls +0 -413
  49. iris/iris_site.py +0 -13
  50. iris/irisbuiltins.py +0 -97
  51. iris/irisloader.py +0 -199
  52. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/LICENSE +0 -0
  53. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/entry_points.txt +0 -0
  54. {iris_pex_embedded_python-2.3.19.dist-info → iris_pex_embedded_python-2.3.21b1.dist-info}/top_level.txt +0 -0
@@ -1,413 +0,0 @@
1
- /* Copyright (c) 2021 by InterSystems Corporation.
2
- Cambridge, Massachusetts, U.S.A. All rights reserved.
3
- Confidential property of InterSystems Corporation. */
4
-
5
- Include Ensemble
6
-
7
- Class Grongier.PEX.Utils Extends %RegisteredObject
8
- {
9
-
10
- ClassMethod dispatchRegisterComponent(
11
- pModule As %String,
12
- pRemoteClassname As %String,
13
- pCLASSPATHS As %String = "",
14
- pOverwrite As %Boolean = 0,
15
- pProxyClassname As %String = "") As %Status
16
- {
17
- set tSc = $$$OK
18
- $$$ThrowOnError(##class(Grongier.PEX.Utils).RegisterComponent(pModule, pRemoteClassname, pCLASSPATHS, pOverwrite , pProxyClassname))
19
- return tSc
20
- }
21
-
22
- /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
23
- ClassMethod RegisterComponent(
24
- pModule As %String,
25
- pRemoteClassname As %String,
26
- pCLASSPATHS As %String = "",
27
- pOverwrite As %Boolean = 0,
28
- pProxyClassname As %String = "") As %Status
29
- {
30
- #dim tSC As %Status = $$$OK
31
- #dim ex As %Exception.AbstractException
32
- #dim tLanguage,tExtraClasspaths,tDelimiter,tOnePath As %String = ""
33
- #dim tClassDetails,tRemoteSettings As %String = ""
34
- #dim tClasspaths As %ListOfDataTypes
35
-
36
- Quit:(""=pRemoteClassname) $$$ERROR($$$EnsErrGeneral,"Remote Classname must be specified in order to register a Production EXtensions component")
37
- Quit:(""=pModule) $$$ERROR($$$EnsErrGeneral,"Must specify the module of the remote code.")
38
-
39
- Try {
40
-
41
- $$$ThrowOnError(..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings))
42
-
43
- Set tConnectionSettings("Classpaths") = pCLASSPATHS
44
- Set tConnectionSettings("Module") = pModule
45
- Set tConnectionSettings("Classname") = pRemoteClassname
46
- Set:(""=pProxyClassname) pProxyClassname = "User."_pRemoteClassname
47
-
48
- $$$ThrowOnError(..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite))
49
-
50
- } Catch ex {
51
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
52
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
53
- }
54
-
55
- Quit tSC
56
- }
57
-
58
- ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
59
- {
60
- #dim tSC As %Status = $$$OK
61
- #dim ex As %Exception.AbstractException
62
- #dim tIsPEX As %Boolean = 0
63
- #dim tClass As %Dictionary.CompiledClass
64
-
65
- Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Remote class name must be specified.")
66
-
67
- Try {
68
-
69
- If '##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
70
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("No proxy class defined for remote class '%1'.",pClassname))
71
- Quit
72
- }
73
- If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
74
- Set tClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname,,.tSC)
75
- Quit:$$$ISERR(tSC)
76
- If '$IsObject(tClass) {
77
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class for remote class '%1' could not be opened.",pClassname))
78
- Quit
79
- }
80
- Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
81
- }
82
- If tIsPEX {
83
- Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
84
- If $$$ISERR(tSC) {
85
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete proxy class for remote class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
86
- Quit
87
- }
88
- } Else {
89
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot delete class '%1' because it is not a PEX proxy class.",pClassname))
90
- Quit
91
- }
92
-
93
- } Catch ex {
94
- Set tSC = ex.AsStatus()
95
- }
96
-
97
- Quit tSC
98
- }
99
-
100
- // ..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings)
101
-
102
- ClassMethod GetRemoteClassInfo(
103
- pRemoteClassname As %String,
104
- pModule As %String,
105
- pClasspaths As %String,
106
- ByRef pClassDetails,
107
- ByRef pRemoteSettings) As %Status [ Internal, Private ]
108
- {
109
- #dim tSC As %Status = $$$OK
110
- #dim ex As %Exception.AbstractException
111
- #dim tGateway As %External.Gateway
112
- #dim tGatewayProxy As %Net.Remote.Object
113
-
114
- Try {
115
- if pClasspaths '="" {
116
- set sys = ##class(%SYS.Python).Import("sys")
117
- set delimiter = $s($system.Version.GetOS()="Windows":";",1:":")
118
- set extraClasspaths = $tr(pClasspaths,delimiter,"|")
119
- for i=1:1:$l(extraClasspaths,"|") {
120
- set onePath = $p(extraClasspaths,"|",i)
121
- set onePath = ##class(%File).NormalizeDirectory(onePath)
122
- if onePath?1"$$IRISHOME"1P.E set onePath = $e($system.Util.InstallDirectory(),1,*-1)_$e(onePath,11,*)
123
- if onePath'="" do sys.path.append(onePath)
124
- }
125
- }
126
- ;
127
-
128
- set importlib = ##class(%SYS.Python).Import("importlib")
129
- set builtins = ##class(%SYS.Python).Import("builtins")
130
- set module = importlib."import_module"(pModule)
131
- set class = builtins.getattr(module, pRemoteClassname)
132
- set tClass = class."__new__"(class)
133
-
134
-
135
- If $IsObject(tClass) {
136
- #; List of information about the class as a whole - $lb(SuperClass, Description, InfoURL, IconURL, Adapter)
137
- Set pClassDetails = tClass."_get_info"()
138
- #; List of information about the various properties of the class
139
- #; List of lists of form $lb(propName,dataType,defaultVal,required,category,description)
140
- Set pRemoteSettings = tClass."_get_properties"()
141
- } Else {
142
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Error opening gateway proxy for class '%1'"),pRemoteClassname)
143
- }
144
- } Catch ex {
145
- set msg = $System.Status.GetOneStatusText(ex.AsStatus(),1)
146
- set tSC = $$$ERROR($$$EnsErrGeneral,msg)
147
- }
148
-
149
- Quit tSC
150
- }
151
-
152
- /// Set tConnectionSettings("Classpaths") = pCLASSPATHS
153
- /// Set tConnectionSettings("Module") = pModule
154
- /// Set tConnectionSettings("Classname") = pRemoteClassname
155
- /// Set:(""=pProxyClassname) pProxyClassname = pRemoteClassname
156
- ///
157
- /// Set tSC = ..GenerateProxyClass(pProxyClassname,.tConnectionSettings,tClassDetails,tRemoteSettings,pOverwrite)
158
- /// "bo","Duplex","/irisdev/app/src/python/demo/duplex/",1,"Duplex.Duplex"
159
- ClassMethod GenerateProxyClass(
160
- pClassname As %String,
161
- ByRef pConnectionSettings,
162
- pClassDetails As %String = "",
163
- pRemoteSettings As %String = "",
164
- pOverwrite As %Boolean = 0) As %Status [ Internal, Private ]
165
- {
166
- #dim tSC As %Status = $$$OK
167
- #dim ex As %Exception.AbstractException
168
-
169
- Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Class name must be specified in order to generate a proxy class for this Production EXtensions component")
170
-
171
- Try {
172
-
173
- If ##class(%Dictionary.ClassDefinition).%ExistsId(pClassname) {
174
- If 'pOverwrite {
175
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Proxy class '%1' already exists.",pClassname))
176
- Quit
177
- } Else {
178
- #dim tIsPEX As %Boolean = 0
179
- If $classmethod(pClassname,"%Extends","Grongier.PEX.Common") {
180
- #dim tClass As %Dictionary.CompiledClass = ##class(%Dictionary.CompiledClass).%OpenId(pClassname)
181
- If '$IsObject(tClass) {
182
- Set tSC = $$$ERROR($$$EnsErrGeneral,"Class not found")
183
- Quit
184
- }
185
- Set tIsPEX = ("Grongier.PEX.Utils" = tClass.GeneratedBy)
186
- }
187
- If tIsPEX {
188
- Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
189
- If $$$ISERR(tSC) {
190
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete existing proxy class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
191
- Quit
192
- }
193
- } Else {
194
- Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot overwrite class '%1' because it is not a PEX proxy class.",pClassname))
195
- Quit
196
- }
197
- }
198
- }
199
-
200
- #; create subclass of the ObjectScript Business Host
201
- #dim tCOSClass As %Dictionary.ClassDefinition
202
- Set tCOSClass = ##class(%Dictionary.ClassDefinition).%New()
203
- Set tCOSClass.Name = pClassname
204
-
205
- #dim tSuperClass As %String = pClassDetails."__getitem__"(0)
206
- If (""=tSuperClass) {
207
- Set tSC = $$$ERROR($$$EnsErrGeneral,"No PEX superclass found.")
208
- Quit
209
- }
210
- If '$Case($P(tSuperClass,".",*),"DuplexProcess":1,"DuplexService":1,"DuplexOperation":1,"InboundAdapter":1,"OutboundAdapter":1,"BusinessService":1,"BusinessProcess":1,"BusinessOperation":1,:0) {
211
- Set tSC = $$$ERROR($$$EnsErrGeneral,"Invalid superclass")
212
- Quit
213
- }
214
- Set tSuperClass = "Grongier.PEX."_$P(tSuperClass,".",*)
215
-
216
- Set tCOSClass.Super = tSuperClass
217
- Set tCOSClass.GeneratedBy = $CLASSNAME()
218
- Set tCOSClass.ClassVersion = $$$CLASSDEFINITIONVERSION
219
- #dim tDescription As %String = pClassDetails."__getitem__"(1)
220
- If (""'=tDescription) {
221
- Set tCOSClass.Description = $Replace(tDescription,$C(10),$C(13,10))
222
- }
223
-
224
- #; Do not display any of the connection settings
225
- #dim tSETTINGSParamValue As %String = "%classname:Python $type,%module:Python $type,%settings:Python $type,%classpaths:Python $type"
226
-
227
- #; Create the %classname property
228
- #dim tPropClassname As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
229
- Set tPropClassname.Name = "%classname"
230
- Set tPropClassname.Type = "%String"
231
- Set tPropClassname.InitialExpression = $$$quote(pConnectionSettings("Classname"))
232
- Set tPropClassname.Internal = 1
233
- Set tSC = tCOSClass.Properties.Insert(tPropClassname)
234
- Quit:$$$ISERR(tSC)
235
-
236
- #; Create the %classpaths property
237
- #dim tPropClasspaths As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
238
- Set tPropClasspaths.Name = "%classpaths"
239
- Set tPropClasspaths.Type = "%String"
240
- Set tSC = tPropClasspaths.Parameters.SetAt("","MAXLEN")
241
- Quit:$$$ISERR(tSC)
242
- Set tPropClasspaths.InitialExpression = $$$quote(pConnectionSettings("Classpaths"))
243
- Set tPropClasspaths.Description = "One or more Classpaths (separated by '|' character) needed in addition to the ones configured in the Remote Gateway"
244
- Set tSC = tCOSClass.Properties.Insert(tPropClasspaths)
245
- Quit:$$$ISERR(tSC)
246
-
247
- #; Create the %module property
248
- #dim tPropLanguage As %Dictionary.PropertyDefinition = ##class(%Dictionary.PropertyDefinition).%New()
249
- Set tPropLanguage.Name = "%module"
250
- Set tPropLanguage.Type = "%String"
251
- Set tPropLanguage.Internal = 1
252
- Set tPropLanguage.InitialExpression = $$$quote(pConnectionSettings("Module"))
253
- Set tSC = tCOSClass.Properties.Insert(tPropLanguage)
254
- Quit:$$$ISERR(tSC)
255
-
256
- #; Create other properties
257
- #dim tMethod As %Dictionary.MethodDefinition = ##class(%Dictionary.MethodDefinition).%New()
258
- Set tMethod.Name = "SetPropertyValues"
259
-
260
- #dim tCustomProp As %Dictionary.PropertyDefinition
261
- #dim tPropInfo,tPropName,tDataType,tDefault,tDesc,tPropCat,tContext As %String
262
- #; each remote setting is of form $lb(propName,dataType,defaultVal,required,category,description,editorContext)
263
- For i=1:1:$ll(pRemoteSettings) {
264
- Set tPropInfo = $lg(pRemoteSettings,i)
265
- Continue:""=tPropInfo ; this shouldn't happen, but just in case
266
- Set tPropName = $lg(tPropInfo,1)
267
- Set tDataType = $lg(tPropInfo,2)
268
- If (""=tPropName) || (""=tDataType) {
269
- Set tSC = $$$ERROR($$$EnsErrGeneral,"All properties must have a name and datatype defined")
270
- Quit
271
- }
272
- Set tCustomProp = ##class(%Dictionary.PropertyDefinition).%New()
273
- Set tCustomProp.Name = tPropName
274
- If $Case(tDataType,"String":1,"Integer":1,"Boolean":1,"Numeric":1,:0) {
275
- Set tDataType = "%"_tDataType
276
- } ElseIf '##class(%Dictionary.ClassDefinition).%ExistsId(tDataType) {
277
- Set tDataType = "%String"
278
- }
279
- Set tCustomProp.Type = tDataType
280
- Set tDefault = $lg(tPropInfo,3)
281
- If ""'=tDefault {
282
- Set tCustomProp.InitialExpression = $$$quote(tDefault)
283
- }
284
- Set tCustomProp.Required = $lg(tPropInfo,4,0)
285
- Set tDesc = $lg(tPropInfo,6)
286
- If ""'=tDesc {
287
- Set tDesc = $zstrip($Replace(tDesc,$C(10),$C(13,10)),"<>W")
288
- Set:$E(tDesc,*-1,*)=$C(13,10) tDesc = $E(tDesc,1,*-2)
289
- Set tCustomProp.Description = tDesc
290
- }
291
-
292
- Set tSC = tCOSClass.Properties.Insert(tCustomProp)
293
- Quit:$$$ISERR(tSC)
294
-
295
- Set tPropCat = $lg(tPropInfo,5,"Additional")
296
- Set tSETTINGSParamValue = tSETTINGSParamValue_","_tPropName_":"_tPropCat
297
-
298
- Set tSC = tMethod.Implementation.WriteLine($char(9)_"try {") Quit:$$$ISERR(tSC)
299
- Set tSC = tMethod.Implementation.WriteLine($char(9,9)_"set $property(..%gatewayProxy,"_$$$quote(tPropName)_") = .."_tPropName) Quit:$$$ISERR(tSC)
300
- Set tSC = tMethod.Implementation.WriteLine($char(9)_"} catch ex {") Quit:$$$ISERR(tSC)
301
- Set tSC = tMethod.Implementation.WriteLine($char(9,9)_"$$$LOGWARNING(ex.DisplayString())") Quit:$$$ISERR(tSC)
302
- Set tSC = tMethod.Implementation.WriteLine($char(9)_"}") Quit:$$$ISERR(tSC)
303
- }
304
-
305
- If $Case(tSuperClass,"Grongier.PEX.BusinessService":1,"Grongier.PEX.BusinessOperation":1,"Grongier.PEX.DuplexService":1,"Grongier.PEX.DuplexOperation":1,:0) {
306
- set builtins = ##class(%SYS.Python).Import("builtins")
307
- If (builtins.len(pClassDetails)>4) { //Adaptor
308
-
309
- #dim tAdapterClass = pClassDetails."__getitem__"(4)
310
- #; May want to issue a warning in the UI if the Adapter class does not exist
311
- #; but we don't check here because it does compile and may just be that the user is registering the Service/Operation before the Adapter
312
- #dim tADAPTERParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
313
- Set tADAPTERParam.Name = "ADAPTER"
314
- Set tADAPTERParam.Default = tAdapterClass
315
- Set tSC = tCOSClass.Parameters.Insert(tADAPTERParam)
316
- Quit:$$$ISERR(tSC)
317
- }
318
- }
319
-
320
- set type = ""
321
- set:($Case(tSuperClass,"Grongier.PEX.InboundAdapter":1,"Grongier.PEX.OutboundAdapter":1,:0)) type = "Adapter"
322
- set tSETTINGSParamValue = $REPLACE(tSETTINGSParamValue,"$type",type)
323
-
324
- #dim tSETTINGSParam As %Dictionary.ParameterDefinition = ##class(%Dictionary.ParameterDefinition).%New()
325
- Set tSETTINGSParam.Name = "SETTINGS"
326
- Set tSETTINGSParam.Default = tSETTINGSParamValue
327
- Set tSC = tCOSClass.Parameters.Insert(tSETTINGSParam)
328
- Quit:$$$ISERR(tSC)
329
-
330
- Set tSC = tCOSClass.%Save()
331
- Quit:$$$ISERR(tSC)
332
-
333
- Set tSC = $System.OBJ.Compile(pClassname,"-d")
334
-
335
- } Catch ex {
336
- Set tSC = ex.AsStatus()
337
- }
338
-
339
- Quit tSC
340
- }
341
-
342
- ClassMethod CreateProduction(
343
- package As %String = "test",
344
- name As %String = "AutoCreatedProduction",
345
- xdata As %CharacterStream) As %Status
346
- {
347
- #Dim produtionClassName As %String = package _ "." _ name
348
- If ('$ZName(produtionClassName, 4))
349
- {
350
- Return $System.Status.Error(5001, "Invalid Production package or name.")
351
- }
352
- #Dim productionDefinition As %Dictionary.ClassDefinition
353
- // Check if the production already exists
354
- If (##class(%Dictionary.ClassDefinition).%ExistsId(produtionClassName))
355
- {
356
- // Open the production
357
- set productionDefinition = ##class(%Dictionary.ClassDefinition).%OpenId(produtionClassName)
358
- }
359
- Else
360
- {
361
- // Create the production definition
362
- set productionDefinition = ##Class(%Dictionary.ClassDefinition).%New()
363
- }
364
- //
365
- Set productionDefinition.Name = produtionClassName
366
- Set productionDefinition.Super = "Ens.Production"
367
- Set productionDefinition.ClassVersion = 25
368
- //
369
- // Check if the XData Definition already exists
370
- If (##Class(%Dictionary.XDataDefinition).%ExistsId(produtionClassName_"||ProductionDefinition"))
371
- {
372
- // delete the XData Definition
373
- $$$ThrowOnError(##Class(%Dictionary.XDataDefinition).%DeleteId(produtionClassName_"||ProductionDefinition"))
374
- }
375
- #Dim xdataDefinition As %Dictionary.XDataDefinition = ##Class(%Dictionary.XDataDefinition).%New()
376
- //
377
- Set xdataDefinition.Name = "ProductionDefinition"
378
- //
379
- Do xdataDefinition.Data.CopyFrom(xdata)
380
- //
381
- // Insert XData Definition into Production Definition
382
- Do productionDefinition.XDatas.Insert(xdataDefinition)
383
- //
384
- #Dim statusCode As %Status = productionDefinition.%Save()
385
- //
386
- If ($System.Status.IsError(statusCode))
387
- {
388
- Return statusCode
389
- }
390
- // Compile the production class
391
- return $System.OBJ.Compile(produtionClassName,"k-d")
392
- }
393
-
394
- /// Export a production to an XML string
395
- ClassMethod ExportProduction(pProductionName As %String) As %String
396
- {
397
- Set sc = $$$OK
398
- set xdata = ""
399
- // Check if the XData Definition exists
400
- If (##Class(%Dictionary.XDataDefinition).%ExistsId(pProductionName_"||ProductionDefinition"))
401
- {
402
- // Open the XData Definition
403
- Set xdataDefinition = ##Class(%Dictionary.XDataDefinition).%OpenId(pProductionName_"||ProductionDefinition")
404
- Set xdata = xdataDefinition.Data
405
- }
406
- Else
407
- {
408
- $$$ThrowOnError($System.Status.Error(5001, "Production does not exist."))
409
- }
410
- Return xdata
411
- }
412
-
413
- }
iris/iris_site.py DELETED
@@ -1,13 +0,0 @@
1
- import sys
2
- from os import sep as __os_sep
3
- from site import getsitepackages as __sitegetsitepackages
4
-
5
- #ubuntu needs dist-packages for pandas to be able to be imported
6
- #ubu 18 doesnt have os.sep in sys.executable
7
- def set_site_path(platform_name):
8
- if "ubuntu" in platform_name:
9
- if __os_sep in sys.executable:
10
- __siteprefixes = [__os_sep + sys.executable.split(__os_sep)[1]]
11
- else:
12
- __siteprefixes = ['/usr']
13
- sys.path = sys.path + __sitegetsitepackages(__siteprefixes)
iris/irisbuiltins.py DELETED
@@ -1,97 +0,0 @@
1
- from collections import abc
2
-
3
- #
4
- # IRIS Exceptions
5
- #
6
- class SQLError(Exception):
7
- """Error raised on an invalid IRIS SQL statement
8
-
9
- Attributes:
10
- sqlcode -- IRIS SQL error code
11
- message -- Error description
12
- statement -- Statement that failed
13
- """
14
-
15
- def __init__(self,sqlcode,message,statement=None):
16
- self.sqlcode = sqlcode
17
- self.message = message
18
- self.statement = statement
19
- super().__init__(self.message)
20
-
21
- #
22
- # Helper to raise a properly formatted AttributeError when we decide that
23
- # we don't want to handle a last-chance method.
24
- #
25
- def _no_such_method(target,method):
26
- raise AttributeError(f"'{target.__class__.__name__}' has no attribute '{method}'")
27
-
28
- #
29
- # irisbuiltins: Implements impedence matching methods for projecting IRIS behavior
30
- # over Python objects.
31
- #
32
- class irisbuiltins:
33
-
34
- #
35
- # Common functions for mapping Python collection behavior to IRIS behavior
36
- #
37
- # NOTE: With Sequences, the indicies are 0 based for Python and 1 based
38
- # for IRIS.
39
- #
40
-
41
- def Count(self):
42
- if isinstance(self,abc.Mapping) or isinstance(self,abc.Sequence):
43
- return len(self)
44
- _no_such_method(self,"Count")
45
-
46
- def GetAt(self,index):
47
- if isinstance(self,abc.Mapping):
48
- return self[index]
49
- if isinstance(self,abc.Sequence):
50
- return self[index-1]
51
- _no_such_method(self,"GetAt")
52
-
53
- def SetAt(self,value,index):
54
- if isinstance(self,abc.Mapping):
55
- self[index] = value
56
- return
57
- if isinstance(self,abc.Sequence):
58
- self[index-1] = value
59
- return
60
- _no_such_method(self,"SetAt")
61
-
62
- def Insert(self,value):
63
- if isinstance(self,abc.Sequence):
64
- self.append(value)
65
- return
66
- _no_such_method(self,"Insert")
67
-
68
- def InsertAt(self,value,index):
69
- if isinstance(self,abc.Sequence):
70
- self.insert(index-1,value)
71
- return
72
- _no_such_method(self,"InsertAt")
73
-
74
- def Clear(self):
75
- if isinstance(self,abc.Mapping) or isinstance(self,abc.Sequence):
76
- self.clear()
77
- return
78
- _no_such_method(self,"Clear")
79
-
80
- def IsDefined(self,key):
81
- if isinstance(self,abc.Mapping):
82
- return (key in self)
83
- _no_such_method(self,"IsDefined")
84
-
85
- def Find(self,value):
86
- if isinstance(self,abc.Sequence):
87
- return self.index(value)+1
88
- if isinstance(self,abc.Mapping):
89
- for (k,v) in self.items():
90
- if v == value:
91
- return k
92
- return None;
93
- _no_such_method(self,"Find")
94
-
95
- #
96
- # End-of-file
97
- #