Unverified Commit 6ca9c76a authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

Upgrade usort to `1.0.2` and black to 22.3.0 (#5106)



* upgrade usort to

* Also update black

* Actually use 1.0.2

* Apply pre-commit
Co-authored-by: default avatarNicolas Hug <contact@nicolas-hug.com>
parent 9293be7e
...@@ -4,7 +4,7 @@ from typing import Any, Callable, Optional, Tuple ...@@ -4,7 +4,7 @@ from typing import Any, Callable, Optional, Tuple
import numpy as np import numpy as np
from PIL import Image from PIL import Image
from .utils import download_url, check_integrity from .utils import check_integrity, download_url
from .vision import VisionDataset from .vision import VisionDataset
......
import pathlib import pathlib
from typing import Callable, Optional, Any, Tuple from typing import Any, Callable, Optional, Tuple
from PIL import Image from PIL import Image
......
import os.path import os.path
from typing import Any, Callable, Optional, Tuple, cast from typing import Any, Callable, cast, Optional, Tuple
import numpy as np import numpy as np
from PIL import Image from PIL import Image
......
from pathlib import Path from pathlib import Path
from typing import Any, Tuple, Callable, Optional from typing import Any, Callable, Optional, Tuple
import PIL.Image import PIL.Image
......
...@@ -4,7 +4,7 @@ from typing import Any, Callable, Optional, Tuple ...@@ -4,7 +4,7 @@ from typing import Any, Callable, Optional, Tuple
import numpy as np import numpy as np
from PIL import Image from PIL import Image
from .utils import download_url, check_integrity, verify_str_arg from .utils import check_integrity, download_url, verify_str_arg
from .vision import VisionDataset from .vision import VisionDataset
......
import os import os
from typing import Any, Dict, List, Tuple, Optional, Callable from typing import Any, Callable, Dict, List, Optional, Tuple
from torch import Tensor from torch import Tensor
......
...@@ -15,7 +15,7 @@ import urllib.error ...@@ -15,7 +15,7 @@ import urllib.error
import urllib.request import urllib.request
import warnings import warnings
import zipfile import zipfile
from typing import Any, Callable, List, Iterable, Optional, TypeVar, Dict, IO, Tuple, Iterator from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Tuple, TypeVar
from urllib.parse import urlparse from urllib.parse import urlparse
import numpy as np import numpy as np
...@@ -23,10 +23,7 @@ import requests ...@@ -23,10 +23,7 @@ import requests
import torch import torch
from torch.utils.model_zoo import tqdm from torch.utils.model_zoo import tqdm
from .._internally_replaced_utils import ( from .._internally_replaced_utils import _download_file_from_remote_location, _is_remote_location_available
_download_file_from_remote_location,
_is_remote_location_available,
)
USER_AGENT = "pytorch/vision" USER_AGENT = "pytorch/vision"
......
...@@ -2,15 +2,10 @@ import bisect ...@@ -2,15 +2,10 @@ import bisect
import math import math
import warnings import warnings
from fractions import Fraction from fractions import Fraction
from typing import Any, Dict, List, Optional, Callable, Union, Tuple, TypeVar, cast from typing import Any, Callable, cast, Dict, List, Optional, Tuple, TypeVar, Union
import torch import torch
from torchvision.io import ( from torchvision.io import _probe_video_from_file, _read_video_from_file, read_video, read_video_timestamps
_probe_video_from_file,
_read_video_from_file,
read_video,
read_video_timestamps,
)
from .utils import tqdm from .utils import tqdm
......
...@@ -9,7 +9,7 @@ try: ...@@ -9,7 +9,7 @@ try:
except ImportError: except ImportError:
from xml.etree.ElementTree import parse as ET_parse from xml.etree.ElementTree import parse as ET_parse
import warnings import warnings
from typing import Any, Callable, Dict, Optional, Tuple, List from typing import Any, Callable, Dict, List, Optional, Tuple
from PIL import Image from PIL import Image
......
import os import os
from os.path import abspath, expanduser from os.path import abspath, expanduser
from typing import Any, Callable, List, Dict, Optional, Tuple, Union from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import torch import torch
from PIL import Image from PIL import Image
from .utils import ( from .utils import download_and_extract_archive, download_file_from_google_drive, extract_archive, verify_str_arg
download_file_from_google_drive,
download_and_extract_archive,
extract_archive,
verify_str_arg,
)
from .vision import VisionDataset from .vision import VisionDataset
......
...@@ -23,7 +23,6 @@ try: ...@@ -23,7 +23,6 @@ try:
def _has_ops(): # noqa: F811 def _has_ops(): # noqa: F811
return True return True
except (ImportError, OSError): except (ImportError, OSError):
pass pass
......
...@@ -9,8 +9,6 @@ try: ...@@ -9,8 +9,6 @@ try:
except ModuleNotFoundError: except ModuleNotFoundError:
_HAS_GPU_VIDEO_DECODER = False _HAS_GPU_VIDEO_DECODER = False
from ._video_opt import ( from ._video_opt import (
Timebase,
VideoMetaData,
_HAS_VIDEO_OPT, _HAS_VIDEO_OPT,
_probe_video_from_file, _probe_video_from_file,
_probe_video_from_memory, _probe_video_from_memory,
...@@ -18,25 +16,23 @@ from ._video_opt import ( ...@@ -18,25 +16,23 @@ from ._video_opt import (
_read_video_from_memory, _read_video_from_memory,
_read_video_timestamps_from_file, _read_video_timestamps_from_file,
_read_video_timestamps_from_memory, _read_video_timestamps_from_memory,
Timebase,
VideoMetaData,
) )
from .image import ( from .image import (
ImageReadMode,
decode_image, decode_image,
decode_jpeg, decode_jpeg,
decode_png, decode_png,
encode_jpeg, encode_jpeg,
encode_png, encode_png,
ImageReadMode,
read_file, read_file,
read_image, read_image,
write_file, write_file,
write_jpeg, write_jpeg,
write_png, write_png,
) )
from .video import ( from .video import read_video, read_video_timestamps, write_video
read_video,
read_video_timestamps,
write_video,
)
from .video_reader import VideoReader from .video_reader import VideoReader
......
import math import math
import warnings import warnings
from fractions import Fraction from fractions import Fraction
from typing import List, Tuple, Dict, Optional, Union from typing import Dict, List, Optional, Tuple, Union
import torch import torch
......
...@@ -8,16 +8,13 @@ try: ...@@ -8,16 +8,13 @@ try:
from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
except ModuleNotFoundError: except ModuleNotFoundError:
_HAS_GPU_VIDEO_DECODER = False _HAS_GPU_VIDEO_DECODER = False
from ._video_opt import ( from ._video_opt import _HAS_VIDEO_OPT
_HAS_VIDEO_OPT,
)
if _HAS_VIDEO_OPT: if _HAS_VIDEO_OPT:
def _has_video_opt() -> bool: def _has_video_opt() -> bool:
return True return True
else: else:
def _has_video_opt() -> bool: def _has_video_opt() -> bool:
......
...@@ -13,9 +13,5 @@ from .squeezenet import * ...@@ -13,9 +13,5 @@ from .squeezenet import *
from .vgg import * from .vgg import *
from .vision_transformer import * from .vision_transformer import *
from .swin_transformer import * from .swin_transformer import *
from . import detection from . import detection, optical_flow, quantization, segmentation, video
from . import optical_flow
from . import quantization
from . import segmentation
from . import video
from ._api import get_weight from ._api import get_weight
...@@ -3,7 +3,7 @@ import inspect ...@@ -3,7 +3,7 @@ import inspect
import sys import sys
from dataclasses import dataclass, fields from dataclasses import dataclass, fields
from inspect import signature from inspect import signature
from typing import Any, Callable, Dict, Mapping, cast from typing import Any, Callable, cast, Dict, Mapping
from torchvision._utils import StrEnum from torchvision._utils import StrEnum
......
...@@ -2,7 +2,7 @@ import functools ...@@ -2,7 +2,7 @@ import functools
import inspect import inspect
import warnings import warnings
from collections import OrderedDict from collections import OrderedDict
from typing import Any, Dict, Optional, TypeVar, Callable, Tuple, Union from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
from torch import nn from torch import nn
......
...@@ -6,9 +6,9 @@ import torch.nn as nn ...@@ -6,9 +6,9 @@ import torch.nn as nn
from ..transforms._presets import ImageClassification from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights from ._api import Weights, WeightsEnum
from ._meta import _IMAGENET_CATEGORIES from ._meta import _IMAGENET_CATEGORIES
from ._utils import handle_legacy_interface, _ovewrite_named_param from ._utils import _ovewrite_named_param, handle_legacy_interface
__all__ = ["AlexNet", "AlexNet_Weights", "alexnet"] __all__ = ["AlexNet", "AlexNet_Weights", "alexnet"]
......
...@@ -9,9 +9,9 @@ from ..ops.misc import Conv2dNormActivation, Permute ...@@ -9,9 +9,9 @@ from ..ops.misc import Conv2dNormActivation, Permute
from ..ops.stochastic_depth import StochasticDepth from ..ops.stochastic_depth import StochasticDepth
from ..transforms._presets import ImageClassification from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights from ._api import Weights, WeightsEnum
from ._meta import _IMAGENET_CATEGORIES from ._meta import _IMAGENET_CATEGORIES
from ._utils import handle_legacy_interface, _ovewrite_named_param from ._utils import _ovewrite_named_param, handle_legacy_interface
__all__ = [ __all__ = [
......
...@@ -11,9 +11,9 @@ from torch import Tensor ...@@ -11,9 +11,9 @@ from torch import Tensor
from ..transforms._presets import ImageClassification from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights from ._api import Weights, WeightsEnum
from ._meta import _IMAGENET_CATEGORIES from ._meta import _IMAGENET_CATEGORIES
from ._utils import handle_legacy_interface, _ovewrite_named_param from ._utils import _ovewrite_named_param, handle_legacy_interface
__all__ = [ __all__ = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment