Skip to content

Commit

Permalink
apply isort changes
Browse files Browse the repository at this point in the history
Changes were automatically applied by running:
python -m isort .

Signed-off-by: James Butler <[email protected]>
  • Loading branch information
jamesobutler committed Oct 23, 2024
1 parent 8dd7d0f commit e87d3f8
Show file tree
Hide file tree
Showing 37 changed files with 34 additions and 75 deletions.
4 changes: 2 additions & 2 deletions monai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

from __future__ import annotations

import logging
import os
import sys
import logging
import warnings
from ._version import get_versions

from ._version import get_versions

old_showwarning = warnings.showwarning

Expand Down
3 changes: 1 addition & 2 deletions monai/apps/detection/transforms/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

from __future__ import annotations

from typing import Any

from collections.abc import Sequence
from typing import Any

import numpy as np
import torch
Expand Down
1 change: 0 additions & 1 deletion monai/apps/detection/utils/anchor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

from __future__ import annotations


from collections.abc import Sequence

import torch
Expand Down
3 changes: 1 addition & 2 deletions monai/apps/pathology/engines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import Any

from collections.abc import Sequence
from typing import Any

import torch

Expand Down
3 changes: 1 addition & 2 deletions monai/apps/pathology/inferers/inferer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import Any, Callable

from collections.abc import Sequence
from typing import Any, Callable

import numpy as np
import torch
Expand Down
3 changes: 1 addition & 2 deletions monai/apps/pathology/metrics/lesion_froc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any

from collections.abc import Iterable
from typing import TYPE_CHECKING, Any

import numpy as np

Expand Down
3 changes: 1 addition & 2 deletions monai/apps/pathology/transforms/post/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from __future__ import annotations

import warnings
from typing import Callable

from collections.abc import Sequence
from typing import Callable

import numpy as np
import torch
Expand Down
4 changes: 1 addition & 3 deletions monai/bundle/reference_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@

import re
import warnings
from collections.abc import Sequence
from collections.abc import Iterator, Sequence
from typing import Any

from collections.abc import Iterator

from monai.bundle.config_item import ConfigComponent, ConfigExpression, ConfigItem
from monai.bundle.utils import DEPRECATED_ID_MAPPING, ID_REF_KEY, ID_SEP_KEY
from monai.utils import allow_missing_reference, look_up_option
Expand Down
3 changes: 1 addition & 2 deletions monai/bundle/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
import sys
import time
from abc import ABC, abstractmethod
from collections.abc import Sequence
from copy import copy
from logging.config import fileConfig
from pathlib import Path
from typing import Any

from collections.abc import Sequence

from monai.apps.utils import get_logger
from monai.bundle.config_parser import ConfigParser
from monai.bundle.properties import InferProperties, MetaProperties, TrainProperties
Expand Down
3 changes: 1 addition & 2 deletions monai/config/type_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from __future__ import annotations

import os
from typing import TypeVar, Union

from collections.abc import Collection, Hashable, Iterable, Sequence
from typing import TypeVar, Union

import numpy as np
import torch
Expand Down
3 changes: 1 addition & 2 deletions monai/data/meta_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@

import itertools
import pprint
from collections.abc import Iterable
from copy import deepcopy
from typing import Any

from collections.abc import Iterable

import numpy as np
import torch

Expand Down
3 changes: 1 addition & 2 deletions monai/data/meta_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@

import functools
import warnings
from collections.abc import Sequence
from copy import deepcopy
from typing import Any

from collections.abc import Sequence

import numpy as np
import torch

Expand Down
3 changes: 1 addition & 2 deletions monai/engines/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING, Any, Callable

from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any, Callable

import torch
from torch.utils.data import DataLoader
Expand Down
3 changes: 1 addition & 2 deletions monai/engines/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING, Any, Callable

from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any, Callable

import torch
from torch.optim.optimizer import Optimizer
Expand Down
4 changes: 1 addition & 3 deletions monai/engines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from collections.abc import Callable, Mapping, Sequence
from typing import TYPE_CHECKING, Any, cast

from collections.abc import Mapping

import torch
import torch.nn as nn

Expand Down
3 changes: 1 addition & 2 deletions monai/handlers/clearml_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any

from collections.abc import Mapping, Sequence
from typing import TYPE_CHECKING, Any

from monai.utils import optional_import

Expand Down
4 changes: 1 addition & 3 deletions monai/inferers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
from __future__ import annotations

import itertools
from collections.abc import Callable, Mapping, Sequence
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import Any

from collections.abc import Iterable

import numpy as np
import torch
import torch.nn.functional as F
Expand Down
3 changes: 1 addition & 2 deletions monai/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
from __future__ import annotations

import warnings
from collections.abc import Iterable, Sequence
from functools import lru_cache, partial
from types import ModuleType
from typing import Any

from collections.abc import Iterable, Sequence

import numpy as np
import torch

Expand Down
1 change: 0 additions & 1 deletion monai/networks/blocks/attention_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from __future__ import annotations


import torch
import torch.nn.functional as F
from torch import nn
Expand Down
1 change: 0 additions & 1 deletion monai/networks/blocks/rel_pos_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from __future__ import annotations


from collections.abc import Iterable

import torch
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/layers/simplelayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from __future__ import annotations

import math
from copy import deepcopy
from collections.abc import Sequence
from copy import deepcopy

import torch
import torch.nn.functional as F
Expand Down
1 change: 0 additions & 1 deletion monai/networks/layers/vector_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from __future__ import annotations


from collections.abc import Sequence

import torch
Expand Down
3 changes: 1 addition & 2 deletions monai/networks/nets/dynunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

# isort: dont-add-import: from __future__ import annotations

from typing import Optional, Union

from collections.abc import Sequence
from typing import Optional, Union

import torch
import torch.nn as nn
Expand Down
3 changes: 1 addition & 2 deletions monai/networks/nets/quicknat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import Optional, Union

from collections.abc import Sequence
from typing import Optional, Union

import torch
import torch.nn as nn
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/nets/swin_unetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import itertools
from collections.abc import Sequence
from typing import Final

import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from torch.nn import LayerNorm
from typing import Final

from monai.networks.blocks import MLPBlock as Mlp
from monai.networks.blocks import PatchEmbed, UnetOutBlock, UnetrBasicBlock, UnetrUpBlock
Expand Down
3 changes: 1 addition & 2 deletions monai/networks/nets/vista3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from __future__ import annotations

import math
from typing import Any, Callable, Optional

from collections.abc import Sequence
from typing import Any, Callable, Optional

import numpy as np
import torch
Expand Down
3 changes: 1 addition & 2 deletions monai/transforms/intensity/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

from __future__ import annotations

from typing import Callable

from collections.abc import Hashable, Mapping, Sequence
from typing import Callable

import numpy as np

Expand Down
3 changes: 1 addition & 2 deletions monai/transforms/lazy/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

from __future__ import annotations

from typing import Any

from collections.abc import Mapping, Sequence
from typing import Any

import torch

Expand Down
4 changes: 1 addition & 3 deletions monai/transforms/spatial/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
from __future__ import annotations

import warnings
from collections.abc import Callable
from collections.abc import Callable, Sequence
from copy import deepcopy
from itertools import zip_longest
from typing import Any, Optional, Union, cast

from collections.abc import Sequence

import numpy as np
import torch

Expand Down
4 changes: 1 addition & 3 deletions monai/transforms/utility/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
from __future__ import annotations

import re
from collections.abc import Callable, Hashable, Mapping
from collections.abc import Callable, Hashable, Mapping, Sequence
from copy import deepcopy
from typing import Any, cast

from collections.abc import Sequence

import numpy as np
import torch

Expand Down
3 changes: 1 addition & 2 deletions monai/utils/component_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
from __future__ import annotations

from collections import namedtuple
from collections.abc import Iterable
from keyword import iskeyword
from textwrap import dedent, indent
from typing import Any, Callable, TypeVar

from collections.abc import Iterable

T = TypeVar("T")


Expand Down
3 changes: 1 addition & 2 deletions monai/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

__all__ = ["RestartGenerator", "MethodReplacer"]

from typing import Callable

from collections.abc import Generator
from typing import Callable


class RestartGenerator:
Expand Down
5 changes: 1 addition & 4 deletions monai/utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
import warnings
from collections.abc import Callable
from logging import Filter

from typing import Literal

from typing import overload
from typing import Literal, overload

import torch
import torch.distributed as dist
Expand Down
Loading

0 comments on commit e87d3f8

Please sign in to comment.