Skip to content

Commit 2306616

Browse files
committed
MNT: Remove "pragma: no cover" from lines ignored by config
1 parent 65c3ca2 commit 2306616

14 files changed

+39
-49
lines changed

nibabel/_compression.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from .optpkg import optional_package
1919

20-
if ty.TYPE_CHECKING: # pragma: no cover
20+
if ty.TYPE_CHECKING:
2121
import indexed_gzip # type: ignore[import]
2222
import pyzstd
2323

nibabel/arrayproxy.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
KEEP_FILE_OPEN_DEFAULT = False
5858

5959

60-
if ty.TYPE_CHECKING: # pragma: no cover
60+
if ty.TYPE_CHECKING:
6161
import numpy.typing as npt
6262
from typing_extensions import Self # PY310
6363

@@ -75,19 +75,17 @@ class ArrayLike(ty.Protocol):
7575
shape: tuple[int, ...]
7676

7777
@property
78-
def ndim(self) -> int: ... # pragma: no cover
78+
def ndim(self) -> int: ...
7979

8080
# If no dtype is passed, any dtype might be returned, depending on the array-like
8181
@ty.overload
82-
def __array__(
83-
self, dtype: None = ..., /
84-
) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ... # pragma: no cover
82+
def __array__(self, dtype: None = ..., /) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ...
8583

8684
# Any dtype might be passed, and *that* dtype must be returned
8785
@ty.overload
88-
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ... # pragma: no cover
86+
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ...
8987

90-
def __getitem__(self, key, /) -> npt.NDArray: ... # pragma: no cover
88+
def __getitem__(self, key, /) -> npt.NDArray: ...
9189

9290

9391
class ArrayProxy(ArrayLike):

nibabel/dataobj_images.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .filebasedimages import FileBasedHeader, FileBasedImage
2020
from .fileholders import FileMap
2121

22-
if ty.TYPE_CHECKING: # pragma: no cover
22+
if ty.TYPE_CHECKING:
2323
import numpy.typing as npt
2424

2525
from .filename_parser import FileSpec

nibabel/deprecated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .deprecator import Deprecator
99
from .pkg_info import cmp_pkg_version
1010

11-
if ty.TYPE_CHECKING: # pragma: no cover
11+
if ty.TYPE_CHECKING:
1212
P = ty.ParamSpec('P')
1313

1414

nibabel/deprecator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import warnings
1010
from textwrap import dedent
1111

12-
if ty.TYPE_CHECKING: # pragma: no cover
12+
if ty.TYPE_CHECKING:
1313
T = ty.TypeVar('T')
1414
P = ty.ParamSpec('P')
1515

nibabel/filebasedimages.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .filename_parser import TypesFilenamesError, _stringify_path, splitext_addext, types_filenames
2121
from .openers import ImageOpener
2222

23-
if ty.TYPE_CHECKING: # pragma: no cover
23+
if ty.TYPE_CHECKING:
2424
from .filename_parser import ExtensionSpec, FileSpec
2525

2626
FileSniff = ty.Tuple[bytes, str]
@@ -54,13 +54,13 @@ def from_header(klass: type[HdrT], header: FileBasedHeader | ty.Mapping | None =
5454

5555
@classmethod
5656
def from_fileobj(klass: type[HdrT], fileobj: io.IOBase) -> HdrT:
57-
raise NotImplementedError # pragma: no cover
57+
raise NotImplementedError
5858

5959
def write_to(self, fileobj: io.IOBase) -> None:
60-
raise NotImplementedError # pragma: no cover
60+
raise NotImplementedError
6161

6262
def __eq__(self, other: object) -> bool:
63-
raise NotImplementedError # pragma: no cover
63+
raise NotImplementedError
6464

6565
def __ne__(self, other: object) -> bool:
6666
return not self == other
@@ -251,7 +251,7 @@ def from_filename(klass: type[ImgT], filename: FileSpec) -> ImgT:
251251

252252
@classmethod
253253
def from_file_map(klass: type[ImgT], file_map: FileMap) -> ImgT:
254-
raise NotImplementedError # pragma: no cover
254+
raise NotImplementedError
255255

256256
@classmethod
257257
def filespec_to_file_map(klass, filespec: FileSpec) -> FileMap:
@@ -308,7 +308,7 @@ def to_filename(self, filename: FileSpec, **kwargs) -> None:
308308
self.to_file_map(**kwargs)
309309

310310
def to_file_map(self, file_map: FileMap | None = None, **kwargs) -> None:
311-
raise NotImplementedError # pragma: no cover
311+
raise NotImplementedError
312312

313313
@classmethod
314314
def make_file_map(klass, mapping: ty.Mapping[str, str | io.IOBase] | None = None) -> FileMap:
@@ -373,7 +373,7 @@ def from_image(klass: type[ImgT], img: FileBasedImage) -> ImgT:
373373
img : ``FileBasedImage`` instance
374374
Image, of our own class
375375
"""
376-
raise NotImplementedError # pragma: no cover
376+
raise NotImplementedError
377377

378378
@classmethod
379379
def _sniff_meta_for(

nibabel/filename_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pathlib
1515
import typing as ty
1616

17-
if ty.TYPE_CHECKING: # pragma: no cover
17+
if ty.TYPE_CHECKING:
1818
FileSpec = str | os.PathLike[str]
1919
ExtensionSpec = tuple[str, str | None]
2020

nibabel/loadsave.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
_compressed_suffixes = ('.gz', '.bz2', '.zst')
2727

2828

29-
if ty.TYPE_CHECKING: # pragma: no cover
29+
if ty.TYPE_CHECKING:
3030
from .filebasedimages import FileBasedImage
3131
from .filename_parser import FileSpec
3232

nibabel/onetime.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ def __init__(self, func: ty.Callable[[InstanceT], T]) -> None:
137137
@ty.overload
138138
def __get__(
139139
self, obj: None, objtype: type[InstanceT] | None = None
140-
) -> ty.Callable[[InstanceT], T]: ... # pragma: no cover
140+
) -> ty.Callable[[InstanceT], T]: ...
141141

142142
@ty.overload
143-
def __get__(
144-
self, obj: InstanceT, objtype: type[InstanceT] | None = None
145-
) -> T: ... # pragma: no cover
143+
def __get__(self, obj: InstanceT, objtype: type[InstanceT] | None = None) -> T: ...
146144

147145
def __get__(
148146
self, obj: InstanceT | None, objtype: type[InstanceT] | None = None

nibabel/openers.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from ._compression import HAVE_INDEXED_GZIP, IndexedGzipFile, pyzstd
2020

21-
if ty.TYPE_CHECKING: # pragma: no cover
21+
if ty.TYPE_CHECKING:
2222
from types import TracebackType
2323

2424
from _typeshed import WriteableBuffer
@@ -36,9 +36,8 @@
3636

3737
@ty.runtime_checkable
3838
class Fileish(ty.Protocol):
39-
def read(self, size: int = -1, /) -> bytes: ... # pragma: no cover
40-
41-
def write(self, b: bytes, /) -> int | None: ... # pragma: no cover
39+
def read(self, size: int = -1, /) -> bytes: ...
40+
def write(self, b: bytes, /) -> int | None: ...
4241

4342

4443
class DeterministicGzipFile(gzip.GzipFile):

nibabel/pointset.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from nibabel.fileslice import strided_scalar
3131
from nibabel.spatialimages import SpatialImage
3232

33-
if ty.TYPE_CHECKING: # pragma: no cover
33+
if ty.TYPE_CHECKING:
3434
from typing_extensions import Self
3535

3636
_DType = ty.TypeVar('_DType', bound=np.dtype[ty.Any])
@@ -41,12 +41,10 @@ class CoordinateArray(ty.Protocol):
4141
shape: tuple[int, int]
4242

4343
@ty.overload
44-
def __array__(
45-
self, dtype: None = ..., /
46-
) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ... # pragma: no cover
44+
def __array__(self, dtype: None = ..., /) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ...
4745

4846
@ty.overload
49-
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ... # pragma: no cover
47+
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ...
5048

5149

5250
@dataclass

nibabel/spatialimages.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -154,26 +154,23 @@
154154
except ImportError: # PY38
155155
from functools import lru_cache as cache
156156

157-
if ty.TYPE_CHECKING: # pragma: no cover
157+
if ty.TYPE_CHECKING:
158158
import numpy.typing as npt
159159

160160
SpatialImgT = ty.TypeVar('SpatialImgT', bound='SpatialImage')
161161
SpatialHdrT = ty.TypeVar('SpatialHdrT', bound='SpatialHeader')
162162

163163

164164
class HasDtype(ty.Protocol):
165-
def get_data_dtype(self) -> np.dtype: ... # pragma: no cover
166-
167-
def set_data_dtype(self, dtype: npt.DTypeLike) -> None: ... # pragma: no cover
165+
def get_data_dtype(self) -> np.dtype: ...
166+
def set_data_dtype(self, dtype: npt.DTypeLike) -> None: ...
168167

169168

170169
@ty.runtime_checkable
171170
class SpatialProtocol(ty.Protocol):
172-
def get_data_dtype(self) -> np.dtype: ... # pragma: no cover
173-
174-
def get_data_shape(self) -> ty.Tuple[int, ...]: ... # pragma: no cover
175-
176-
def get_zooms(self) -> ty.Tuple[float, ...]: ... # pragma: no cover
171+
def get_data_dtype(self) -> np.dtype: ...
172+
def get_data_shape(self) -> ty.Tuple[int, ...]: ...
173+
def get_zooms(self) -> ty.Tuple[float, ...]: ...
177174

178175

179176
class HeaderDataError(Exception):

nibabel/volumeutils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .casting import OK_FLOATS, shared_range
2525
from .externals.oset import OrderedSet
2626

27-
if ty.TYPE_CHECKING: # pragma: no cover
27+
if ty.TYPE_CHECKING:
2828
import numpy.typing as npt
2929

3030
Scalar = np.number | float
@@ -1191,13 +1191,13 @@ def _ftype4scaled_finite(
11911191
@ty.overload
11921192
def finite_range(
11931193
arr: npt.ArrayLike, check_nan: ty.Literal[False] = False
1194-
) -> tuple[Scalar, Scalar]: ... # pragma: no cover
1194+
) -> tuple[Scalar, Scalar]: ...
11951195

11961196

11971197
@ty.overload
11981198
def finite_range(
11991199
arr: npt.ArrayLike, check_nan: ty.Literal[True]
1200-
) -> tuple[Scalar, Scalar, bool]: ... # pragma: no cover
1200+
) -> tuple[Scalar, Scalar, bool]: ...
12011201

12021202

12031203
def finite_range(

nibabel/xmlutils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class XmlSerializable:
2020

2121
def _to_xml_element(self) -> Element:
2222
"""Output should be a xml.etree.ElementTree.Element"""
23-
raise NotImplementedError # pragma: no cover
23+
raise NotImplementedError
2424

2525
def to_xml(self, enc='utf-8', **kwargs) -> bytes:
2626
r"""Generate an XML bytestring with a given encoding.
@@ -109,10 +109,10 @@ def parse(self, string=None, fname=None, fptr=None):
109109
parser.ParseFile(fptr)
110110

111111
def StartElementHandler(self, name, attrs):
112-
raise NotImplementedError # pragma: no cover
112+
raise NotImplementedError
113113

114114
def EndElementHandler(self, name):
115-
raise NotImplementedError # pragma: no cover
115+
raise NotImplementedError
116116

117117
def CharacterDataHandler(self, data):
118-
raise NotImplementedError # pragma: no cover
118+
raise NotImplementedError

0 commit comments

Comments
 (0)