diff --git a/monai/apps/auto3dseg/__main__.py b/monai/apps/auto3dseg/__main__.py index 41996d6a01..eec56b7582 100644 --- a/monai/apps/auto3dseg/__main__.py +++ b/monai/apps/auto3dseg/__main__.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from monai.apps.auto3dseg.auto_runner import AutoRunner from monai.apps.auto3dseg.bundle_gen import BundleAlgo, BundleGen from monai.apps.auto3dseg.data_analyzer import DataAnalyzer diff --git a/monai/apps/auto3dseg/ensemble_builder.py b/monai/apps/auto3dseg/ensemble_builder.py index 629318d69e..72ea557dc4 100644 --- a/monai/apps/auto3dseg/ensemble_builder.py +++ b/monai/apps/auto3dseg/ensemble_builder.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import json import os from abc import ABC, abstractmethod diff --git a/monai/apps/deepedit/transforms.py b/monai/apps/deepedit/transforms.py index 94669e5900..76b9e18cc7 100644 --- a/monai/apps/deepedit/transforms.py +++ b/monai/apps/deepedit/transforms.py @@ -28,7 +28,6 @@ logger = logging.getLogger(__name__) - distance_transform_cdt, _ = optional_import("scipy.ndimage.morphology", name="distance_transform_cdt") diff --git a/monai/apps/detection/metrics/coco.py b/monai/apps/detection/metrics/coco.py index 2ffd99aec6..8dba3fa7da 100644 --- a/monai/apps/detection/metrics/coco.py +++ b/monai/apps/detection/metrics/coco.py @@ -56,7 +56,6 @@ # The views and conclusions contained in the software and documentation are those # of the authors and should not be interpreted as representing official policies, # either expressed or implied, of the FreeBSD Project. - """ This script is almost same with https://github.com/MIC-DKFZ/nnDetection/blob/main/nndet/evaluator/detection/coco.py The changes include 1) code reformatting, 2) docstrings. diff --git a/monai/apps/detection/metrics/matching.py b/monai/apps/detection/metrics/matching.py index 59748045d0..37e6e2fa06 100644 --- a/monai/apps/detection/metrics/matching.py +++ b/monai/apps/detection/metrics/matching.py @@ -56,7 +56,6 @@ # The views and conclusions contained in the software and documentation are those # of the authors and should not be interpreted as representing official policies, # either expressed or implied, of the FreeBSD Project. - """ This script is almost same with https://github.com/MIC-DKFZ/nnDetection/blob/main/nndet/evaluator/detection/matching.py The changes include 1) code reformatting, 2) docstrings, diff --git a/monai/apps/detection/networks/retinanet_detector.py b/monai/apps/detection/networks/retinanet_detector.py index b4ccafbd01..4c6f165439 100644 --- a/monai/apps/detection/networks/retinanet_detector.py +++ b/monai/apps/detection/networks/retinanet_detector.py @@ -32,7 +32,6 @@ # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. - """ Part of this script is adapted from https://github.com/pytorch/vision/blob/main/torchvision/models/detection/retinanet.py diff --git a/monai/apps/detection/networks/retinanet_network.py b/monai/apps/detection/networks/retinanet_network.py index 4539a913ac..4a0d8dc228 100644 --- a/monai/apps/detection/networks/retinanet_network.py +++ b/monai/apps/detection/networks/retinanet_network.py @@ -32,7 +32,6 @@ # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. - """ Part of this script is adapted from https://github.com/pytorch/vision/blob/main/torchvision/models/detection/retinanet.py diff --git a/monai/apps/detection/utils/ATSS_matcher.py b/monai/apps/detection/utils/ATSS_matcher.py index c04faa3ffd..c208fcd41c 100644 --- a/monai/apps/detection/utils/ATSS_matcher.py +++ b/monai/apps/detection/utils/ATSS_matcher.py @@ -59,7 +59,6 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """ The functions in this script are adapted from nnDetection, https://github.com/MIC-DKFZ/nnDetection/blob/main/nndet/core/boxes/matcher.py diff --git a/monai/apps/detection/utils/anchor_utils.py b/monai/apps/detection/utils/anchor_utils.py index baaaeb7147..55c256248a 100644 --- a/monai/apps/detection/utils/anchor_utils.py +++ b/monai/apps/detection/utils/anchor_utils.py @@ -32,7 +32,6 @@ # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. - """ This script is adapted from https://github.com/pytorch/vision/blob/release/0.12/torchvision/models/detection/anchor_utils.py diff --git a/monai/apps/detection/utils/box_coder.py b/monai/apps/detection/utils/box_coder.py index c2c1b89fc4..6458360fcd 100644 --- a/monai/apps/detection/utils/box_coder.py +++ b/monai/apps/detection/utils/box_coder.py @@ -43,7 +43,6 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """ This script is modified from torchvision to support N-D images, diff --git a/monai/apps/detection/utils/box_selector.py b/monai/apps/detection/utils/box_selector.py index f50b398289..e0e82dbef7 100644 --- a/monai/apps/detection/utils/box_selector.py +++ b/monai/apps/detection/utils/box_selector.py @@ -32,7 +32,6 @@ # * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. - """ Part of this script is adapted from https://github.com/pytorch/vision/blob/main/torchvision/models/detection/retinanet.py diff --git a/monai/apps/detection/utils/hard_negative_sampler.py b/monai/apps/detection/utils/hard_negative_sampler.py index 4f0e9f2e6a..ee423bb4bc 100644 --- a/monai/apps/detection/utils/hard_negative_sampler.py +++ b/monai/apps/detection/utils/hard_negative_sampler.py @@ -24,7 +24,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ The functions in this script are adapted from nnDetection, https://github.com/MIC-DKFZ/nnDetection/blob/main/nndet/core/boxes/sampler.py diff --git a/monai/apps/mmars/mmars.py b/monai/apps/mmars/mmars.py index 055de3f328..6e1770b19e 100644 --- a/monai/apps/mmars/mmars.py +++ b/monai/apps/mmars/mmars.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Utilities for accessing Nvidia MMARs diff --git a/monai/apps/mmars/model_desc.py b/monai/apps/mmars/model_desc.py index 47bbfe2eaa..e0a7f26117 100644 --- a/monai/apps/mmars/model_desc.py +++ b/monai/apps/mmars/model_desc.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Collection of the remote MMAR descriptors diff --git a/monai/apps/reconstruction/transforms/array.py b/monai/apps/reconstruction/transforms/array.py index 660eab396b..ed58439d29 100644 --- a/monai/apps/reconstruction/transforms/array.py +++ b/monai/apps/reconstruction/transforms/array.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from abc import abstractmethod from typing import Sequence diff --git a/monai/apps/reconstruction/transforms/dictionary.py b/monai/apps/reconstruction/transforms/dictionary.py index dfc7c1c504..baa9bdb2ce 100644 --- a/monai/apps/reconstruction/transforms/dictionary.py +++ b/monai/apps/reconstruction/transforms/dictionary.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Dict, Hashable, Mapping, Optional, Sequence import numpy as np diff --git a/monai/apps/tcia/label_desc.py b/monai/apps/tcia/label_desc.py index 582f83154a..e3875e4095 100644 --- a/monai/apps/tcia/label_desc.py +++ b/monai/apps/tcia/label_desc.py @@ -9,12 +9,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Dict __all__ = ["TCIA_LABEL_DICT"] - TCIA_LABEL_DICT: Dict[str, Dict[str, int]] = { "C4KC-KiTS": {"Kidney": 0, "Renal Tumor": 1}, "NSCLC-Radiomics": { diff --git a/monai/bundle/__main__.py b/monai/bundle/__main__.py index ace3701d19..a9671fe385 100644 --- a/monai/bundle/__main__.py +++ b/monai/bundle/__main__.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from monai.bundle.scripts import ckpt_export, download, init_bundle, run, verify_metadata, verify_net_in_out if __name__ == "__main__": diff --git a/monai/bundle/utils.py b/monai/bundle/utils.py index c3a8343163..f382fd820e 100644 --- a/monai/bundle/utils.py +++ b/monai/bundle/utils.py @@ -21,13 +21,11 @@ __all__ = ["ID_REF_KEY", "ID_SEP_KEY", "EXPR_KEY", "MACRO_KEY"] - ID_REF_KEY = "@" # start of a reference to a ConfigItem ID_SEP_KEY = "#" # separator for the ID of a ConfigItem EXPR_KEY = "$" # start of a ConfigExpression MACRO_KEY = "%" # start of a macro of a config - _conf_values = get_config_values() DEFAULT_METADATA = { diff --git a/monai/config/type_definitions.py b/monai/config/type_definitions.py index bb6f87e97a..5c360b5536 100644 --- a/monai/config/type_definitions.py +++ b/monai/config/type_definitions.py @@ -41,7 +41,6 @@ "SequenceStr", ] - #: KeysCollection # # The KeyCollection type is used to for defining variables diff --git a/monai/data/box_utils.py b/monai/data/box_utils.py index 3aaedb3850..a1e321b623 100644 --- a/monai/data/box_utils.py +++ b/monai/data/box_utils.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ This utility module mainly supports rectangular bounding boxes with a few different parameterizations and methods for converting between them. It @@ -36,7 +35,6 @@ # We support 2-D or 3-D bounding boxes SUPPORTED_SPATIAL_DIMS = [2, 3] - # TO_REMOVE = 0.0 if the bottom-right corner pixel/voxel is not included in the boxes, # i.e., when xmin=1., xmax=2., we have w = 1. # TO_REMOVE = 1.0 if the bottom-right corner pixel/voxel is included in the boxes, diff --git a/monai/data/dataset.py b/monai/data/dataset.py index 0298ee9b4c..22e8bdb610 100644 --- a/monai/data/dataset.py +++ b/monai/data/dataset.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import collections.abc import math import pickle diff --git a/monai/data/image_writer.py b/monai/data/image_writer.py index cf7f3e0291..28465f35a4 100644 --- a/monai/data/image_writer.py +++ b/monai/data/image_writer.py @@ -46,7 +46,6 @@ nib, _ = optional_import("nibabel") PILImage, _ = optional_import("PIL.Image") - __all__ = [ "ImageWriter", "ITKWriter", diff --git a/monai/data/thread_buffer.py b/monai/data/thread_buffer.py index 964ea21be3..0a9079ae0c 100644 --- a/monai/data/thread_buffer.py +++ b/monai/data/thread_buffer.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from multiprocessing.context import SpawnContext from queue import Empty, Full, Queue from threading import Thread diff --git a/monai/data/utils.py b/monai/data/utils.py index 40f3de4831..0fb5c9a33a 100644 --- a/monai/data/utils.py +++ b/monai/data/utils.py @@ -52,7 +52,6 @@ DataFrame, _ = optional_import("pandas", name="DataFrame") nib, _ = optional_import("nibabel") - __all__ = [ "AFFINE_TOL", "SUPPORTED_PICKLE_MOD", diff --git a/monai/handlers/logfile_handler.py b/monai/handlers/logfile_handler.py index d46ac8760f..73c58431a9 100644 --- a/monai/handlers/logfile_handler.py +++ b/monai/handlers/logfile_handler.py @@ -22,7 +22,6 @@ else: Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") - __all__ = ["LogfileHandler"] diff --git a/monai/handlers/nvtx_handlers.py b/monai/handlers/nvtx_handlers.py index 327c156f63..66462a698c 100644 --- a/monai/handlers/nvtx_handlers.py +++ b/monai/handlers/nvtx_handlers.py @@ -24,7 +24,6 @@ Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events") - __all__ = ["RangeHandler", "RangePushHandler", "RangePopHandler", "MarkHandler"] diff --git a/monai/losses/contrastive.py b/monai/losses/contrastive.py index 7292b4bc56..ad53269f82 100644 --- a/monai/losses/contrastive.py +++ b/monai/losses/contrastive.py @@ -19,7 +19,6 @@ class ContrastiveLoss(_Loss): - """ Compute the Contrastive loss defined in: diff --git a/monai/losses/giou_loss.py b/monai/losses/giou_loss.py index ec7e358f42..623e55921b 100644 --- a/monai/losses/giou_loss.py +++ b/monai/losses/giou_loss.py @@ -19,7 +19,6 @@ class BoxGIoULoss(_Loss): - """ Compute the generalized intersection over union (GIoU) loss of a pair of boxes. The two inputs should have the same shape. giou_loss = 1.0 - giou diff --git a/monai/losses/ssim_loss.py b/monai/losses/ssim_loss.py index 240023cdc4..4a1ceb5a16 100644 --- a/monai/losses/ssim_loss.py +++ b/monai/losses/ssim_loss.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import torch import torch.nn.functional as F from torch import nn diff --git a/monai/losses/tversky.py b/monai/losses/tversky.py index ee6d7d933b..a0735c24e0 100644 --- a/monai/losses/tversky.py +++ b/monai/losses/tversky.py @@ -20,7 +20,6 @@ class TverskyLoss(_Loss): - """ Compute the Tversky loss defined in: diff --git a/monai/metrics/froc.py b/monai/metrics/froc.py index 93ad625b90..56e0755b99 100644 --- a/monai/metrics/froc.py +++ b/monai/metrics/froc.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import List, Optional, Tuple, Union import numpy as np diff --git a/monai/networks/blocks/backbone_fpn_utils.py b/monai/networks/blocks/backbone_fpn_utils.py index c663485583..145a4ac2e1 100644 --- a/monai/networks/blocks/backbone_fpn_utils.py +++ b/monai/networks/blocks/backbone_fpn_utils.py @@ -43,7 +43,6 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """ This script is modified from from torchvision to support N-D images, by overriding the definition of convolutional layers and pooling layers. diff --git a/monai/networks/blocks/dints_block.py b/monai/networks/blocks/dints_block.py index b7365f50e3..1823845adf 100644 --- a/monai/networks/blocks/dints_block.py +++ b/monai/networks/blocks/dints_block.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Tuple, Union import torch diff --git a/monai/networks/blocks/feature_pyramid_network.py b/monai/networks/blocks/feature_pyramid_network.py index 13897a51a0..f950321297 100644 --- a/monai/networks/blocks/feature_pyramid_network.py +++ b/monai/networks/blocks/feature_pyramid_network.py @@ -43,7 +43,6 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """ This script is modified from from torchvision to support N-D images, by overriding the definition of convolutional layers and pooling layers. diff --git a/monai/networks/blocks/unetr_block.py b/monai/networks/blocks/unetr_block.py index a9d871a644..452a535a2a 100644 --- a/monai/networks/blocks/unetr_block.py +++ b/monai/networks/blocks/unetr_block.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Sequence, Tuple, Union import torch diff --git a/monai/networks/layers/factories.py b/monai/networks/layers/factories.py index 4cde478f7a..a58dbc161f 100644 --- a/monai/networks/layers/factories.py +++ b/monai/networks/layers/factories.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Defines factories for creating layers in generic, extensible, and dimensionally independent ways. A separate factory object is created for each type of layer, and factory functions keyed to names are added to these objects. Whenever @@ -70,7 +69,6 @@ def use_factory(fact_args): InstanceNorm3dNVFuser, has_nvfuser = optional_import("apex.normalization", name="InstanceNorm3dNVFuser") - __all__ = ["LayerFactory", "Dropout", "Norm", "Act", "Conv", "Pool", "Pad", "split_args"] diff --git a/monai/networks/nets/dints.py b/monai/networks/nets/dints.py index b7f3921a47..334d0abf0d 100644 --- a/monai/networks/nets/dints.py +++ b/monai/networks/nets/dints.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import warnings from typing import List, Optional, Tuple, Union diff --git a/monai/networks/nets/dynunet.py b/monai/networks/nets/dynunet.py index 053ab255b8..ad7251241b 100644 --- a/monai/networks/nets/dynunet.py +++ b/monai/networks/nets/dynunet.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import List, Optional, Sequence, Tuple, Union import torch diff --git a/monai/networks/nets/senet.py b/monai/networks/nets/senet.py index 8933cbe7e9..b4c024b1f2 100644 --- a/monai/networks/nets/senet.py +++ b/monai/networks/nets/senet.py @@ -34,7 +34,6 @@ "SE_NET_MODELS", ] - SE_NET_MODELS = { "senet154": "http://data.lip6.fr/cadene/pretrainedmodels/senet154-c7b49a05.pth", "se_resnet50": "http://data.lip6.fr/cadene/pretrainedmodels/se_resnet50-ce0d4300.pth", diff --git a/monai/networks/nets/torchvision_fc.py b/monai/networks/nets/torchvision_fc.py index 50436e8516..85103a2c04 100644 --- a/monai/networks/nets/torchvision_fc.py +++ b/monai/networks/nets/torchvision_fc.py @@ -16,7 +16,6 @@ models, _ = optional_import("torchvision.models") - __all__ = ["TorchVisionFCModel"] diff --git a/monai/networks/nets/vit.py b/monai/networks/nets/vit.py index 971a7bd126..e4166c78b6 100644 --- a/monai/networks/nets/vit.py +++ b/monai/networks/nets/vit.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Sequence, Union import torch diff --git a/monai/networks/nets/vitautoenc.py b/monai/networks/nets/vitautoenc.py index 9e5490f9d6..6197f6bd99 100644 --- a/monai/networks/nets/vitautoenc.py +++ b/monai/networks/nets/vitautoenc.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Sequence, Union import torch diff --git a/monai/transforms/adaptors.py b/monai/transforms/adaptors.py index 92fd11cf79..1edbcc63e2 100644 --- a/monai/transforms/adaptors.py +++ b/monai/transforms/adaptors.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ How to use the adaptor function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/monai/transforms/signal/array.py b/monai/transforms/signal/array.py index 6b904ad1c5..07f29a3039 100644 --- a/monai/transforms/signal/array.py +++ b/monai/transforms/signal/array.py @@ -34,7 +34,6 @@ central_frequency, has_central_frequency = optional_import("pywt", name="central_frequency") cwt, has_cwt = optional_import("pywt", name="cwt") - __all__ = [ "SignalRandDrop", "SignalRandScale", diff --git a/monai/transforms/smooth_field/array.py b/monai/transforms/smooth_field/array.py index 3f6ddf7704..13507339e1 100644 --- a/monai/transforms/smooth_field/array.py +++ b/monai/transforms/smooth_field/array.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """Transforms using a smooth spatial field generated by interpolating from smaller randomized fields.""" from typing import Any, Optional, Sequence, Union diff --git a/monai/transforms/smooth_field/dictionary.py b/monai/transforms/smooth_field/dictionary.py index eb975ceb04..08fb71edb4 100644 --- a/monai/transforms/smooth_field/dictionary.py +++ b/monai/transforms/smooth_field/dictionary.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Any, Hashable, Mapping, Optional, Sequence, Union import numpy as np diff --git a/monai/transforms/utility/array.py b/monai/transforms/utility/array.py index 8d891958de..7a1f86c1e0 100644 --- a/monai/transforms/utility/array.py +++ b/monai/transforms/utility/array.py @@ -58,7 +58,6 @@ pil_image_fromarray, _ = optional_import("PIL.Image", name="fromarray") cp, has_cp = optional_import("cupy") - __all__ = [ "Identity", "AsChannelFirst", diff --git a/monai/utils/aliases.py b/monai/utils/aliases.py index 0ae79e26ff..1a63c3aba8 100644 --- a/monai/utils/aliases.py +++ b/monai/utils/aliases.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ This module is written for configurable workflow, not currently in use. """ diff --git a/monai/utils/jupyter_utils.py b/monai/utils/jupyter_utils.py index bc7d703d4b..f9eb00aa02 100644 --- a/monai/utils/jupyter_utils.py +++ b/monai/utils/jupyter_utils.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ This set of utility function is meant to make using Jupyter notebooks easier with MONAI. Plotting functions using Matplotlib produce common plots for metrics and images. diff --git a/monai/utils/type_conversion.py b/monai/utils/type_conversion.py index cf86e2bde7..33c7bb5f3b 100644 --- a/monai/utils/type_conversion.py +++ b/monai/utils/type_conversion.py @@ -36,7 +36,6 @@ "convert_to_dst_type", ] - # conversion map for types unsupported by torch.as_tensor UNSUPPORTED_TYPES = {np.dtype("uint16"): np.int32, np.dtype("uint32"): np.int64, np.dtype("uint64"): np.int64} diff --git a/monai/visualize/gradient_based.py b/monai/visualize/gradient_based.py index 106378dff2..7f4ddce1d0 100644 --- a/monai/visualize/gradient_based.py +++ b/monai/visualize/gradient_based.py @@ -22,7 +22,6 @@ trange, has_trange = optional_import("tqdm", name="trange") - __all__ = ["VanillaGrad", "SmoothGrad", "GuidedBackpropGrad", "GuidedBackpropSmoothGrad"] diff --git a/monai/visualize/visualizer.py b/monai/visualize/visualizer.py index 5f19e4f63f..05ebb2e280 100644 --- a/monai/visualize/visualizer.py +++ b/monai/visualize/visualizer.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - from typing import Callable import torch diff --git a/tests/profile_subclass/cprofile_profiling.py b/tests/profile_subclass/cprofile_profiling.py index a6c940c9c0..0befa0f450 100644 --- a/tests/profile_subclass/cprofile_profiling.py +++ b/tests/profile_subclass/cprofile_profiling.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Profiling MetaTensor """ diff --git a/tests/profile_subclass/min_classes.py b/tests/profile_subclass/min_classes.py index 87c0ce671d..702ba73e21 100644 --- a/tests/profile_subclass/min_classes.py +++ b/tests/profile_subclass/min_classes.py @@ -8,8 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - - """ Minimal subclassing as baselines Adapted from https://github.com/pytorch/pytorch/tree/v1.11.0/benchmarks/overrides_benchmark diff --git a/tests/profile_subclass/profiling.py b/tests/profile_subclass/profiling.py index 28740e82e1..46047b619c 100644 --- a/tests/profile_subclass/profiling.py +++ b/tests/profile_subclass/profiling.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Comparing torch.Tensor, SubTensor, SubWithTorchFunc, MetaTensor Adapted from https://github.com/pytorch/pytorch/tree/v1.11.0/benchmarks/overrides_benchmark diff --git a/tests/profile_subclass/pyspy_profiling.py b/tests/profile_subclass/pyspy_profiling.py index 302bfd39c3..1caeee69e7 100644 --- a/tests/profile_subclass/pyspy_profiling.py +++ b/tests/profile_subclass/pyspy_profiling.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ To be used with py-spy, comparing torch.Tensor, SubTensor, SubWithTorchFunc, MetaTensor Adapted from https://github.com/pytorch/pytorch/tree/v1.11.0/benchmarks/overrides_benchmark diff --git a/tests/test_affine_grid.py b/tests/test_affine_grid.py index b481601df5..23651c8b6b 100644 --- a/tests/test_affine_grid.py +++ b/tests/test_affine_grid.py @@ -129,7 +129,6 @@ ] ) - _rtol = 5e-2 if is_tf32_env() else 1e-4 diff --git a/tests/test_cachedataset.py b/tests/test_cachedataset.py index 4fa1b5ea69..e30a34b335 100644 --- a/tests/test_cachedataset.py +++ b/tests/test_cachedataset.py @@ -26,7 +26,6 @@ TEST_CASE_2 = [None, (128, 128, 128)] - TEST_DS = [] for c in (0, 1, 2): for l in (0, 1, 2): diff --git a/tests/test_cast_to_typed.py b/tests/test_cast_to_typed.py index 4c7623a9e0..1ac23314a5 100644 --- a/tests/test_cast_to_typed.py +++ b/tests/test_cast_to_typed.py @@ -36,7 +36,6 @@ {"img": torch.float64, "seg": torch.int8}, ] - TESTS_CUPY = [ [ {"keys": "image", "dtype": np.uint8}, diff --git a/tests/test_center_scale_crop.py b/tests/test_center_scale_crop.py index ab07a44eb5..3fe7a453d3 100644 --- a/tests/test_center_scale_crop.py +++ b/tests/test_center_scale_crop.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import numpy as np diff --git a/tests/test_center_scale_cropd.py b/tests/test_center_scale_cropd.py index 894692530d..088c1c70e7 100644 --- a/tests/test_center_scale_cropd.py +++ b/tests/test_center_scale_cropd.py @@ -23,7 +23,6 @@ [{"keys": "img", "roi_scale": 0.5}, (3, 3, 3, 3), (3, 2, 2, 2)], ] - TEST_VALUES = [ [ {"keys": "img", "roi_scale": [0.4, 0.4]}, diff --git a/tests/test_compute_ho_ver_maps.py b/tests/test_compute_ho_ver_maps.py index f5091a57af..5c4674dd04 100644 --- a/tests/test_compute_ho_ver_maps.py +++ b/tests/test_compute_ho_ver_maps.py @@ -21,7 +21,6 @@ _, has_skimage = optional_import("skimage", "0.19.0", min_version) - INSTANCE_MASK = np.zeros((1, 16, 16), dtype="int16") INSTANCE_MASK[:, 5:8, 4:11] = 1 INSTANCE_MASK[:, 3:5, 6:9] = 1 diff --git a/tests/test_compute_ho_ver_maps_d.py b/tests/test_compute_ho_ver_maps_d.py index 3c20c7f200..475e50bc70 100644 --- a/tests/test_compute_ho_ver_maps_d.py +++ b/tests/test_compute_ho_ver_maps_d.py @@ -21,7 +21,6 @@ _, has_skimage = optional_import("skimage", "0.19.0", min_version) - INSTANCE_MASK = np.zeros((1, 16, 16), dtype="int16") INSTANCE_MASK[:, 5:8, 4:11] = 1 INSTANCE_MASK[:, 3:5, 6:9] = 1 diff --git a/tests/test_config_parser.py b/tests/test_config_parser.py index 18c91d719c..d02a05c914 100644 --- a/tests/test_config_parser.py +++ b/tests/test_config_parser.py @@ -87,7 +87,6 @@ def __call__(self, a, b): } ] - TEST_CASE_3 = [ { "A": 1, diff --git a/tests/test_convert_data_type.py b/tests/test_convert_data_type.py index b49e7ebd52..d411f3f972 100644 --- a/tests/test_convert_data_type.py +++ b/tests/test_convert_data_type.py @@ -39,7 +39,6 @@ ) ) - UNSUPPORTED_TYPES = {np.dtype("uint16"): torch.int32, np.dtype("uint32"): torch.int64, np.dtype("uint64"): torch.int64} diff --git a/tests/test_cucim_dict_transform.py b/tests/test_cucim_dict_transform.py index f8b54c3147..4a6d2f9d51 100644 --- a/tests/test_cucim_dict_transform.py +++ b/tests/test_cucim_dict_transform.py @@ -41,7 +41,6 @@ np.array([[[1.0, 0.0], [3.0, 2.0]], [[1.0, 0.0], [3.0, 2.0]], [[1.0, 0.0], [3.0, 2.0]]], dtype=np.float32), ] - TEST_CASE_ROTATE_1 = [ {"name": "image_rotate_90", "k": 1, "spatial_axis": (-2, -1)}, np.array([[[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]]], dtype=np.float32), diff --git a/tests/test_cucim_transform.py b/tests/test_cucim_transform.py index 2bf9791bce..dd73ad94c0 100644 --- a/tests/test_cucim_transform.py +++ b/tests/test_cucim_transform.py @@ -41,7 +41,6 @@ np.array([[[1.0, 0.0], [3.0, 2.0]], [[1.0, 0.0], [3.0, 2.0]], [[1.0, 0.0], [3.0, 2.0]]], dtype=np.float32), ] - TEST_CASE_ROTATE_1 = [ {"name": "image_rotate_90", "k": 1, "spatial_axis": (-2, -1)}, np.array([[[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]]], dtype=np.float32), diff --git a/tests/test_decollate.py b/tests/test_decollate.py index a634471be5..538eb38311 100644 --- a/tests/test_decollate.py +++ b/tests/test_decollate.py @@ -55,7 +55,6 @@ TESTS_LIST.append((RandRotate90(prob=0.0, max_k=1),)) TESTS_LIST.append((RandAffine(prob=0.0, translate_range=10),)) - TEST_BASIC = [ [("channel", "channel"), ["channel", "channel"]], [torch.Tensor([1, 2, 3]), [torch.tensor(1.0), torch.tensor(2.0), torch.tensor(3.0)]], diff --git a/tests/test_deepedit_transforms.py b/tests/test_deepedit_transforms.py index 3d4870d2fd..f608a4342f 100644 --- a/tests/test_deepedit_transforms.py +++ b/tests/test_deepedit_transforms.py @@ -140,7 +140,6 @@ DATA_11 = {"image": IMAGE, "label": LABEL, "label_names": LABEL_NAMES, "pred": PRED} - ADD_GUIDANCE_FROM_POINTS_TEST_CASE = [ {"ref_image": "image", "guidance": "guidance", "label_names": LABEL_NAMES}, # arguments DATA_4, # input_data diff --git a/tests/test_densenet.py b/tests/test_densenet.py index 47f584297e..66f27cba51 100644 --- a/tests/test_densenet.py +++ b/tests/test_densenet.py @@ -28,7 +28,6 @@ else: torchvision, has_torchvision = optional_import("torchvision") - device = "cuda" if torch.cuda.is_available() else "cpu" TEST_CASE_1 = [ # 4-channel 3D, batch 2 @@ -54,10 +53,8 @@ for model in [DenseNet121, Densenet169, densenet201, DenseNet264]: TEST_CASES.append([model, *case]) - TEST_SCRIPT_CASES = [[model, *TEST_CASE_1] for model in [DenseNet121, Densenet169, densenet201, DenseNet264]] - TEST_PRETRAINED_2D_CASE_1 = [ # 4-channel 2D, batch 2 DenseNet121, {"pretrained": True, "progress": True, "spatial_dims": 2, "in_channels": 2, "out_channels": 3}, diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py index 3d27994404..c94c300175 100644 --- a/tests/test_deprecated.py +++ b/tests/test_deprecated.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import warnings diff --git a/tests/test_fill_holes.py b/tests/test_fill_holes.py index 4292ff3a22..688c65005e 100644 --- a/tests/test_fill_holes.py +++ b/tests/test_fill_holes.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch diff --git a/tests/test_fill_holesd.py b/tests/test_fill_holesd.py index fce90fd86a..7711df36b3 100644 --- a/tests/test_fill_holesd.py +++ b/tests/test_fill_holesd.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch diff --git a/tests/test_fl_exchange_object.py b/tests/test_fl_exchange_object.py index 7c8087da27..bb2d0372db 100644 --- a/tests/test_fl_exchange_object.py +++ b/tests/test_fl_exchange_object.py @@ -21,7 +21,6 @@ models, has_torchvision = optional_import("torchvision.models") - TEST_INIT_1 = [{"weights": None, "optim": None, "metrics": None, "weight_type": None, "statistics": None}, "{}"] TEST_INIT_2: list = [] if has_torchvision: diff --git a/tests/test_fl_monai_algo.py b/tests/test_fl_monai_algo.py index 8c2709c582..66722d0086 100644 --- a/tests/test_fl_monai_algo.py +++ b/tests/test_fl_monai_algo.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import json import os import unittest diff --git a/tests/test_get_unique_labels.py b/tests/test_get_unique_labels.py index 9bc6f9b152..67953a3205 100644 --- a/tests/test_get_unique_labels.py +++ b/tests/test_get_unique_labels.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch diff --git a/tests/test_globalnet.py b/tests/test_globalnet.py index ef0209e397..4a3e9c124c 100644 --- a/tests/test_globalnet.py +++ b/tests/test_globalnet.py @@ -40,7 +40,6 @@ ], ] - TEST_CASES_GLOBAL_NET = [ [ { diff --git a/tests/test_handler_confusion_matrix_dist.py b/tests/test_handler_confusion_matrix_dist.py index 325a799098..511e84d22a 100644 --- a/tests/test_handler_confusion_matrix_dist.py +++ b/tests/test_handler_confusion_matrix_dist.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import numpy as np diff --git a/tests/test_handler_garbage_collector.py b/tests/test_handler_garbage_collector.py index 0350ba62fb..e3bc3411b9 100644 --- a/tests/test_handler_garbage_collector.py +++ b/tests/test_handler_garbage_collector.py @@ -24,7 +24,6 @@ Events, has_ignite = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events") - TEST_CASE_0 = [[0, 1, 2], "epoch"] TEST_CASE_1 = [[0, 1, 2], "iteration"] diff --git a/tests/test_handler_mean_dice.py b/tests/test_handler_mean_dice.py index 587062c3b3..88eb4fbdcd 100644 --- a/tests/test_handler_mean_dice.py +++ b/tests/test_handler_mean_dice.py @@ -33,6 +33,7 @@ class TestHandlerMeanDice(unittest.TestCase): @parameterized.expand([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3]) def test_compute(self, input_params, expected_avg, details_shape): dice_metric = MeanDice(**input_params) + # set up engine def _val_func(engine, batch): diff --git a/tests/test_handler_mean_iou.py b/tests/test_handler_mean_iou.py index 4b0bfb09c3..fdd4a5d04d 100644 --- a/tests/test_handler_mean_iou.py +++ b/tests/test_handler_mean_iou.py @@ -33,6 +33,7 @@ class TestHandlerMeanIoU(unittest.TestCase): @parameterized.expand([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3]) def test_compute(self, input_params, expected_avg, details_shape): iou_metric = MeanIoUHandler(**input_params) + # set up engine def _val_func(engine, batch): diff --git a/tests/test_handler_metrics_saver_dist.py b/tests/test_handler_metrics_saver_dist.py index a92fdf93d3..426d99c223 100644 --- a/tests/test_handler_metrics_saver_dist.py +++ b/tests/test_handler_metrics_saver_dist.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import csv import os import tempfile diff --git a/tests/test_handler_rocauc_dist.py b/tests/test_handler_rocauc_dist.py index 5113911d7c..994cbe139b 100644 --- a/tests/test_handler_rocauc_dist.py +++ b/tests/test_handler_rocauc_dist.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import numpy as np diff --git a/tests/test_integration_stn.py b/tests/test_integration_stn.py index e655ff6755..5b9b22668a 100644 --- a/tests/test_integration_stn.py +++ b/tests/test_integration_stn.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import numpy as np diff --git a/tests/test_label_filter.py b/tests/test_label_filter.py index b782f90441..42aa419b1d 100644 --- a/tests/test_label_filter.py +++ b/tests/test_label_filter.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch @@ -51,7 +50,6 @@ VALID_TESTS.append(["filter_all", {"applied_labels": [1, 2, 3, 4, 5, 6, 7, 8, 9]}, p(grid_1), p(grid_1)]) - ITEST_CASE_1 = ["invalid_image_data_type", {"applied_labels": 1}, [[[[1, 1, 1]]]], NotImplementedError] INVALID_CASES = [ITEST_CASE_1] diff --git a/tests/test_label_filterd.py b/tests/test_label_filterd.py index d53dc21faf..eea18d0278 100644 --- a/tests/test_label_filterd.py +++ b/tests/test_label_filterd.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch @@ -51,7 +50,6 @@ VALID_TESTS.append(["filter_all", {"applied_labels": [1, 2, 3, 4, 5, 6, 7, 8, 9]}, p(grid_1), p(grid_1)]) - ITEST_CASE_1 = ["invalid_image_data_type", {"applied_labels": 1}, [[[[1, 1, 1]]]], NotImplementedError] INVALID_CASES = [ITEST_CASE_1] diff --git a/tests/test_lesion_froc.py b/tests/test_lesion_froc.py index b135b3eaeb..8c9f751b1e 100644 --- a/tests/test_lesion_froc.py +++ b/tests/test_lesion_froc.py @@ -114,7 +114,6 @@ def prepare_test_data(): np.nan, ] - TEST_CASE_1 = [ { "data": [ @@ -163,7 +162,6 @@ def prepare_test_data(): 1.0, ] - TEST_CASE_4 = [ { "data": [ @@ -196,7 +194,6 @@ def prepare_test_data(): 0.5, ] - TEST_CASE_6 = [ { "data": [ diff --git a/tests/test_load_image.py b/tests/test_load_image.py index cc227021a2..7dffa845ba 100644 --- a/tests/test_load_image.py +++ b/tests/test_load_image.py @@ -83,7 +83,6 @@ def get_data(self, _obj): (384, 128, 128), ] - TEST_CASE_9 = [ {"reader": ITKReader()}, ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], @@ -141,7 +140,6 @@ def get_data(self, _obj): # test reader consistency between PydicomReader and ITKReader on dicom data TEST_CASE_22 = ["tests/testing_data/CT_DICOM"] - TESTS_META = [] for track_meta in (False, True): TESTS_META.append([{}, (128, 128, 128), track_meta]) diff --git a/tests/test_loader_semaphore.py b/tests/test_loader_semaphore.py index bbb2d4eef6..85cf5593f8 100644 --- a/tests/test_loader_semaphore.py +++ b/tests/test_loader_semaphore.py @@ -8,7 +8,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """this test should not generate errors or UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores""" import multiprocessing as mp diff --git a/tests/test_local_normalized_cross_correlation_loss.py b/tests/test_local_normalized_cross_correlation_loss.py index 93e0281885..394e514f43 100644 --- a/tests/test_local_normalized_cross_correlation_loss.py +++ b/tests/test_local_normalized_cross_correlation_loss.py @@ -147,6 +147,5 @@ def test_ill_opts(self): # loss = LocalNormalizedCrossCorrelationLoss(**input_param) # test_script_save(loss, input_data["pred"], input_data["target"]) - if __name__ == "__main__": unittest.main() diff --git a/tests/test_localnet.py b/tests/test_localnet.py index 1a288fb447..9296edab99 100644 --- a/tests/test_localnet.py +++ b/tests/test_localnet.py @@ -20,7 +20,6 @@ device = "cuda" if torch.cuda.is_available() else "cpu" - TEST_CASE_LOCALNET_2D = [ [ { diff --git a/tests/test_masked_inference_wsi_dataset.py b/tests/test_masked_inference_wsi_dataset.py index 85683ea88c..661f728e47 100644 --- a/tests/test_masked_inference_wsi_dataset.py +++ b/tests/test_masked_inference_wsi_dataset.py @@ -134,7 +134,6 @@ def prepare_data(): ], ] - TEST_CASE_OPENSLIDE_0 = [ {"data": [{"image": FILE_PATH, "mask": MASK1}], "patch_size": 1, "image_reader_name": "OpenSlide"}, [{"image": np.array([[[243]], [[243]], [[243]]], dtype=np.uint8), "name": FILE_NAME, "mask_location": [100, 100]}], diff --git a/tests/test_masked_patch_wsi_dataset.py b/tests/test_masked_patch_wsi_dataset.py index e0846c867b..9783c2d7cf 100644 --- a/tests/test_masked_patch_wsi_dataset.py +++ b/tests/test_masked_patch_wsi_dataset.py @@ -30,7 +30,6 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec - FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" diff --git a/tests/test_milmodel.py b/tests/test_milmodel.py index 3a6ea9a1bd..2d58af4a2b 100644 --- a/tests/test_milmodel.py +++ b/tests/test_milmodel.py @@ -23,7 +23,6 @@ device = "cuda" if torch.cuda.is_available() else "cpu" - TEST_CASE_MILMODEL = [] for num_classes in [1, 5]: for mil_mode in ["mean", "max", "att", "att_trans", "att_trans_pyramid"]: @@ -34,7 +33,6 @@ ] TEST_CASE_MILMODEL.append(test_case) - for trans_blocks in [1, 3]: test_case = [ {"num_classes": 5, "pretrained": False, "trans_blocks": trans_blocks, "trans_dropout": 0.5}, diff --git a/tests/test_nvtx_decorator.py b/tests/test_nvtx_decorator.py index 9932b678c9..7dd2dd81b5 100644 --- a/tests/test_nvtx_decorator.py +++ b/tests/test_nvtx_decorator.py @@ -39,7 +39,6 @@ _, has_tvt = optional_import("torchvision.transforms") _, has_cut = optional_import("cucim.core.operations.expose.transform") - TEST_CASE_ARRAY_0 = [np.random.randn(3, 3)] TEST_CASE_ARRAY_1 = [np.random.randn(3, 10, 10)] diff --git a/tests/test_nvtx_transform.py b/tests/test_nvtx_transform.py index 01a069ed8a..fd784f6d32 100644 --- a/tests/test_nvtx_transform.py +++ b/tests/test_nvtx_transform.py @@ -34,7 +34,6 @@ _, has_nvtx = optional_import("torch._C._nvtx", descriptor="NVTX is not installed. Are you sure you have a CUDA build?") - TEST_CASE_ARRAY_0 = [np.random.randn(3, 3)] TEST_CASE_ARRAY_1 = [np.random.randn(3, 10, 10)] TEST_CASE_DICT_0 = [{"image": np.random.randn(3, 3)}] diff --git a/tests/test_occlusion_sensitivity.py b/tests/test_occlusion_sensitivity.py index cedc8ed1a3..5239e120e5 100644 --- a/tests/test_occlusion_sensitivity.py +++ b/tests/test_occlusion_sensitivity.py @@ -40,7 +40,6 @@ def __call__(self, x, adjoint_info): model_3d.eval() model_2d_adjoint.eval() - TESTS: List[Any] = [] TESTS_FAIL: List[Any] = [] diff --git a/tests/test_one_of.py b/tests/test_one_of.py index 8171acb6da..2ea41c6e50 100644 --- a/tests/test_one_of.py +++ b/tests/test_one_of.py @@ -140,6 +140,7 @@ def test_len_and_flatten(self): def test_compose_flatten_does_not_affect_one_of(self): p = Compose([A(), B(), OneOf([C(), Inv(KEYS), Compose([X(), Y()])])]) f = p.flatten() + # in this case the flattened transform should be the same. def _match(a, b): diff --git a/tests/test_ori_ras_lps.py b/tests/test_ori_ras_lps.py index 4ed223bf5b..d0a9b034e4 100644 --- a/tests/test_ori_ras_lps.py +++ b/tests/test_ori_ras_lps.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import numpy as np diff --git a/tests/test_orientation.py b/tests/test_orientation.py index 7c4a1863c7..979f6ae485 100644 --- a/tests/test_orientation.py +++ b/tests/test_orientation.py @@ -167,7 +167,6 @@ for device in TEST_DEVICES: TESTS_TORCH.append([{"axcodes": "LPS"}, torch.zeros((1, 3, 4, 5)), track_meta, *device]) - ILL_CASES = [ # too short axcodes [{"axcodes": "RA"}, torch.arange(12).reshape((2, 1, 2, 3)), torch.eye(4)] diff --git a/tests/test_patch_wsi_dataset.py b/tests/test_patch_wsi_dataset.py index 8f1ec12990..0ba1a4a649 100644 --- a/tests/test_patch_wsi_dataset.py +++ b/tests/test_patch_wsi_dataset.py @@ -71,7 +71,6 @@ [{"image": np.array([[[239]], [[239]], [[239]]], dtype=np.uint8), "label": np.array([[[1]]])}], ] - TEST_CASE_DEP_1 = [ { "data": [{"image": FILE_PATH, WSIPatchKeys.LOCATION.value: [10004, 20004], "label": [0, 0, 0, 1]}], @@ -88,7 +87,6 @@ ], ] - TEST_CASE_DEP_1_L0 = [ { "data": [{"image": FILE_PATH, WSIPatchKeys.LOCATION.value: [10004, 20004], "label": [0, 0, 0, 1]}], @@ -106,7 +104,6 @@ ], ] - TEST_CASE_DEP_1_L1 = [ { "data": [{"image": FILE_PATH, WSIPatchKeys.LOCATION.value: [10004, 20004], "label": [0, 0, 0, 1]}], @@ -180,7 +177,6 @@ [{"image": np.array([[[239]], [[239]], [[239]]], dtype=np.uint8), "label": np.array([[[1]]])}], ] - TEST_CASE_DEP_OPENSLIDE_0_L2 = [ { "data": [{"image": FILE_PATH, WSIPatchKeys.LOCATION.value: [0, 0], "label": [1]}], @@ -209,7 +205,6 @@ ], ] - TEST_CASE_0 = [ { "data": [{"image": FILE_PATH, WSIPatchKeys.LOCATION.value: [0, 0], "label": [1], "patch_level": 0}], diff --git a/tests/test_pathology_he_stain.py b/tests/test_pathology_he_stain.py index 7b884315fc..ac4e94144a 100644 --- a/tests/test_pathology_he_stain.py +++ b/tests/test_pathology_he_stain.py @@ -49,7 +49,6 @@ np.array([[0.70710677, 0.18696113], [0.0, 0.0], [0.70710677, 0.98236734]]), ] - # input pixels all transparent and below the beta absorbance threshold NORMALIZE_STAINS_TEST_CASE_1 = [np.full((3, 2, 3), 240)] diff --git a/tests/test_prepare_batch_default_dist.py b/tests/test_prepare_batch_default_dist.py index 95d01d2a16..3c7532e916 100644 --- a/tests/test_prepare_batch_default_dist.py +++ b/tests/test_prepare_batch_default_dist.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest import torch diff --git a/tests/test_pytorch_version_after.py b/tests/test_pytorch_version_after.py index 68abb9571f..be43e49f82 100644 --- a/tests/test_pytorch_version_after.py +++ b/tests/test_pytorch_version_after.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import unittest from parameterized import parameterized diff --git a/tests/test_rand_cucim_dict_transform.py b/tests/test_rand_cucim_dict_transform.py index a109bee845..e72101e470 100644 --- a/tests/test_rand_cucim_dict_transform.py +++ b/tests/test_rand_cucim_dict_transform.py @@ -41,7 +41,6 @@ np.array([[[1.0, 3.0], [0.0, 2.0]], [[1.0, 3.0], [0.0, 2.0]], [[1.0, 3.0], [0.0, 2.0]]], dtype=np.float32), ] - TEST_CASE_RAND_ROTATE_2 = [ {"name": "rand_image_rotate_90", "prob": 0.0, "max_k": 1, "spatial_axis": (-2, -1)}, np.array([[[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]]], dtype=np.float32), diff --git a/tests/test_rand_cucim_transform.py b/tests/test_rand_cucim_transform.py index 30164e4170..0f37b3f6cb 100644 --- a/tests/test_rand_cucim_transform.py +++ b/tests/test_rand_cucim_transform.py @@ -41,7 +41,6 @@ np.array([[[1.0, 3.0], [0.0, 2.0]], [[1.0, 3.0], [0.0, 2.0]], [[1.0, 3.0], [0.0, 2.0]]], dtype=np.float32), ] - TEST_CASE_RAND_ROTATE_2 = [ {"name": "rand_image_rotate_90", "prob": 0.0, "max_k": 1, "spatial_axis": (-2, -1)}, np.array([[[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]], [[0.0, 1.0], [2.0, 3.0]]], dtype=np.float32), diff --git a/tests/test_rand_rotated.py b/tests/test_rand_rotated.py index a22c33187b..e19f8a513f 100644 --- a/tests/test_rand_rotated.py +++ b/tests/test_rand_rotated.py @@ -28,7 +28,6 @@ TEST_CASES_2D.append((p, np.pi, False, "nearest", "zeros", True)) TEST_CASES_2D.append((p, (-np.pi / 4, 0), False, "nearest", "zeros", True)) - TEST_CASES_3D: List[Tuple] = [] for p in TEST_NDARRAYS_ALL: TEST_CASES_3D.append( diff --git a/tests/test_rand_weighted_crop.py b/tests/test_rand_weighted_crop.py index 53913ce987..2e1fcad4b2 100644 --- a/tests/test_rand_weighted_crop.py +++ b/tests/test_rand_weighted_crop.py @@ -28,7 +28,6 @@ def get_data(ndim): IMT_2D, SEG1_2D, SEGN_2D = get_data(ndim=2) IMT_3D, SEG1_3D, SEGN_3D = get_data(ndim=3) - TESTS = [] for p in TEST_NDARRAYS_ALL: for q in TEST_NDARRAYS_ALL: diff --git a/tests/test_reference_based_normalize_intensity.py b/tests/test_reference_based_normalize_intensity.py index 0f5fa7d627..01811e5907 100644 --- a/tests/test_reference_based_normalize_intensity.py +++ b/tests/test_reference_based_normalize_intensity.py @@ -24,7 +24,6 @@ # which focuses on (1) automatic target normalization and (2) mean-std # return values - TESTS = [] for p in TEST_NDARRAYS_NO_META_TENSOR: TESTS.append( diff --git a/tests/test_reference_based_spatial_cropd.py b/tests/test_reference_based_spatial_cropd.py index d1f6230da4..ab5573044d 100644 --- a/tests/test_reference_based_spatial_cropd.py +++ b/tests/test_reference_based_spatial_cropd.py @@ -22,7 +22,6 @@ # here, we test TargetBasedSpatialCropd's functionality # which focuses on automatic input crop based on target image's shape. - TESTS = [] for p in TEST_NDARRAYS: # 2D diff --git a/tests/test_regunet.py b/tests/test_regunet.py index e37ca49538..04f971d2eb 100644 --- a/tests/test_regunet.py +++ b/tests/test_regunet.py @@ -20,7 +20,6 @@ device = "cuda" if torch.cuda.is_available() else "cpu" - TEST_CASE_REGUNET_2D = [ [ { diff --git a/tests/test_resnet.py b/tests/test_resnet.py index 88499f78d0..ae05f36210 100644 --- a/tests/test_resnet.py +++ b/tests/test_resnet.py @@ -28,7 +28,6 @@ else: torchvision, has_torchvision = optional_import("torchvision") - device = "cuda" if torch.cuda.is_available() else "cpu" TEST_CASE_1 = [ # 3D, batch 3, 2 input channel diff --git a/tests/test_retinanet.py b/tests/test_retinanet.py index 3c136a4cf2..f067e82962 100644 --- a/tests/test_retinanet.py +++ b/tests/test_retinanet.py @@ -22,7 +22,6 @@ _, has_torchvision = optional_import("torchvision") - device = "cuda" if torch.cuda.is_available() else "cpu" num_anchors = 7 diff --git a/tests/test_retinanet_detector.py b/tests/test_retinanet_detector.py index 99a70fb5fa..243828432d 100644 --- a/tests/test_retinanet_detector.py +++ b/tests/test_retinanet_detector.py @@ -23,7 +23,6 @@ _, has_torchvision = optional_import("torchvision") - num_anchors = 7 TEST_CASE_1 = [ # 3D, batch 3, 2 input channel diff --git a/tests/test_senet.py b/tests/test_senet.py index 34f140638e..b0d8ac0c0a 100644 --- a/tests/test_senet.py +++ b/tests/test_senet.py @@ -30,10 +30,8 @@ else: pretrainedmodels, has_cadene_pretrain = optional_import("pretrainedmodels") - device = "cuda" if torch.cuda.is_available() else "cpu" - NET_ARGS = {"spatial_dims": 3, "in_channels": 2, "num_classes": 2} TEST_CASE_1 = [SENet154, NET_ARGS] TEST_CASE_2 = [SEResNet50, NET_ARGS] diff --git a/tests/test_sliding_patch_wsi_dataset.py b/tests/test_sliding_patch_wsi_dataset.py index 819a363b67..06395cf26c 100644 --- a/tests/test_sliding_patch_wsi_dataset.py +++ b/tests/test_sliding_patch_wsi_dataset.py @@ -30,7 +30,6 @@ _, has_codec = optional_import("imagecodecs") has_tiff = has_tiff and has_codec - FILE_KEY = "wsi_img" FILE_URL = testing_data_config("images", FILE_KEY, "url") base_name, extension = os.path.basename(f"{FILE_URL}"), ".tiff" @@ -143,7 +142,6 @@ ], ] - TEST_CASE_SMALL_7 = [ {"data": [{"image": FILE_PATH_SMALL_0, WSIPatchKeys.LEVEL: 0, WSIPatchKeys.SIZE: (2, 2)}], "offset": (1, 0)}, [{"image": ARRAY_SMALL_0[:, 1:3, :2]}, {"image": ARRAY_SMALL_0[:, 1:3, 2:]}], diff --git a/tests/test_spacing.py b/tests/test_spacing.py index c260171d02..ba44bf76f2 100644 --- a/tests/test_spacing.py +++ b/tests/test_spacing.py @@ -248,7 +248,6 @@ ] ) - TESTS_TORCH = [] for track_meta in (False, True): for p in TEST_NDARRAYS_ALL: diff --git a/tests/test_spacingd.py b/tests/test_spacingd.py index d3c7bbc629..22729fd1b2 100644 --- a/tests/test_spacingd.py +++ b/tests/test_spacingd.py @@ -81,7 +81,6 @@ ) ) - TESTS_TORCH = [] for track_meta in (False, True): for device in TEST_DEVICES: diff --git a/tests/test_spatial_resample.py b/tests/test_spatial_resample.py index 33ff971a71..30bf33149b 100644 --- a/tests/test_spatial_resample.py +++ b/tests/test_spatial_resample.py @@ -25,7 +25,6 @@ TESTS = [] - destinations_3d = [ torch.tensor([[1.0, 0.0, 0.0, 0.0], [0.0, -1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), torch.tensor([[-1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), @@ -59,7 +58,6 @@ TESTS.append(deepcopy(TESTS[-1])) TESTS[-1][2].update({"align_corners": True, "mode": 1, "padding_mode": "reflect"}) # type: ignore - destinations_2d = [ torch.tensor([[1.0, 0.0, 0.0], [0.0, -1.0, 1.0], [0.0, 0.0, 1.0]]), # flip the second torch.tensor([[-1.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]), # flip the first diff --git a/tests/test_spatial_resampled.py b/tests/test_spatial_resampled.py index b9c221124c..5ace0b3774 100644 --- a/tests/test_spatial_resampled.py +++ b/tests/test_spatial_resampled.py @@ -22,7 +22,6 @@ TESTS = [] - destinations_3d = [ torch.tensor([[1.0, 0.0, 0.0, 0.0], [0.0, -1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), torch.tensor([[-1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]), diff --git a/tests/test_subpixel_upsample.py b/tests/test_subpixel_upsample.py index 3e5370473c..bd46aecb97 100644 --- a/tests/test_subpixel_upsample.py +++ b/tests/test_subpixel_upsample.py @@ -57,7 +57,6 @@ TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_3D_EXTRA) TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_CONV_BLOCK_EXTRA) - # add every test back with the pad/pool sequential component omitted for tests in list(TEST_CASE_SUBPIXEL): args: dict = tests[0] # type: ignore diff --git a/tests/test_torchvision_fc_model.py b/tests/test_torchvision_fc_model.py index 942d8f907f..d7341bc71e 100644 --- a/tests/test_torchvision_fc_model.py +++ b/tests/test_torchvision_fc_model.py @@ -135,7 +135,6 @@ -0.010419349186122417, ] - TEST_CASE_PRETRAINED_6 = [ { "model_name": "inception_v3", diff --git a/tests/test_unetr_block.py b/tests/test_unetr_block.py index c0f14c829d..8a4ee3a163 100644 --- a/tests/test_unetr_block.py +++ b/tests/test_unetr_block.py @@ -67,7 +67,6 @@ ] TEST_UP_BLOCK.append(test_case) - TEST_PRUP_BLOCK = [] in_channels, out_channels = 4, 2 for spatial_dims in range(1, 4): diff --git a/tests/test_upsample_block.py b/tests/test_upsample_block.py index 71884e2db1..535ad80c11 100644 --- a/tests/test_upsample_block.py +++ b/tests/test_upsample_block.py @@ -97,7 +97,6 @@ ] TEST_CASES_EQ.append(test_case) - TEST_CASES_EQ2 = [] # type: ignore for s in range(2, 5): for k in range(1, 7): diff --git a/tests/test_version_leq.py b/tests/test_version_leq.py index 86fccca9fb..725c1ee128 100644 --- a/tests/test_version_leq.py +++ b/tests/test_version_leq.py @@ -9,7 +9,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - import itertools import unittest diff --git a/tests/test_video_datasets.py b/tests/test_video_datasets.py index 7dcc3d1a6c..78e015e350 100644 --- a/tests/test_video_datasets.py +++ b/tests/test_video_datasets.py @@ -23,7 +23,6 @@ cv2, has_cv2 = optional_import("cv2") - NUM_CAPTURE_DEVICES = CameraDataset.get_num_devices() TRANSFORMS = mt.Compose( [mt.EnsureChannelFirst(True, "no_channel"), mt.DivisiblePad(16), mt.ScaleIntensity(), mt.CastToType(torch.float32)] diff --git a/tests/test_vis_gradbased.py b/tests/test_vis_gradbased.py index 035cb2967b..5af8769872 100644 --- a/tests/test_vis_gradbased.py +++ b/tests/test_vis_gradbased.py @@ -31,7 +31,6 @@ def __call__(self, x, adjoint_info): SENET3D = SEResNet50(spatial_dims=3, in_channels=3, num_classes=4) DENSENET2DADJOINT = DenseNetAdjoint(spatial_dims=2, in_channels=1, out_channels=3) - TESTS = [] for type in (VanillaGrad, SmoothGrad, GuidedBackpropGrad, GuidedBackpropSmoothGrad): # 2D densenet diff --git a/tests/test_wsireader.py b/tests/test_wsireader.py index 288dacc0be..5fb113e193 100644 --- a/tests/test_wsireader.py +++ b/tests/test_wsireader.py @@ -107,7 +107,6 @@ np.moveaxis(np.array([[[239], [239]], [[239], [239]], [[239], [239]]]), 0, -1), ] - TEST_CASE_5 = [ FILE_PATH, {"level": 2}, @@ -127,7 +126,6 @@ ), ] - TEST_CASE_RGB_0 = [np.ones((3, 2, 2), dtype=np.uint8)] # CHW TEST_CASE_RGB_1 = [np.ones((3, 100, 100), dtype=np.uint8)] # CHW diff --git a/tests/utils.py b/tests/utils.py index 49efbe3f99..1f632261dd 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -771,12 +771,10 @@ def command_line_tests(cmd, copy_env=True): # alias for branch tests TEST_NDARRAYS_ALL = TEST_NDARRAYS - TEST_DEVICES = [[torch.device("cpu")]] if torch.cuda.is_available(): TEST_DEVICES.append([torch.device("cuda")]) - if __name__ == "__main__": print("\n", query_memory(), sep="\n") # print to stdout sys.exit(0)