@@ -27,7 +27,7 @@ import logging
27
27
from cpython cimport pycapsule
28
28
from cpython.mem cimport PyMem_Free, PyMem_Malloc
29
29
30
- from ._backend cimport (
30
+ from ._backend cimport ( # noqa: E211
31
31
DPCTLContext_AreEq,
32
32
DPCTLContext_Copy,
33
33
DPCTLContext_Create,
@@ -59,7 +59,9 @@ _logger = logging.getLogger(__name__)
59
59
cdef void _context_capsule_deleter(object o):
60
60
cdef DPCTLSyclContextRef CRef = NULL
61
61
if pycapsule.PyCapsule_IsValid(o, " SyclContextRef" ):
62
- CRef = < DPCTLSyclContextRef> pycapsule.PyCapsule_GetPointer(o, " SyclContextRef" )
62
+ CRef = < DPCTLSyclContextRef> pycapsule.PyCapsule_GetPointer(
63
+ o, " SyclContextRef"
64
+ )
63
65
DPCTLContext_Delete(CRef)
64
66
65
67
@@ -127,7 +129,7 @@ cdef class SyclContext(_SyclContext):
127
129
128
130
# Create a CPU device using the opencl driver
129
131
cpu_d = dpctl.SyclDevice("opencl:cpu")
130
- # Partition the CPU device into sub-devices, each with two cores.
132
+ # Partition the CPU device into sub-devices with two cores each .
131
133
sub_devices = cpu_d.create_sub_devices(partition=2)
132
134
# Create a context common to all the sub-devices.
133
135
ctx = dpctl.SyclContext(sub_devices)
@@ -157,7 +159,7 @@ cdef class SyclContext(_SyclContext):
157
159
158
160
@staticmethod
159
161
cdef void _init_helper(_SyclContext context, DPCTLSyclContextRef CRef):
160
- context._ctxt_ref = CRef
162
+ context._ctxt_ref = CRef
161
163
162
164
@staticmethod
163
165
cdef SyclContext _create(DPCTLSyclContextRef ctxt):
@@ -257,8 +259,8 @@ cdef class SyclContext(_SyclContext):
257
259
return 0
258
260
else :
259
261
# __cinit__ checks that capsule is valid, so one can be here only
260
- # if call to `_init_context_from_capsule` was made outside of __cinit__
261
- # and the capsule was not checked to be valid
262
+ # if call to `_init_context_from_capsule` was made outside of
263
+ # __cinit__ and the capsule was not checked to be valid
262
264
return - 128
263
265
264
266
def __cinit__ (self , arg = None ):
@@ -269,8 +271,8 @@ cdef class SyclContext(_SyclContext):
269
271
ret = self ._init_context_from_one_device(< SyclDevice> arg, 0 )
270
272
elif pycapsule.PyCapsule_IsValid(arg, " SyclContextRef" ):
271
273
status = self ._init_context_from_capsule(arg)
272
- elif isinstance (
273
- arg, ( list , tuple )) and all ( [isinstance (argi, SyclDevice) for argi in arg]
274
+ elif isinstance (arg, ( list , tuple )) and all (
275
+ [isinstance (argi, SyclDevice) for argi in arg]
274
276
):
275
277
ret = self ._init_context_from_devices(arg, 0 )
276
278
else :
@@ -336,7 +338,7 @@ cdef class SyclContext(_SyclContext):
336
338
cdef DPCTLSyclContextRef get_context_ref(self ):
337
339
return self ._ctxt_ref
338
340
339
- def addressof_ref (self ):
341
+ def addressof_ref (self ):
340
342
"""
341
343
Returns the address of the ``DPCTLSyclContextRef`` pointer as a
342
344
``size_t``.
@@ -419,7 +421,8 @@ cdef class SyclContext(_SyclContext):
419
421
cpu_d = dpctl.SyclDevice("opencl:cpu")
420
422
sub_devices = create_sub_devices(partition=2)
421
423
ctx2 = dpctl.SyclContext(sub_devices)
422
- print(ctx2) # E.g : <dpctl.SyclContext for 4 devices at 0x7f154d8ab070>
424
+ # prints: <dpctl.SyclContext for 4 devices at 0x7f154d8ab070>
425
+ print(ctx2)
423
426
424
427
Returns:
425
428
:obj:`str`: A string representation of the
0 commit comments