Skip to content

Commit

Permalink
Apply ruff/flake8-type-checking rule TCH003 (pydicom#2103)
Browse files Browse the repository at this point in the history
TCH003 Move standard library import into a type-checking block
  • Loading branch information
DimitriPapadopoulos committed Jul 10, 2024
1 parent e5c2d27 commit 7a1669f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/pydicom/filebase.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Copyright 2008-2020 pydicom authors. See LICENSE file for details.
"""Hold DicomFile class, which does basic I/O for a dicom file."""

from collections.abc import Callable
from io import BytesIO
import os
from struct import Struct
from types import TracebackType
from typing import cast, Any, TypeVar, Protocol
from typing import TYPE_CHECKING, cast, Any, TypeVar, Protocol

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable


ExitException = tuple[
Expand Down
2 changes: 1 addition & 1 deletion src/pydicom/pixels/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2008-2024 pydicom authors. See LICENSE file for details.
"""Common objects for pixel data handling."""

from collections.abc import Callable
from enum import Enum, unique
from importlib import import_module
from typing import TYPE_CHECKING, Any, TypedDict
Expand All @@ -11,6 +10,7 @@
from pydicom.uid import UID

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from pydicom.dataset import Dataset
from pydicom.pixels.decoders.base import DecodeOptions, DecodeFunction
from pydicom.pixels.encoders.base import EncodeOptions, EncodeFunction
Expand Down
2 changes: 1 addition & 1 deletion src/pydicom/pixels/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from io import BytesIO
from struct import unpack, unpack_from
from typing import TYPE_CHECKING, cast
from collections.abc import Iterable

try:
import numpy as np
Expand All @@ -27,6 +26,7 @@
from pydicom.valuerep import VR

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Iterable
from pydicom.dataset import Dataset


Expand Down
2 changes: 1 addition & 1 deletion src/pydicom/pixels/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import importlib
import logging
from pathlib import Path
from os import PathLike
from struct import unpack, Struct
from sys import byteorder
from typing import BinaryIO, Any, cast, TYPE_CHECKING
Expand All @@ -32,6 +31,7 @@
from pydicom.valuerep import VR

if TYPE_CHECKING: # pragma: no cover
from os import PathLike
from pydicom.dataset import Dataset


Expand Down

0 comments on commit 7a1669f

Please sign in to comment.