numbox 0.2.2__py3-none-any.whl → 0.2.3__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.
- numbox/__init__.py +1 -1
- numbox/core/work/work.py +12 -9
- {numbox-0.2.2.dist-info → numbox-0.2.3.dist-info}/METADATA +1 -1
- {numbox-0.2.2.dist-info → numbox-0.2.3.dist-info}/RECORD +7 -7
- {numbox-0.2.2.dist-info → numbox-0.2.3.dist-info}/LICENSE +0 -0
- {numbox-0.2.2.dist-info → numbox-0.2.3.dist-info}/WHEEL +0 -0
- {numbox-0.2.2.dist-info → numbox-0.2.3.dist-info}/top_level.txt +0 -0
numbox/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.2.
|
|
1
|
+
__version__ = '0.2.3'
|
numbox/core/work/work.py
CHANGED
|
@@ -3,11 +3,12 @@ from io import StringIO
|
|
|
3
3
|
from numba import njit
|
|
4
4
|
from numba.core.errors import NumbaError
|
|
5
5
|
from numba.core.types import (
|
|
6
|
-
DictType, FunctionType,
|
|
6
|
+
boolean, DictType, FunctionType, Literal, NoneType, Tuple, unicode_type, UnicodeType
|
|
7
7
|
)
|
|
8
8
|
from numba.core.typing.context import Context
|
|
9
9
|
from numba.experimental.structref import define_boxing, new
|
|
10
10
|
from numba.extending import intrinsic, overload, overload_method
|
|
11
|
+
from numba.typed.typeddict import Dict
|
|
11
12
|
from numba.typed.typedlist import List
|
|
12
13
|
|
|
13
14
|
from numbox.core.any.erased_type import ErasedType
|
|
@@ -291,12 +292,14 @@ def _make_combine_code(num_sources):
|
|
|
291
292
|
for source_ind_ in range(num_sources):
|
|
292
293
|
code_txt.write(_make_source_getter(source_ind_))
|
|
293
294
|
code_txt.write("""
|
|
294
|
-
def _combine_(work_, data_,
|
|
295
|
-
if
|
|
296
|
-
|
|
295
|
+
def _combine_(work_, data_, harvested_=None):
|
|
296
|
+
if harvested_ is None:
|
|
297
|
+
harvested_ = Dict.empty(key_type=unicode_type, value_type=boolean)
|
|
298
|
+
if len(harvested_) == len(data_):
|
|
299
|
+
return
|
|
297
300
|
work_name = work_.name
|
|
298
301
|
if work_name in data_:
|
|
299
|
-
|
|
302
|
+
harvested_[work_name] = True
|
|
300
303
|
data_[work_name].reset(work_.data)""")
|
|
301
304
|
if num_sources > 0:
|
|
302
305
|
code_txt.write("""
|
|
@@ -304,10 +307,10 @@ def _combine_(work_, data_, ct_=0):
|
|
|
304
307
|
for source_ind_ in range(num_sources):
|
|
305
308
|
code_txt.write(f"""
|
|
306
309
|
source_{source_ind_} = _get_source_{source_ind_}(sources)
|
|
307
|
-
|
|
310
|
+
source_{source_ind_}.combine(data_, harvested_)
|
|
308
311
|
""")
|
|
309
312
|
code_txt.write("""
|
|
310
|
-
return
|
|
313
|
+
return
|
|
311
314
|
""")
|
|
312
315
|
return code_txt.getvalue()
|
|
313
316
|
|
|
@@ -316,7 +319,7 @@ _combine_registry = {}
|
|
|
316
319
|
|
|
317
320
|
|
|
318
321
|
@overload_method(WorkTypeClass, "combine", strict=False, jit_options=default_jit_options)
|
|
319
|
-
def ol_combine(work_ty, data_ty: DictType,
|
|
322
|
+
def ol_combine(work_ty, data_ty: DictType, harvested_ty=NoneType):
|
|
320
323
|
""" Harvest nodes data from the graph with the root node `work`.
|
|
321
324
|
`data` is provided as dictionary mapping node name to `Any` type
|
|
322
325
|
containing erased payload `p` to be reset to `data`. """
|
|
@@ -325,7 +328,7 @@ def ol_combine(work_ty, data_ty: DictType, ct_ty=Integer):
|
|
|
325
328
|
_combine = _combine_registry.get(num_sources, None)
|
|
326
329
|
if _combine is None:
|
|
327
330
|
code_txt = _make_combine_code(num_sources)
|
|
328
|
-
ns = getmodule(_file_anchor).__dict__
|
|
331
|
+
ns = {**getmodule(_file_anchor).__dict__, **{"boolean": boolean, "Dict": Dict}}
|
|
329
332
|
code = compile(code_txt, getfile(_file_anchor), mode="exec")
|
|
330
333
|
exec(code, ns)
|
|
331
334
|
_combine = ns["_combine_"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
numbox/__init__.py,sha256=
|
|
1
|
+
numbox/__init__.py,sha256=XtWUl6HPylv5jZLd2KkgtPptuzuda93kC2REmOrF-Cs,22
|
|
2
2
|
numbox/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
numbox/core/configurations.py,sha256=0bCmxXL-QMwtvyIDhpXLeT-1KJMf_QpH0wLuEvYLGxQ,68
|
|
4
4
|
numbox/core/any/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -22,7 +22,7 @@ numbox/core/work/lowlevel_work_utils.py,sha256=TgRRcNfks0oaOXGXXr3ptafd_Xv_lpmH8
|
|
|
22
22
|
numbox/core/work/node.py,sha256=CMolyoRQjG2A-pTQqZQ0kxKOYTKipWRC0mu8RWHuTUI,5096
|
|
23
23
|
numbox/core/work/node_base.py,sha256=uI7asM2itQcHuOByXyJtqvrd4ovW6EXDRdHYp3JVHQ0,998
|
|
24
24
|
numbox/core/work/print_tree.py,sha256=y2u7xmbHvpcA57y8PrGSqOunLNCqhgNXdVtXHqvy1M0,2340
|
|
25
|
-
numbox/core/work/work.py,sha256=
|
|
25
|
+
numbox/core/work/work.py,sha256=oC71F2y-NkIF9Ox63trlv061nYBxla6R-F2Nj-7NXI4,14595
|
|
26
26
|
numbox/core/work/work_utils.py,sha256=3q_nnBdzuxWWcdFpbRL2H0T9ZNkUgx1J1uhiZkX3YG4,1039
|
|
27
27
|
numbox/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
numbox/utils/highlevel.py,sha256=gXYzLsFPKHQfGqaz-Z4DWcCQddv0dS6SKwIsM-_xjYg,1487
|
|
@@ -30,8 +30,8 @@ numbox/utils/lowlevel.py,sha256=ACpf8_HyOIsobPlZ31bapkEyuCsV5dojW3AFrcKykrw,1071
|
|
|
30
30
|
numbox/utils/meminfo.py,sha256=ykFi8Vt0WcHI3ztgMwvpn6NqaflDSQGL8tjI01jrzm0,1759
|
|
31
31
|
numbox/utils/timer.py,sha256=KkAkWOHQ72WtPjyiAzt_tF1q0DcOnCDkITTb85DvkUM,553
|
|
32
32
|
numbox/utils/void_type.py,sha256=IkZsjNeAIShYJtvWbvERdHnl_mbF1rCRWiM3gp6II8U,404
|
|
33
|
-
numbox-0.2.
|
|
34
|
-
numbox-0.2.
|
|
35
|
-
numbox-0.2.
|
|
36
|
-
numbox-0.2.
|
|
37
|
-
numbox-0.2.
|
|
33
|
+
numbox-0.2.3.dist-info/LICENSE,sha256=YYgNvjH_p6-1NsdrIqGJnr1GUbZzA_8DxsP6vVfM6nY,1446
|
|
34
|
+
numbox-0.2.3.dist-info/METADATA,sha256=e7MF4nI2ntAqX8CGKWS1FvUiEswd2rtRW-rysf4WWJc,2792
|
|
35
|
+
numbox-0.2.3.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
36
|
+
numbox-0.2.3.dist-info/top_level.txt,sha256=A67jOkfqidCSYYm6ifjN_WZyIiR1B27fjxv6nNbPvjc,7
|
|
37
|
+
numbox-0.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|