Skip to content

Commit

Permalink
Apply pyupgrade for Python 3.8+ syntax
Browse files Browse the repository at this point in the history
This should have been included in 104a360 when Python 3.7 support was dropped.

Changes were automatically applied by running:
pre_commit run --all-files

Signed-off-by: James Butler <[email protected]>
  • Loading branch information
jamesobutler committed Oct 15, 2024
1 parent ec8ebd5 commit 2a2a1fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
rev: v3.18.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
name: Upgrade code excluding monai networks
exclude: |
(?x)(
Expand All @@ -49,7 +49,7 @@ repos:
^monai/data/grid_dataset.py
)
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]
args: [--py38-plus, --keep-runtime-typing]
name: Upgrade monai networks
files: (?x)(
^monai/networks/|
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 @@ -20,7 +20,7 @@
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from torch.nn import LayerNorm
from typing_extensions import Final
from typing import Final

from monai.networks.blocks import MLPBlock as Mlp
from monai.networks.blocks import PatchEmbed, UnetOutBlock, UnetrBasicBlock, UnetrUpBlock
Expand Down
4 changes: 1 addition & 3 deletions monai/utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

from __future__ import annotations

import sys
import warnings
from collections.abc import Callable
from logging import Filter

if sys.version_info >= (3, 8):
from typing import Literal
from typing import Literal

from typing import overload

Expand Down

0 comments on commit 2a2a1fb

Please sign in to comment.