pyopencl 2025.2.6__cp311-cp311-musllinux_1_2_x86_64.whl → 2025.2.7__cp311-cp311-musllinux_1_2_x86_64.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 pyopencl might be problematic. Click here for more details.

pyopencl/array.py CHANGED
@@ -40,6 +40,7 @@ from typing import (
40
40
  Literal,
41
41
  ParamSpec,
42
42
  TypeAlias,
43
+ TypeVar,
43
44
  cast,
44
45
  )
45
46
  from warnings import warn
@@ -75,6 +76,9 @@ else:
75
76
  _SVMPointer_or_nothing = ()
76
77
 
77
78
 
79
+ ArrayT = TypeVar("ArrayT", bound="Array")
80
+
81
+
78
82
  class _NoValue:
79
83
  pass
80
84
 
@@ -2424,7 +2428,7 @@ def empty_like(
2424
2428
  allocator=allocator)
2425
2429
 
2426
2430
 
2427
- def zeros_like(ary):
2431
+ def zeros_like(ary: ArrayT) -> ArrayT:
2428
2432
  """Make a new, zero-initialized :class:`Array` having the same properties
2429
2433
  as *other_ary*.
2430
2434
  """
pyopencl/compyte/array.py CHANGED
@@ -63,7 +63,7 @@ def equal_strides(
63
63
  if len(strides1) != len(strides2) or len(strides2) != len(shape):
64
64
  return False
65
65
 
66
- for s, st1, st2 in zip(shape, strides1, strides2):
66
+ for s, st1, st2 in zip(shape, strides1, strides2, strict=True):
67
67
  if s != 1 and st1 != st2:
68
68
  return False
69
69
 
@@ -98,30 +98,27 @@ class ArrayIsh(Protocol):
98
98
 
99
99
 
100
100
  class ArrayFlags:
101
- f_contiguous: bool
102
- c_contiguous: bool
103
- forc: bool
104
-
105
- def __init__(self, ary: ArrayIsh):
106
- self.f_contiguous = is_f_contiguous_strides(
101
+ def __init__(self, ary: ArrayIsh) -> None:
102
+ self.f_contiguous: bool = is_f_contiguous_strides(
107
103
  ary.strides, ary.dtype.itemsize, ary.shape)
108
- self.c_contiguous = is_c_contiguous_strides(
104
+ self.c_contiguous: bool = is_c_contiguous_strides(
109
105
  ary.strides, ary.dtype.itemsize, ary.shape)
110
- self.forc = self.f_contiguous or self.c_contiguous
106
+ self.forc: bool = self.f_contiguous or self.c_contiguous
111
107
 
112
108
  @override
113
- def __repr__(self):
109
+ def __repr__(self) -> str:
114
110
  return (
115
111
  f" C_CONTIGUOUS : {self.c_contiguous}\n"
116
112
  f" F_CONTIGUOUS : {self.f_contiguous}"
117
113
  )
118
114
 
119
115
  @override
120
- def __str__(self):
116
+ def __str__(self) -> str:
121
117
  return repr(self)
122
118
 
123
119
 
124
- def get_common_dtype(obj1, obj2, allow_double):
120
+ def get_common_dtype(obj1: ArrayIsh, obj2: ArrayIsh,
121
+ allow_double: bool) -> np.dtype[Any]:
125
122
  # Yes, numpy behaves differently depending on whether
126
123
  # we're dealing with arrays or scalars.
127
124
 
@@ -143,33 +140,6 @@ def get_common_dtype(obj1, obj2, allow_double):
143
140
  return result
144
141
 
145
142
 
146
- def bound(a):
147
- high = a.bytes
148
- low = a.bytes
149
-
150
- for stri, shp in zip(a.strides, a.shape):
151
- if stri < 0:
152
- low += (stri)*(shp-1)
153
- else:
154
- high += (stri)*(shp-1)
155
- return low, high
156
-
157
-
158
- def may_share_memory(a, b):
159
- # When this is called with a an ndarray and b
160
- # a sparse matrix, numpy.may_share_memory fails.
161
- if a is b:
162
- return True
163
- if a.__class__ is b.__class__:
164
- a_l, a_h = bound(a)
165
- b_l, b_h = bound(b)
166
- if b_l >= a_h or a_l >= b_h:
167
- return False
168
- return True
169
- else:
170
- return False
171
-
172
-
173
143
  # {{{ as_strided implementation
174
144
 
175
145
  try:
@@ -26,8 +26,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
26
  OTHER DEALINGS IN THE SOFTWARE.
27
27
  """
28
28
 
29
- from collections.abc import Sequence
30
- from typing import Any, Callable, TypeVar
29
+ from collections.abc import Callable, Sequence
30
+ from typing import Any, TypeVar
31
31
 
32
32
  import numpy as np
33
33
  from numpy.typing import DTypeLike
@@ -40,14 +40,12 @@ class TypeNameNotKnown(RuntimeError): # noqa: N818
40
40
  # {{{ registry
41
41
 
42
42
  class DTypeRegistry:
43
- dtype_to_name: dict[np.dtype[Any] | str, str]
44
- name_to_dtype: dict[str, np.dtype[Any]]
43
+ def __init__(self) -> None:
44
+ self.dtype_to_name: dict[np.dtype[Any] | str, str] = {}
45
+ self.name_to_dtype: dict[str, np.dtype[Any]] = {}
45
46
 
46
- def __init__(self):
47
- self.dtype_to_name = {}
48
- self.name_to_dtype = {}
49
-
50
- def get_or_register_dtype(self,
47
+ def get_or_register_dtype(
48
+ self,
51
49
  names: str | Sequence[str],
52
50
  dtype: DTypeLike | None = None) -> np.dtype[Any]:
53
51
  """Get or register a :class:`numpy.dtype` associated with the C type names
@@ -227,7 +225,7 @@ dtype_to_ctype = TYPE_REGISTRY.dtype_to_ctype
227
225
  get_or_register_dtype = TYPE_REGISTRY.get_or_register_dtype
228
226
 
229
227
 
230
- def _fill_dtype_registry(respect_windows, include_bool=True):
228
+ def _fill_dtype_registry(respect_windows: bool, include_bool: bool = True) -> None:
231
229
  fill_registry_with_c_types(
232
230
  TYPE_REGISTRY, respect_windows, include_bool)
233
231
 
@@ -244,7 +242,7 @@ def parse_c_arg_backend(
244
242
  scalar_arg_factory: Callable[[np.dtype[Any], str], ArgTypeT],
245
243
  vec_arg_factory: Callable[[np.dtype[Any], str], ArgTypeT],
246
244
  name_to_dtype: Callable[[str], np.dtype[Any]] | DTypeRegistry | None = None,
247
- ):
245
+ ) -> ArgTypeT:
248
246
  if isinstance(name_to_dtype, DTypeRegistry):
249
247
  name_to_dtype_clbl = name_to_dtype.name_to_dtype.__getitem__
250
248
  elif name_to_dtype is None:
@@ -40,9 +40,6 @@ reportUnnecessaryIsInstance = "none"
40
40
  reportUnusedCallResult = "none"
41
41
  reportExplicitAny = "none"
42
42
  reportUnreachable = "hint"
43
- # array.py looks like stdlib array, but pyright doesn't know this
44
- # won't ever be a top-level anything.
45
- reportShadowedImports = "none"
46
43
 
47
44
  # This reports even cycles that are qualified by 'if TYPE_CHECKING'. Not what
48
45
  # we care about at this moment.
pyopencl/tools.py CHANGED
@@ -772,7 +772,7 @@ def pytest_generate_tests_for_pyopencl(metafunc: pytest.Metafunc) -> None:
772
772
  functions, and they will automatically be run for each OpenCL device/platform
773
773
  in the system, as appropriate.
774
774
 
775
- The following two environment variabls is also supported to control
775
+ The following two environment variables is also supported to control
776
776
  device/platform choice::
777
777
 
778
778
  PYOPENCL_TEST=0:0,1;intel=i5,i7
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyopencl
3
- Version: 2025.2.6
3
+ Version: 2025.2.7
4
4
  Summary: Python wrapper for OpenCL
5
5
  Author-Email: Andreas Kloeckner <inform@tiker.net>
6
6
  License-Expression: MIT
@@ -1,11 +1,11 @@
1
1
  pyopencl/__init__.py,sha256=70i8Bo6qCxXT61loiSs4MfHBk_MDzgDN9eVMnR8Kab4,63178
2
- pyopencl/_cl.cpython-311-x86_64-linux-musl.so,sha256=3jWmQeiV-UWaGwl6eGoPw0YCiH2SJtDLNYfejF7_7Qc,2907953
2
+ pyopencl/_cl.cpython-311-x86_64-linux-musl.so,sha256=UzJmDuJ_SVxPZ-SGxhqf8I9i7wKQuK54dfzxDaGzsPY,2907977
3
3
  pyopencl/_cl.pyi,sha256=u-PoarxPjueM2-u7wtbCdPRA2QHvSW146r79Ys8aZl4,56329
4
4
  pyopencl/_cluda.py,sha256=kjI6pW9M-zGCVDsautsKsYMs1U9v73_W5riUjdzmKA0,2111
5
5
  pyopencl/_monkeypatch.py,sha256=f25Px5nH8ODWs2eLkOtzK9NT5IKNaJ1hx3_hV1Ta8CE,36080
6
6
  pyopencl/_mymako.py,sha256=1xp0pWcE57hpIDKw915CvOGQpC-Jral02Inykx_k198,657
7
7
  pyopencl/algorithm.py,sha256=0-zFMZDtj6iiyiedpxKd6JA9bh1zCj89SXYXTrqsnjs,51319
8
- pyopencl/array.py,sha256=8qzzh4gJlC3DnUAthr-ikEvv93BhJS8n8iPmRuHFIYU,114720
8
+ pyopencl/array.py,sha256=98xbzixkZzZU4sSUzHyBNfBMVsLLwWyk7Q864feP8_I,114795
9
9
  pyopencl/bitonic_sort.py,sha256=FpTfCf_s22O-SgPWBoXZjCG_k1afm7uUwnO9N7jubgg,8052
10
10
  pyopencl/bitonic_sort_templates.py,sha256=316nsWdr7jpg9g8SmZk8KCoHmHKabjvOdBaufxQPw8Y,16188
11
11
  pyopencl/cache.py,sha256=B8uY1YrBZBn8Q37aj0a6NC4yliumXwAsZvmjnWr1LZs,15989
@@ -19,7 +19,7 @@ pyopencl/ipython_ext.py,sha256=_l9y3F2fi-tM7_cIlqY1LyWckYHYfVYBKCI4RNpEpKo,1951
19
19
  pyopencl/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  pyopencl/reduction.py,sha256=2Gf91Rw0mUu61SVSqhYWhReV5Ru28Qw60CXmXLhSDO8,26644
21
21
  pyopencl/scan.py,sha256=_eg8UjYs0OVTfP909H6fqrlj1Xe4OtSqMWY3ziUPevc,65975
22
- pyopencl/tools.py,sha256=gORNLHLLTNizj8VXXiYTUZTZItVvvO3iEznrLE7Le0A,51958
22
+ pyopencl/tools.py,sha256=DMBI5hzl1qJCKpCdqEd6CNWa_rjePLqUA7tLztih_wU,51959
23
23
  pyopencl/typing.py,sha256=LN50UCqujen7SE5cforFvJLoEd3KNEKygxuQiZV4YoQ,1986
24
24
  pyopencl/version.py,sha256=53bqHNFDyobSVMAdQ47kiOx1UdhKXDLkTtzNwfLEvY4,304
25
25
  pyopencl/.libs/libOpenCL-4a7ed9fc.so.1.0.0,sha256=nDMANkMHjtS1k8meh6rU6Kg7aIMEiHHO3NZgLniIU9I,610825
@@ -38,10 +38,10 @@ pyopencl/cl/pyopencl-random123/philox.cl,sha256=vYcQH7Vw13Q3qkW5Nhy1HTUDbWLGKolo
38
38
  pyopencl/cl/pyopencl-random123/threefry.cl,sha256=2WmQGxx5gPSv22UL9_MlXv0eMug91k3bC-5_yQ4wlnI,54699
39
39
  pyopencl/compyte/.gitignore,sha256=HVYtbKRtOCPWZavrgYqO2u7UKFiE7g7ympmuQzKbBBw,168
40
40
  pyopencl/compyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- pyopencl/compyte/array.py,sha256=t1XORyCQ4zRe_KUnoo4LH1W5XOcGXaf5xvGtgOPDzyg,8035
42
- pyopencl/compyte/dtypes.py,sha256=S_cGvFOq07fgwloCq9pxjzlDpxPbwwRb-pb1TOH77nU,10546
43
- pyopencl/compyte/pyproject.toml,sha256=WmDOFf4Z22yumhUw8tEet-XBtqO36K4eL9nbr4xpzlw,1280
44
- pyopencl-2025.2.6.dist-info/METADATA,sha256=dsWhiDhr27Nv5sVSfMzrp3Nb4nMNcaP9mYCzHUkcDps,4725
45
- pyopencl-2025.2.6.dist-info/WHEEL,sha256=ytcO6FlAkWeAl40hnegBQlx5TynHj6qZkzkNONZpqQA,117
46
- pyopencl-2025.2.6.dist-info/RECORD,,
47
- pyopencl-2025.2.6.dist-info/licenses/LICENSE,sha256=ed06wscfYbymGrF5jRUX9rPCsefHp5ZOv_xgjbXgGrA,5299
41
+ pyopencl/compyte/array.py,sha256=7F4TuQ5SzkV4du-R-GQ7cNLFJNhRU-htVqbVbpkKJ2o,7493
42
+ pyopencl/compyte/dtypes.py,sha256=mbpZEVF3l01JTou4-3MeHG_9ptPcLo33kZhU9UZTwL8,10568
43
+ pyopencl/compyte/pyproject.toml,sha256=yISxFxhotloFnx_Adffvnr0w2samJwGonr64Eq2YDQo,1145
44
+ pyopencl-2025.2.7.dist-info/METADATA,sha256=ewTbQ2052noPrpeGZheceiEOTHkRWUMHkgqnv8Q7VVE,4725
45
+ pyopencl-2025.2.7.dist-info/WHEEL,sha256=Y3GjFou-TcvYG8r2iXbNPPSJEiD3r1Fl3pPy2E65s_w,117
46
+ pyopencl-2025.2.7.dist-info/RECORD,,
47
+ pyopencl-2025.2.7.dist-info/licenses/LICENSE,sha256=ed06wscfYbymGrF5jRUX9rPCsefHp5ZOv_xgjbXgGrA,5299
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: scikit-build-core 0.11.5
2
+ Generator: scikit-build-core 0.11.6
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-musllinux_1_2_x86_64
5
5