Skip to content

Commit 2e96dbb

Browse files
committed
remove usage of deprecated, legacy property syntax
1 parent b610ee3 commit 2e96dbb

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

dpctl/_sycl_queue.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,12 +1747,12 @@ cdef class WorkGroupMemory:
17471747
def is_available():
17481748
return DPCTLWorkGroupMemory_Available()
17491749

1750-
property _ref:
1750+
@property
1751+
def _ref(self):
17511752
"""Returns the address of the C API ``DPCTLWorkGroupMemoryRef``
17521753
pointer as a ``size_t``.
17531754
"""
1754-
def __get__(self):
1755-
return <size_t>self._mem_ref
1755+
return <size_t>self._mem_ref
17561756

17571757

17581758
cdef class _RawKernelArg:
@@ -1842,9 +1842,9 @@ cdef class RawKernelArg:
18421842
def is_available():
18431843
return DPCTLRawKernelArg_Available()
18441844

1845-
property _ref:
1845+
@property
1846+
def _ref(self):
18461847
"""Returns the address of the C API ``DPCTLRawKernelArgRef`` pointer
18471848
as a ``size_t``.
18481849
"""
1849-
def __get__(self):
1850-
return <size_t>self._arg_ref
1850+
return <size_t>self._arg_ref

dpctl/memory/_memory.pyx

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -290,63 +290,63 @@ cdef class _Memory:
290290
buffer.strides = &buffer.itemsize
291291
buffer.suboffsets = NULL # for pointer arrays only
292292

293-
property nbytes:
293+
@property
294+
def nbytes(self):
294295
"""Extent of this USM buffer in bytes."""
295-
def __get__(self):
296-
return self.nbytes
296+
return self.nbytes
297297

298-
property size:
298+
@property
299+
def size(self):
299300
"""Extent of this USM buffer in bytes."""
300-
def __get__(self):
301-
return self.nbytes
301+
return self.nbytes
302302

303-
property _pointer:
303+
@property
304+
def _pointer(self):
304305
"""
305306
USM pointer at the start of this buffer
306307
represented as Python integer.
307308
"""
308-
def __get__(self):
309-
return <size_t>(self._memory_ptr)
309+
return <size_t>(self._memory_ptr)
310310

311-
property _context:
311+
@property
312+
def _context(self):
312313
""":class:`dpctl.SyclContext` the USM pointer is bound to. """
313-
def __get__(self):
314-
return self.queue.get_sycl_context()
314+
return self.queue.get_sycl_context()
315315

316-
property _queue:
316+
@property
317+
def _queue(self):
317318
"""
318319
:class:`dpctl.SyclQueue` with :class:`dpctl.SyclContext` the
319320
USM allocation is bound to and :class:`dpctl.SyclDevice` it was
320321
allocated on.
321322
"""
322-
def __get__(self):
323-
return self.queue
323+
return self.queue
324324

325-
property reference_obj:
325+
@property
326+
def reference_obj(self):
326327
"""
327328
Reference to the Python object owning this USM buffer.
328329
"""
329-
def __get__(self):
330-
return self.refobj
330+
return self.refobj
331331

332-
property sycl_context:
332+
@property
333+
def sycl_context(self):
333334
""":class:`dpctl.SyclContext` the USM pointer is bound to."""
334-
def __get__(self):
335-
return self.queue.get_sycl_context()
335+
return self.queue.get_sycl_context()
336336

337-
property sycl_device:
337+
@property
338+
def sycl_device(self):
338339
""":class:`dpctl.SyclDevice` the USM pointer is bound to."""
339-
def __get__(self):
340-
return self.queue.get_sycl_device()
340+
return self.queue.get_sycl_device()
341341

342-
property sycl_queue:
342+
@property
343+
def sycl_queue(self):
343344
"""
344345
:class:`dpctl.SyclQueue` with :class:`dpctl.SyclContext` the
345346
USM allocation is bound to and :class:`dpctl.SyclDevice` it was
346347
allocated on.
347348
"""
348-
def __get__(self):
349-
return self.queue
349+
return self.queue
350350

351351
def __repr__(self):
352352
return (
@@ -370,7 +370,8 @@ cdef class _Memory:
370370
def __reduce__(self):
371371
return _to_memory, (self.copy_to_host(), self.get_usm_type())
372372

373-
property __sycl_usm_array_interface__:
373+
@property
374+
def __sycl_usm_array_interface__(self):
374375
"""
375376
Dictionary encoding information about USM allocation.
376377
@@ -396,17 +397,16 @@ cdef class _Memory:
396397
Queue associated with this class instance.
397398
398399
"""
399-
def __get__(self):
400-
cdef dict iface = {
401-
"data": (<size_t>(<void *>self._memory_ptr),
402-
True), # bool(self.writable)),
403-
"shape": (self.nbytes,),
404-
"strides": None,
405-
"typestr": "|u1",
406-
"version": 1,
407-
"syclobj": self.queue
408-
}
409-
return iface
400+
cdef dict iface = {
401+
"data": (<size_t>(<void *>self._memory_ptr),
402+
True), # bool(self.writable)),
403+
"shape": (self.nbytes,),
404+
"strides": None,
405+
"typestr": "|u1",
406+
"version": 1,
407+
"syclobj": self.queue,
408+
}
409+
return iface
410410

411411
def get_usm_type(self, syclobj=None):
412412
"""

0 commit comments

Comments
 (0)