Skip to content

Commit c274728

Browse files
Apply pragma: no cover to excludes likes from coverage missing stats
See https://coverage.readthedocs.io/en/7.6.10/excluding.html Also remove import np, as it is unused. The NumPy is imported before this PXI file is included.
1 parent 50cb37d commit c274728

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

dpctl/tensor/_types.pxi

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,25 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import numpy as np
18-
19-
2017
# these typenum values are aligned to values in NumPy
21-
cdef int UAR_BOOL = 0
22-
cdef int UAR_BYTE = 1
23-
cdef int UAR_UBYTE = 2
24-
cdef int UAR_SHORT = 3
25-
cdef int UAR_USHORT = 4
26-
cdef int UAR_INT = 5
27-
cdef int UAR_UINT = 6
28-
cdef int UAR_LONG = 7
29-
cdef int UAR_ULONG = 8
30-
cdef int UAR_LONGLONG = 9
31-
cdef int UAR_ULONGLONG = 10
32-
cdef int UAR_FLOAT = 11
33-
cdef int UAR_DOUBLE = 12
34-
cdef int UAR_CFLOAT = 14
35-
cdef int UAR_CDOUBLE = 15
36-
cdef int UAR_TYPE_SENTINEL = 17
37-
cdef int UAR_HALF = 23
18+
cdef:
19+
int UAR_BOOL = 0 # pragma: no cover
20+
int UAR_BYTE = 1 # pragma: no cover
21+
int UAR_UBYTE = 2 # pragma: no cover
22+
int UAR_SHORT = 3 # pragma: no cover
23+
int UAR_USHORT = 4 # pragma: no cover
24+
int UAR_INT = 5 # pragma: no cover
25+
int UAR_UINT = 6 # pragma: no cover
26+
int UAR_LONG = 7 # pragma: no cover
27+
int UAR_ULONG = 8 # pragma: no cover
28+
int UAR_LONGLONG = 9 # pragma: no cover
29+
int UAR_ULONGLONG = 10 # pragma: no cover
30+
int UAR_FLOAT = 11 # pragma: no cover
31+
int UAR_DOUBLE = 12 # pragma: no cover
32+
int UAR_CFLOAT = 14 # pragma: no cover
33+
int UAR_CDOUBLE = 15 # pragma: no cover
34+
int UAR_TYPE_SENTINEL = 17 # pragma: no cover
35+
int UAR_HALF = 23 # pragma: no cover
3836

3937
cdef int type_bytesize(int typenum):
4038
"""
@@ -74,7 +72,7 @@ cdef int type_bytesize(int typenum):
7472
sizeof(float complex),
7573
sizeof(double complex), -1]
7674

77-
if typenum < 0:
75+
if typenum < 0: # pragma: no cover
7876
return -1
7977
if typenum > 16:
8078
if typenum == 23:
@@ -92,12 +90,12 @@ cdef str _make_typestr(int typenum):
9290
"|i", "|u", "|i", "|u", "|i", "|u",
9391
"|f", "|f", "", "|c", "|c", ""]
9492

95-
if (typenum < 0):
93+
if (typenum < 0): # pragma: no cover
9694
return ""
9795
if (typenum > 16):
9896
if (typenum == 23):
9997
return "|f2"
100-
return ""
98+
return "" # pragma: no cover
10199

102100
return type_to_str[typenum] + str(type_bytesize(typenum))
103101

@@ -126,10 +124,10 @@ cdef int descr_to_typenum(object dtype):
126124
if (not isinstance(obj, list) or len(obj) != 1):
127125
return -1 # token for ValueError
128126
obj = obj[0]
129-
if (not isinstance(obj, tuple) or len(obj) != 2 or obj[0]):
127+
if (not isinstance(obj, tuple) or len(obj) != 2 or obj[0]): # pragma: no cover
130128
return -1
131129
obj = obj[1]
132-
if not isinstance(obj, str):
130+
if not isinstance(obj, str): # pragma: no cover
133131
return -1
134132
return typenum_from_format(obj)
135133

@@ -146,9 +144,9 @@ cdef int dtype_to_typenum(dtype):
146144
dt = np.dtype(dtype)
147145
except TypeError:
148146
return -3
149-
except Exception:
147+
except Exception: # pragma: no cover
150148
return -1
151149
if hasattr(dt, 'descr'):
152150
return descr_to_typenum(dt)
153-
else:
151+
else: # pragma: no cover
154152
return -3 # token for TypeError

0 commit comments

Comments
 (0)