xobjects 0.4.0__tar.gz → 0.4.2__tar.gz
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.
- {xobjects-0.4.0/xobjects.egg-info → xobjects-0.4.2}/PKG-INFO +1 -1
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/__init__.py +1 -1
- xobjects-0.4.2/xobjects/_version.py +1 -0
- xobjects-0.4.2/xobjects/general.py +33 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/hybrid_class.py +7 -3
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/test_helpers.py +0 -8
- {xobjects-0.4.0 → xobjects-0.4.2/xobjects.egg-info}/PKG-INFO +1 -1
- xobjects-0.4.0/xobjects/_version.py +0 -1
- xobjects-0.4.0/xobjects/general.py +0 -9
- {xobjects-0.4.0 → xobjects-0.4.2}/LICENSE +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/pyproject.toml +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/setup.cfg +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/setup.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_align.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_array.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_buffer.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_capi.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_chunk.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_context_opencl.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_hybrid_class.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_kernel.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_linked_array.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_nplike_arrays.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_ref.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_scalars.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_shared_memory.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_strides.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_string.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_struct.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_to_json.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_typeutils.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/tests/test_unionref.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/_patch_pyopencl_array.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/array.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/capi.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/context.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/context_cpu.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/context_cupy.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/context_pyopencl.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/linkedarray.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/ref.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/scalar.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/specialize_source.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/string.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/struct.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/typeutils.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects/union.py +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects.egg-info/SOURCES.txt +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects.egg-info/dependency_links.txt +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects.egg-info/requires.txt +0 -0
- {xobjects-0.4.0 → xobjects-0.4.2}/xobjects.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.2"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# copyright ################################# #
|
|
2
|
+
# This file is part of the Xobjects Package. #
|
|
3
|
+
# Copyright (c) CERN, 2024. #
|
|
4
|
+
# ########################################### #
|
|
5
|
+
from numpy.testing import assert_allclose as np_assert_allclose
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Print:
|
|
10
|
+
suppress = False
|
|
11
|
+
|
|
12
|
+
def __call__(self, *args, **kwargs):
|
|
13
|
+
if not self.suppress:
|
|
14
|
+
print(*args, **kwargs)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
_print = Print()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def assert_allclose(a, b, rtol=1e-7, atol=1e-7):
|
|
21
|
+
if hasattr(a, "get"):
|
|
22
|
+
a = a.get()
|
|
23
|
+
if hasattr(b, "get"):
|
|
24
|
+
b = b.get()
|
|
25
|
+
try:
|
|
26
|
+
a = np.squeeze(a)
|
|
27
|
+
except:
|
|
28
|
+
pass
|
|
29
|
+
try:
|
|
30
|
+
b = np.squeeze(b)
|
|
31
|
+
except:
|
|
32
|
+
pass
|
|
33
|
+
np_assert_allclose(a, b, rtol=rtol, atol=atol)
|
|
@@ -46,8 +46,11 @@ class _FieldOfDressed:
|
|
|
46
46
|
# in the latter case reference mechanism is used)
|
|
47
47
|
if not (
|
|
48
48
|
container._xobject._buffer is value._xobject._buffer
|
|
49
|
-
and (
|
|
50
|
-
getattr(container._xobject, self.name)
|
|
49
|
+
and (
|
|
50
|
+
getattr(container._xobject, self.name) is not None
|
|
51
|
+
and getattr(container._xobject, self.name)._offset
|
|
52
|
+
== value._xobject._offset
|
|
53
|
+
)
|
|
51
54
|
):
|
|
52
55
|
setattr(container._xobject, self.name, value._xobject)
|
|
53
56
|
|
|
@@ -324,7 +327,8 @@ class HybridClass(metaclass=MetaHybridClass):
|
|
|
324
327
|
|
|
325
328
|
@classmethod
|
|
326
329
|
def from_dict(cls, dct, _context=None, _buffer=None, _offset=None):
|
|
327
|
-
return HybridClass._static_from_dict(
|
|
330
|
+
return HybridClass._static_from_dict(
|
|
331
|
+
cls,
|
|
328
332
|
dct,
|
|
329
333
|
_context=_context,
|
|
330
334
|
_buffer=_buffer,
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
from functools import wraps
|
|
7
7
|
from typing import Callable, Iterable, Union
|
|
8
|
-
from numpy.testing import assert_allclose as np_assert_allclose
|
|
9
8
|
|
|
10
9
|
import pytest
|
|
11
10
|
|
|
@@ -84,10 +83,3 @@ def requires_context(context_name: str):
|
|
|
84
83
|
return lambda test_function: test_function
|
|
85
84
|
|
|
86
85
|
return pytest.mark.skip(f"{context_name} is unavailable on this platform.")
|
|
87
|
-
|
|
88
|
-
def assert_allclose(a, b, rtol=1e-7, atol=1e-7):
|
|
89
|
-
if hasattr(a, 'get'):
|
|
90
|
-
a = a.get()
|
|
91
|
-
if hasattr(b, 'get'):
|
|
92
|
-
b = b.get()
|
|
93
|
-
np_assert_allclose(a, b, rtol=rtol, atol=atol)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|