iris-pex-embedded-python 2.3.20__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.

@@ -1,4 +1,9 @@
1
1
  class _IRISOREF(object):
2
-
3
2
  def __init__(self, oref):
4
3
  self._oref = oref
4
+
5
+ def __str__(self) -> str:
6
+ return self._oref
7
+
8
+ def __repr__(self) -> str:
9
+ return f"<IRISOREF ${self._oref}>"
@@ -19,6 +19,7 @@ from intersystems_iris.dbapi._IRISStream import (
19
19
  IRISStream,
20
20
  IRISBinaryStream,
21
21
  )
22
+ from intersystems_iris._IRISOREF import _IRISOREF
22
23
  from ._SQLType import SQLType
23
24
 
24
25
  from .._IRISNative import connect as native_connect
@@ -648,7 +649,11 @@ class _BaseCursor:
648
649
 
649
650
  def _update404(self):
650
651
  with self._connection._lock:
652
+ # self._reset_cached_info()
651
653
  self._validate_parameters()
654
+ # self._prepare()
655
+ # self._validate_prepared_parameters()
656
+ # self._prepared_update_execute()
652
657
  self._send_direct_update_request()
653
658
 
654
659
  # api properties and methods
@@ -752,6 +757,12 @@ class Cursor(_BaseCursor):
752
757
  return True
753
758
  else:
754
759
  return False
760
+
761
+ def _reset_cached_info(self):
762
+ if not self._connection._preparedCache or not hasattr(self._connection._preparedCache, "__iter__"):
763
+ return
764
+ if self._parsed_statement in self._connection._preparedCache:
765
+ del self._connection._preparedCache[self._parsed_statement]
755
766
 
756
767
  def _prepare_cached(self, cached_statement):
757
768
  self._statement_id = cached_statement.statement_id
@@ -1181,11 +1192,15 @@ class Cursor(_BaseCursor):
1181
1192
  self.params[pi] = stream_oref
1182
1193
 
1183
1194
  def _send_stream(self, param_type, value):
1195
+ if isinstance(value, _IRISOREF):
1196
+ return value
1184
1197
  if not isinstance(value, str) and not isinstance(value, bytes):
1185
1198
  raise Exception(f"Invalid value type for stream, got {type(value).__name__}, expected str or bytes")
1186
1199
  stream_oref = None
1187
1200
  offset = 0
1188
1201
  full_size = len(value)
1202
+ if full_size < 3 * 1024 * 1024:
1203
+ return value
1189
1204
  with self._connection._lock:
1190
1205
  while True:
1191
1206
  size = full_size
@@ -1216,7 +1231,7 @@ class Cursor(_BaseCursor):
1216
1231
  self._in_message._read_message_sql(sequence_number, self._statement_id, 0)
1217
1232
  stream_oref = self._sqlcode = self._in_message.wire._get()
1218
1233
 
1219
- return stream_oref
1234
+ return _IRISOREF(stream_oref)
1220
1235
 
1221
1236
  def _prepared_update_execute(self):
1222
1237
  self._update_streams()
@@ -2,6 +2,7 @@ import datetime
2
2
  import decimal
3
3
  import enum
4
4
  import intersystems_iris.dbapi._Descriptor
5
+ from intersystems_iris._IRISOREF import _IRISOREF
5
6
 
6
7
 
7
8
  class ParameterMode(enum.IntEnum):
@@ -110,6 +111,7 @@ class _Parameter(intersystems_iris.dbapi._Descriptor._Descriptor):
110
111
  int: lambda v: v,
111
112
  float: lambda v: v,
112
113
  decimal.Decimal: lambda v: v,
114
+ _IRISOREF: lambda v: str(v),
113
115
  }
114
116
  func = None
115
117
  if issubclass(type(self.__value), enum.Enum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iris-pex-embedded-python
3
- Version: 2.3.20
3
+ Version: 2.3.21b1
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -43,8 +43,8 @@ Classifier: Programming Language :: Python :: 3.11
43
43
  Classifier: Topic :: Utilities
44
44
  Description-Content-Type: text/markdown
45
45
  License-File: LICENSE
46
- Requires-Dist: dacite (>=1.6.0)
47
- Requires-Dist: xmltodict (>=0.12.0)
46
+ Requires-Dist: dacite >=1.6.0
47
+ Requires-Dist: xmltodict >=0.12.0
48
48
 
49
49
  # 1. interoperability-embedded-python
50
50
 
@@ -54,7 +54,7 @@ intersystems_iris/_IRISGlobalNodeView.py,sha256=0yw9z_mpSLk2m3we5z_vKSjnEdmKfZb1
54
54
  intersystems_iris/_IRISIterator.py,sha256=m1n_fRdoO8YPfDi7l-JvJTqdJuxq_kxC60aMxkxLJUE,6906
55
55
  intersystems_iris/_IRISList.py,sha256=G_gMRqoP5DNiKwJYa6effkrKCwmFjxFTiEB104cdzow,10247
56
56
  intersystems_iris/_IRISNative.py,sha256=aNMLADSzRwuKXomwrbB7AC6KaR6-R9fHYStAJLv0V9E,6756
57
- intersystems_iris/_IRISOREF.py,sha256=WRRJV-_9QlOrzc_8gG6sfItfks4JdQy3N0aCcYXdpkQ,82
57
+ intersystems_iris/_IRISOREF.py,sha256=tpsD0QeoqfESY-OQY0Nbm3MGD0zekCYFJ7la5TdZMyQ,213
58
58
  intersystems_iris/_IRISObject.py,sha256=ZjdpQdy-NP0sXFdxQix58dW7kCo4ck-L9AKo9xRRoPU,14456
59
59
  intersystems_iris/_IRISReference.py,sha256=pkDAYgxkOmDf8fpRpQf8w-12EYZ1lgqXmkRYuYQXvIo,4905
60
60
  intersystems_iris/_InStream.py,sha256=6g4HdDoQ0MFub8Yn-Git8DkJNEoyyAtAhrvjkUdDA7I,6643
@@ -71,11 +71,11 @@ intersystems_iris/_SharedMemorySocket.py,sha256=2iUaS1FdJNSCUEaE-VT0O_dxF6NRwqZS
71
71
  intersystems_iris/__init__.py,sha256=Tk1tD28LwvF6X3yXQsJFLE1Bc-PR3gUJWcX5UnNYOdY,1773
72
72
  intersystems_iris/__main__.py,sha256=rCtINTfJcADMAsw1ja-MEO7Q-XekrWthYowzWV8xGIQ,218
73
73
  intersystems_iris/dbapi/_Column.py,sha256=VCLHLXs3wuGcUa9w_qy7HBFsuGvhmmI3kGYBagQg59U,2535
74
- intersystems_iris/dbapi/_DBAPI.py,sha256=GR09iiA59NYfR4bB8YhdEwzZBQgyZaeGjqmmhUtoMJ0,101649
74
+ intersystems_iris/dbapi/_DBAPI.py,sha256=eV9PA3T1dlMpKY_H2SAarcbNjOujpprKe99qHqtaUPg,102320
75
75
  intersystems_iris/dbapi/_Descriptor.py,sha256=IjyITxvjygDrhpk-0lGhdqQPh91SG6nTb1vi-AqyJNI,1391
76
76
  intersystems_iris/dbapi/_IRISStream.py,sha256=dGJntWo4HXgM1nUHZl2hA4xHkBFEU2xkoEplVDFWhnA,2115
77
77
  intersystems_iris/dbapi/_Message.py,sha256=jpLG3HZElqp981iNPFW8UNRO3NbHf6poEv6yywX0Ssw,4076
78
- intersystems_iris/dbapi/_Parameter.py,sha256=PrfQQnfBf1R1M3P9oUrus6T5PROg35A8LO-RRFo6J1I,5202
78
+ intersystems_iris/dbapi/_Parameter.py,sha256=lvPlQkoLlyEjg5J_a9t2I_6vRDkAav6kN1fGyukH4DY,5293
79
79
  intersystems_iris/dbapi/_ParameterCollection.py,sha256=kcgNiGv2nH5AwuA6LlPpM4dWqhSqRyD3VtwqHqDGRGU,5541
80
80
  intersystems_iris/dbapi/_ResultSetRow.py,sha256=tNKCv5P8XhP9zzdPpBGiXYHLKOScITTBGSqtui1TAM0,12910
81
81
  intersystems_iris/dbapi/_SQLType.py,sha256=IlDacXwQzUMWaJ02Zsu2bUfvUC3-5mBx-m6mE0Yp7ts,557
@@ -101,14 +101,11 @@ intersystems_iris/pex/_OutboundAdapter.py,sha256=ao2Ubbta2DcrQGdzDUD_j1Zsk8bvUfc
101
101
  intersystems_iris/pex/__init__.py,sha256=l_I1dpnluWawbFrGMDC0GLHpuHwjbpd-nho8otFX6TE,1379
102
102
  iris/__init__.py,sha256=VyBPMqjkad0JPoza38YZbBeLHM7jZUMS90t8KKEIW94,1045
103
103
  iris/iris_ipm.py,sha256=Q0jcNItjywlqOPZr0hgdTFSeLPNEmB-tcICOI_cXnaY,790
104
- iris/iris_site.py,sha256=K05T41T2dEZcoN45sFgIMNNeH2tandxgcJWjVEQzbno,501
105
- iris/irisbuiltins.py,sha256=0xMYrnTJ8q3WsQ8CXlKHYnfAVTIkO-PXDpdQ_SvHVpI,2687
106
- iris/irisloader.py,sha256=2ZLM0FlYNStTiZrXuvDcO-V_XZVgmB3R8vesmaqMqYA,4808
107
104
  irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
108
105
  irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
109
- iris_pex_embedded_python-2.3.20.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
110
- iris_pex_embedded_python-2.3.20.dist-info/METADATA,sha256=dII82Ovi75D_EjFyrACKWRWg-XA5EidkXLq9y1afJ30,49684
111
- iris_pex_embedded_python-2.3.20.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
112
- iris_pex_embedded_python-2.3.20.dist-info/entry_points.txt,sha256=atkAtHoIuwXcZ0jl5gwof0l__ru_lt8WhVYk6HxYf70,47
113
- iris_pex_embedded_python-2.3.20.dist-info/top_level.txt,sha256=Tl4ZHgeNefaZW2Oug30vSldhD-tWzixsIfzASBrZ9ps,43
114
- iris_pex_embedded_python-2.3.20.dist-info/RECORD,,
106
+ iris_pex_embedded_python-2.3.21b1.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
107
+ iris_pex_embedded_python-2.3.21b1.dist-info/METADATA,sha256=4meJjBOl_n1yBvpMlYK2LWxLs6KEpgIBIkP5eSJ6jqk,49682
108
+ iris_pex_embedded_python-2.3.21b1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
109
+ iris_pex_embedded_python-2.3.21b1.dist-info/entry_points.txt,sha256=atkAtHoIuwXcZ0jl5gwof0l__ru_lt8WhVYk6HxYf70,47
110
+ iris_pex_embedded_python-2.3.21b1.dist-info/top_level.txt,sha256=Tl4ZHgeNefaZW2Oug30vSldhD-tWzixsIfzASBrZ9ps,43
111
+ iris_pex_embedded_python-2.3.21b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
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
- #
iris/irisloader.py DELETED
@@ -1,199 +0,0 @@
1
- from importlib.abc import MetaPathFinder
2
- from importlib.abc import Loader
3
- import importlib
4
- from types import ModuleType
5
- import math
6
- import marshal
7
- import sys
8
- import iris
9
-
10
- sources=iris.gref("^ROUTINE")
11
- binaries=iris.gref("^rPYC")
12
- MAX_STRING_SIZE=3800000
13
-
14
- def getFromDirectory(directory, path):
15
- level=len(path)
16
- if level == 1:
17
- return directory[path[0]]
18
- elif level == 2:
19
- return directory[path[0],path[1]]
20
- elif level == 3:
21
- return directory[path[0],path[1],path[2]]
22
- elif level == 4:
23
- return directory[path[0],path[1],path[2],path[3]]
24
- elif level == 5:
25
- return directory[path[0],path[1],path[2],path[3],path[4]]
26
- elif level == 6:
27
- return directory[path[0],path[1],path[2],path[3],path[4],path[5]]
28
- elif level == 7:
29
- return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6]]
30
- elif level == 8:
31
- return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6],path[7]]
32
- elif level == 9:
33
- return directory[path[0],path[1],path[2],path[3],path[4],path[5],path[6],path[7],path[8]]
34
-
35
- #name is name of rtn with .py
36
- def getSourceCode(name):
37
- currentP = [name] + [0,0]
38
- length = getFromDirectory(sources, currentP)
39
- currentP.pop()
40
- if not length or length == 0:
41
- return None
42
- code = ""
43
- for i in range(1,int(length)+1):
44
- currentP.append(i)
45
- code += getFromDirectory(sources, currentP)
46
- code += "\r\n"
47
- currentP.pop()
48
- return code
49
-
50
- def getCodeFromBinary(name):
51
- length = binaries.get([name],0)
52
- if (length < 1):
53
- return None
54
- codeBytes = binaries.getAsBytes([name,1])
55
- for i in range(1,int(length)):
56
- codeBytes += binaries.getAsBytes([name,i+1])
57
- return marshal.loads(codeBytes)
58
-
59
- # def checkCode(directory, path):
60
- # currentP = [p for p in path] + [0,0]
61
- # length = getFromDirectory(directory, currentP)
62
- # currentP.pop()
63
- # if not length or length == 0:
64
- # return None
65
- # return length
66
-
67
- def checkCode(name):
68
- #code exist for module
69
-
70
- if binaries.get([name],0) > 0:
71
- return True
72
- sub = binaries.order([name+"."])
73
- #there exists some subpackage
74
- if (sub and sub[:len(name)] == name):
75
- return True
76
- return False
77
-
78
- def compileCode(name):
79
- path = name.split(".")
80
- classname = path[-1]
81
- code = getSourceCode(name+".py")
82
- if code:
83
- codeobj = compile(code,classname,"exec")
84
- compiledpython = marshal.dumps(codeobj)
85
-
86
- #store in database
87
- length=len(compiledpython)
88
- chunks = math.ceil(length / MAX_STRING_SIZE)
89
- binaries[name] = chunks
90
- for i in range(chunks):
91
- binaries[name,i+1] = compiledpython[i*MAX_STRING_SIZE:min(MAX_STRING_SIZE*(i+1),length)]
92
-
93
- #delete old version of this module
94
- # if name in sys.modules:
95
- # del sys.modules[name]
96
- return 1
97
- return 0
98
-
99
- #
100
- # Impedence matcher prototype
101
- #
102
-
103
- def mapping_GetAt(self,key):
104
- return self[key]
105
-
106
- def mapping_SetAt(self,value,key):
107
- self[key] = value
108
-
109
- def sequence_GetAt(self,index):
110
- return self[index-1]
111
-
112
- def sequence_SetAt(self,value,index):
113
- self[index-1] = value
114
-
115
- def materialize(obj):
116
- if isinstance(obj,collections.abc.Mapping):
117
- obj.Count = obj.__len__
118
- obj.GetAt = mapping_GetAt
119
- obj.SetAt = mapping_SetAt
120
- return True
121
- if isinstance(obj,collections.abc.Sequence):
122
- obj.Count = obj.__len__
123
- obj.GetAt = sequence_GetAt
124
- obj.SetAt = sequence_SetAt
125
- return True
126
- return False
127
-
128
- class MyLoader(Loader):
129
- def create_module(self,spec):
130
-
131
- module = ModuleType(spec.name)
132
- module.__spec__=spec
133
- module.__loader__ = self
134
- module.__path__ = spec.__path__
135
- return module
136
-
137
- def exec_module(self, module):
138
- #path = [p+".py" for p in module.__path__]
139
- name = ""
140
- code = None
141
- for n in module.__path__:
142
- name += n
143
- name += "."
144
- if name:
145
- code = getCodeFromBinary(name[:len(name)-1])
146
-
147
- #this is a class or has code by itself
148
- if code:
149
- #print(marshal.loads(bytes(code,"utf-8")))
150
- #print(type(code))
151
- exec(code,module.__dict__)
152
- #this is a module
153
- # ismodule = getFromDirectory(path+["catalog"])
154
- # if ismodule:
155
- # for s in ismodule.split(","):
156
- # code = getFromDirectory(path+[s])
157
- # if code:
158
- # exec(code,module.__dict__)
159
-
160
-
161
- class MyFinder(MetaPathFinder):
162
- def __init__(self):
163
- return
164
-
165
- def find_spec(self,fullname,path,target=None):
166
-
167
- #print("importing1: "+fullname)
168
- ans = fullname.split(".")
169
- currentName=ans[-1]
170
- for i in range(len(ans)):
171
- ans[i] += ".py"
172
- #validate existance from globals
173
- #this might be wrong
174
- if not checkCode(fullname):
175
- return None
176
- spec = importlib.machinery.ModuleSpec(fullname, MyLoader())
177
- #update path
178
- if path:
179
- spec.__path__ = path + [currentName]
180
- else:
181
- spec.__path__ = [currentName]
182
- # set parent
183
- if len(ans) == 1:
184
- if path:
185
- spec.__parent__=path[-1]
186
- else:
187
- spec.__parent__= None
188
- else:
189
- spec.__parent__=ans[-1]
190
-
191
- return spec
192
-
193
-
194
- sys.meta_path.append(MyFinder())
195
- #del sys
196
- #test:
197
- #s imp = ##class(%SYS.Python).Import("customImport")
198
- #s xx = ##class(%SYS.Python).Import("User")
199
-