tinycwrap 0.0.4__tar.gz → 0.0.5__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.
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/PKG-INFO +1 -1
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/pyproject.toml +1 -1
- tinycwrap-0.0.4/tests/test_examples.py → tinycwrap-0.0.5/tests/test_kernels.py +3 -3
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tests/test_path.py +4 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap/__init__.py +1 -1
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap/cmodule.py +25 -19
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap.egg-info/PKG-INFO +1 -1
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap.egg-info/SOURCES.txt +1 -1
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/README.md +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/setup.cfg +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tests/test_geom.py +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap/parsing.py +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap.egg-info/dependency_links.txt +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap.egg-info/requires.txt +0 -0
- {tinycwrap-0.0.4 → tinycwrap-0.0.5}/tinycwrap.egg-info/top_level.txt +0 -0
|
@@ -14,9 +14,9 @@ def cm():
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def test_dot(cm):
|
|
17
|
-
x = np.
|
|
18
|
-
y = np.
|
|
19
|
-
assert cm.dot(x, y, len_x=len(x)) == np.
|
|
17
|
+
x = np.array([1.0, 2.0, 3.0], dtype=np.float64)
|
|
18
|
+
y = np.array([4.0, 5.0, 6.0], dtype=np.float64)
|
|
19
|
+
assert cm.dot(x, y, len_x=len(x)) == np.dot(x, y)
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def test_scale_auto_output(cm):
|
|
@@ -52,3 +52,7 @@ def test_repr_pointer_array(cp):
|
|
|
52
52
|
repr_str = repr(path)
|
|
53
53
|
assert "segments=<segments* 0x" in repr_str
|
|
54
54
|
assert "len_segments=2" in repr_str
|
|
55
|
+
|
|
56
|
+
def test_post_contract(cp):
|
|
57
|
+
segments, len_segments = cp.geom2d_segments_from_rectellipse(1,2,3,4)
|
|
58
|
+
assert segments.shape == (4,)
|
|
@@ -381,24 +381,22 @@ class CModule:
|
|
|
381
381
|
fspec.doc = doc
|
|
382
382
|
contracts = []
|
|
383
383
|
for line in doc.splitlines():
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
mlen = re.match(r"
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
expr = mlen.group(2).strip()
|
|
401
|
-
contracts.append((target, expr, is_post))
|
|
384
|
+
m_contract = re.search(r"(post-)?contract:\s*(.*)", line, flags=re.IGNORECASE)
|
|
385
|
+
if not m_contract:
|
|
386
|
+
continue
|
|
387
|
+
is_post = m_contract.group(1) is not None
|
|
388
|
+
after = m_contract.group(2)
|
|
389
|
+
for part in after.split(";"):
|
|
390
|
+
part = part.strip()
|
|
391
|
+
if not part:
|
|
392
|
+
continue
|
|
393
|
+
mlen = re.match(r"len\((\w+)\)\s*=\s*(.+)", part)
|
|
394
|
+
if not mlen:
|
|
395
|
+
mlen = re.match(r"(\w+)\s*=\s*(.+)", part)
|
|
396
|
+
if mlen:
|
|
397
|
+
target = mlen.group(1)
|
|
398
|
+
expr = mlen.group(2).strip()
|
|
399
|
+
contracts.append((target, expr, is_post))
|
|
402
400
|
fspec.contracts = contracts or None
|
|
403
401
|
|
|
404
402
|
def _mark_length_params_from_contracts(self):
|
|
@@ -496,7 +494,15 @@ class CModule:
|
|
|
496
494
|
target_dtype = _struct_dtypes.get(f.base_type)
|
|
497
495
|
provided = kwargs.get(f.name)
|
|
498
496
|
if provided is not None and target_dtype is not None:
|
|
499
|
-
|
|
497
|
+
try:
|
|
498
|
+
arr = np.ascontiguousarray(provided, dtype=target_dtype)
|
|
499
|
+
except ValueError:
|
|
500
|
+
if hasattr(provided, "_data"):
|
|
501
|
+
arr = np.ascontiguousarray(provided._data, dtype=target_dtype)
|
|
502
|
+
elif isinstance(provided, (list, tuple)) and provided and hasattr(provided[0], "_data"):
|
|
503
|
+
arr = np.ascontiguousarray([p._data for p in provided], dtype=target_dtype)
|
|
504
|
+
else:
|
|
505
|
+
raise
|
|
500
506
|
children[f.name] = arr
|
|
501
507
|
data[f.name] = arr.ctypes.data
|
|
502
508
|
if len_field in dtype.names and len_field not in kwargs:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|