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
import numpy as np
from PIL import Image
from .utils import download_url, check_integrity
from .utils import check_integrity, download_url
from .vision import VisionDataset
......
import pathlib
from typing import Callable, Optional, Any, Tuple
from typing import Any, Callable, Optional, Tuple
from PIL import Image
......
import os.path
from typing import Any, Callable, Optional, Tuple, cast
from typing import Any, Callable, cast, Optional, Tuple
import numpy as np
from PIL import Image
......
from pathlib import Path
from typing import Any, Tuple, Callable, Optional
from typing import Any, Callable, Optional, Tuple
import PIL.Image
......
......@@ -4,7 +4,7 @@ from typing import Any, Callable, Optional, Tuple
import numpy as np
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
......
import os
from typing import Any, Dict, List, Tuple, Optional, Callable
from typing import Any, Callable, Dict, List, Optional, Tuple
from torch import Tensor
......
......@@ -15,7 +15,7 @@ import urllib.error
import urllib.request
import warnings
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
import numpy as np
......@@ -23,10 +23,7 @@ import requests
import torch
from torch.utils.model_zoo import tqdm
from .._internally_replaced_utils import (
_download_file_from_remote_location,
_is_remote_location_available,
)
from .._internally_replaced_utils import _download_file_from_remote_location, _is_remote_location_available
USER_AGENT = "pytorch/vision"
......
......@@ -2,15 +2,10 @@ import bisect
import math
import warnings
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
from torchvision.io import (
_probe_video_from_file,
_read_video_from_file,
read_video,
read_video_timestamps,
)
from torchvision.io import _probe_video_from_file, _read_video_from_file, read_video, read_video_timestamps
from .utils import tqdm
......
......@@ -9,7 +9,7 @@ try:
except ImportError:
from xml.etree.ElementTree import parse as ET_parse
import warnings
from typing import Any, Callable, Dict, Optional, Tuple, List
from typing import Any, Callable, Dict, List, Optional, Tuple
from PIL import Image
......
import os
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
from PIL import Image
from .utils import (
download_file_from_google_drive,
download_and_extract_archive,
extract_archive,
verify_str_arg,
)
from .utils import download_and_extract_archive, download_file_from_google_drive, extract_archive, verify_str_arg
from .vision import VisionDataset
......
......@@ -23,7 +23,6 @@ try:
def _has_ops(): # noqa: F811
return True
except (ImportError, OSError):
pass
......
......@@ -9,8 +9,6 @@ try:
except ModuleNotFoundError:
_HAS_GPU_VIDEO_DECODER = False
from ._video_opt import (
Timebase,
VideoMetaData,
_HAS_VIDEO_OPT,
_probe_video_from_file,
_probe_video_from_memory,
......@@ -18,25 +16,23 @@ from ._video_opt import (
_read_video_from_memory,
_read_video_timestamps_from_file,
_read_video_timestamps_from_memory,
Timebase,
VideoMetaData,
)
from .image import (
ImageReadMode,
decode_image,
decode_jpeg,
decode_png,
encode_jpeg,
encode_png,
ImageReadMode,
read_file,
read_image,
write_file,
write_jpeg,
write_png,
)
from .video import (
read_video,
read_video_timestamps,
write_video,
)
from .video import read_video, read_video_timestamps, write_video
from .video_reader import VideoReader
......
import math
import warnings
from fractions import Fraction
from typing import List, Tuple, Dict, Optional, Union
from typing import Dict, List, Optional, Tuple, Union
import torch
......
......@@ -8,16 +8,13 @@ try:
from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
except ModuleNotFoundError:
_HAS_GPU_VIDEO_DECODER = False
from ._video_opt import (
_HAS_VIDEO_OPT,
)
from ._video_opt import _HAS_VIDEO_OPT
if _HAS_VIDEO_OPT:
def _has_video_opt() -> bool:
return True
else:
def _has_video_opt() -> bool:
......
......@@ -13,9 +13,5 @@ from .squeezenet import *
from .vgg import *
from .vision_transformer import *
from .swin_transformer import *
from . import detection
from . import optical_flow
from . import quantization
from . import segmentation
from . import video
from . import detection, optical_flow, quantization, segmentation, video
from ._api import get_weight
......@@ -3,7 +3,7 @@ import inspect
import sys
from dataclasses import dataclass, fields
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
......
......@@ -2,7 +2,7 @@ import functools
import inspect
import warnings
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
......
......@@ -6,9 +6,9 @@ import torch.nn as nn
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._api import Weights, WeightsEnum
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"]
......
......@@ -9,9 +9,9 @@ from ..ops.misc import Conv2dNormActivation, Permute
from ..ops.stochastic_depth import StochasticDepth
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._api import Weights, WeightsEnum
from ._meta import _IMAGENET_CATEGORIES
from ._utils import handle_legacy_interface, _ovewrite_named_param
from ._utils import _ovewrite_named_param, handle_legacy_interface
__all__ = [
......
......@@ -11,9 +11,9 @@ from torch import Tensor
from ..transforms._presets import ImageClassification
from ..utils import _log_api_usage_once
from ._api import WeightsEnum, Weights
from ._api import Weights, WeightsEnum
from ._meta import _IMAGENET_CATEGORIES
from ._utils import handle_legacy_interface, _ovewrite_named_param
from ._utils import _ovewrite_named_param, handle_legacy_interface
__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