Commit 34bbb3ad authored by Tim Hatch's avatar Tim Hatch Committed by Facebook GitHub Bot
Browse files

apply import merging for fbcode/vision/fair (2 of 2)

Summary:
Applies new import merging and sorting from µsort v1.0.

When merging imports, µsort will make a best-effort to move associated
comments to match merged elements, but there are known limitations due to
the diynamic nature of Python and developer tooling. These changes should
not produce any dangerous runtime changes, but may require touch-ups to
satisfy linters and other tooling.

Note that µsort uses case-insensitive, lexicographical sorting, which
results in a different ordering compared to isort. This provides a more
consistent sorting order, matching the case-insensitive order used when
sorting import statements by module name, and ensures that "frog", "FROG",
and "Frog" always sort next to each other.

For details on µsort's sorting and merging semantics, see the user guide:
https://usort.readthedocs.io/en/stable/guide.html#sorting

Reviewed By: bottler

Differential Revision: D35553814

fbshipit-source-id: be49bdb6a4c25264ff8d4db3a601f18736d17be1
parent df08ea8e
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.interp_face_attrs import ( from pytorch3d.ops.interp_face_attrs import (
interpolate_face_attributes, interpolate_face_attributes,
interpolate_face_attributes_python, interpolate_face_attributes_python,
......
...@@ -9,7 +9,7 @@ from math import radians ...@@ -9,7 +9,7 @@ from math import radians
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_pytorch3d_dir, get_tests_dir from common_testing import get_pytorch3d_dir, get_tests_dir, TestCaseMixin
from PIL import Image from PIL import Image
from pytorch3d.io import IO from pytorch3d.io import IO
from pytorch3d.io.experimental_gltf_io import MeshGlbFormat from pytorch3d.io.experimental_gltf_io import MeshGlbFormat
...@@ -17,9 +17,9 @@ from pytorch3d.renderer import ( ...@@ -17,9 +17,9 @@ from pytorch3d.renderer import (
AmbientLights, AmbientLights,
BlendParams, BlendParams,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
look_at_view_transform,
rotate_on_spot, rotate_on_spot,
) )
from pytorch3d.renderer.mesh import ( from pytorch3d.renderer.mesh import (
......
...@@ -14,10 +14,10 @@ from tempfile import NamedTemporaryFile, TemporaryDirectory ...@@ -14,10 +14,10 @@ from tempfile import NamedTemporaryFile, TemporaryDirectory
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from iopath.common.file_io import PathManager from iopath.common.file_io import PathManager
from pytorch3d.io import IO, load_obj, load_objs_as_meshes, save_obj from pytorch3d.io import IO, load_obj, load_objs_as_meshes, save_obj
...@@ -27,7 +27,7 @@ from pytorch3d.io.mtl_io import ( ...@@ -27,7 +27,7 @@ from pytorch3d.io.mtl_io import (
_parse_mtl, _parse_mtl,
) )
from pytorch3d.renderer import TexturesAtlas, TexturesUV, TexturesVertex from pytorch3d.renderer import TexturesAtlas, TexturesUV, TexturesVertex
from pytorch3d.structures import Meshes, join_meshes_as_batch from pytorch3d.structures import join_meshes_as_batch, Meshes
from pytorch3d.utils import torus from pytorch3d.utils import torus
......
...@@ -11,7 +11,7 @@ from typing import List, Tuple, Union ...@@ -11,7 +11,7 @@ from typing import List, Tuple, Union
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
from common_testing import TestCaseMixin, get_random_cuda_device, get_tests_dir from common_testing import get_random_cuda_device, get_tests_dir, TestCaseMixin
from pytorch3d.io import save_obj from pytorch3d.io import save_obj
from pytorch3d.ops.iou_box3d import _box_planes, _box_triangles, box3d_overlap from pytorch3d.ops.iou_box3d import _box_planes, _box_triangles, box3d_overlap
from pytorch3d.transforms.rotation_conversions import random_rotation from pytorch3d.transforms.rotation_conversions import random_rotation
......
...@@ -8,7 +8,7 @@ import unittest ...@@ -8,7 +8,7 @@ import unittest
from itertools import product from itertools import product
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.knn import _KNN, knn_gather, knn_points from pytorch3d.ops.knn import _KNN, knn_gather, knn_points
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import cot_laplacian, laplacian, norm_laplacian from pytorch3d.ops import cot_laplacian, laplacian, norm_laplacian
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes
......
...@@ -9,7 +9,7 @@ import pickle ...@@ -9,7 +9,7 @@ import pickle
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops.marching_cubes import marching_cubes_naive from pytorch3d.ops.marching_cubes import marching_cubes_naive
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import taubin_smoothing from pytorch3d.ops import taubin_smoothing
from pytorch3d.structures import Meshes from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere from pytorch3d.utils import ico_sphere
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import packed_to_padded, padded_to_packed from pytorch3d.ops import packed_to_padded, padded_to_packed
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes
......
...@@ -8,10 +8,10 @@ import unittest ...@@ -8,10 +8,10 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.loss import point_mesh_edge_distance, point_mesh_face_distance from pytorch3d.loss import point_mesh_edge_distance, point_mesh_face_distance
from pytorch3d.structures import Meshes, Pointclouds, packed_to_list from pytorch3d.structures import Meshes, packed_to_list, Pointclouds
class TestPointMeshDistance(TestCaseMixin, unittest.TestCase): class TestPointMeshDistance(TestCaseMixin, unittest.TestCase):
......
...@@ -12,7 +12,7 @@ import numpy as np ...@@ -12,7 +12,7 @@ import numpy as np
import torch import torch
from common_testing import TestCaseMixin from common_testing import TestCaseMixin
from pytorch3d.structures import utils as struct_utils from pytorch3d.structures import utils as struct_utils
from pytorch3d.structures.pointclouds import Pointclouds, join_pointclouds_as_batch from pytorch3d.structures.pointclouds import join_pointclouds_as_batch, Pointclouds
class TestPointclouds(TestCaseMixin, unittest.TestCase): class TestPointclouds(TestCaseMixin, unittest.TestCase):
......
...@@ -8,7 +8,7 @@ import unittest ...@@ -8,7 +8,7 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops import points_alignment from pytorch3d.ops import points_alignment
from pytorch3d.structures.pointclouds import Pointclouds from pytorch3d.structures.pointclouds import Pointclouds
from pytorch3d.transforms import rotation_conversions from pytorch3d.transforms import rotation_conversions
......
...@@ -13,19 +13,19 @@ import unittest ...@@ -13,19 +13,19 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir, load_rgb_image from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from PIL import Image from PIL import Image
from pytorch3d.datasets import ( from pytorch3d.datasets import (
R2N2,
BlenderCamera, BlenderCamera,
collate_batched_R2N2, collate_batched_R2N2,
R2N2,
render_cubified_voxels, render_cubified_voxels,
) )
from pytorch3d.renderer import ( from pytorch3d.renderer import (
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
look_at_view_transform,
) )
from pytorch3d.renderer.cameras import get_world_to_view_transform from pytorch3d.renderer.cameras import get_world_to_view_transform
from pytorch3d.transforms import Transform3d from pytorch3d.transforms import Transform3d
......
...@@ -8,7 +8,7 @@ import functools ...@@ -8,7 +8,7 @@ import functools
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.renderer import FoVPerspectiveCameras, look_at_view_transform from pytorch3d.renderer import FoVPerspectiveCameras, look_at_view_transform
from pytorch3d.renderer.mesh import MeshRasterizer, RasterizationSettings from pytorch3d.renderer.mesh import MeshRasterizer, RasterizationSettings
......
...@@ -9,7 +9,7 @@ import unittest ...@@ -9,7 +9,7 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.renderer.points.rasterize_points import ( from pytorch3d.renderer.points.rasterize_points import (
_format_radius, _format_radius,
......
...@@ -10,10 +10,10 @@ from itertools import product ...@@ -10,10 +10,10 @@ from itertools import product
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.io import load_obj from pytorch3d.io import load_obj
......
...@@ -21,10 +21,10 @@ from pytorch3d.renderer import ( ...@@ -21,10 +21,10 @@ from pytorch3d.renderer import (
NDCMultinomialRaysampler, NDCMultinomialRaysampler,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
ray_bundle_to_ray_points,
RayBundle, RayBundle,
SoftPhongShader, SoftPhongShader,
TexturesVertex, TexturesVertex,
ray_bundle_to_ray_points,
) )
from pytorch3d.structures import Meshes from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere from pytorch3d.utils import ico_sphere
......
...@@ -15,19 +15,19 @@ from collections import namedtuple ...@@ -15,19 +15,19 @@ from collections import namedtuple
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.io import load_obj from pytorch3d.io import load_obj
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
FoVOrthographicCameras, FoVOrthographicCameras,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
OrthographicCameras, OrthographicCameras,
PerspectiveCameras, PerspectiveCameras,
look_at_view_transform,
) )
from pytorch3d.renderer.lighting import AmbientLights, PointLights from pytorch3d.renderer.lighting import AmbientLights, PointLights
from pytorch3d.renderer.materials import Materials from pytorch3d.renderer.materials import Materials
...@@ -44,9 +44,9 @@ from pytorch3d.renderer.mesh.shader import ( ...@@ -44,9 +44,9 @@ from pytorch3d.renderer.mesh.shader import (
TexturedSoftPhongShader, TexturedSoftPhongShader,
) )
from pytorch3d.structures.meshes import ( from pytorch3d.structures.meshes import (
Meshes,
join_meshes_as_batch, join_meshes_as_batch,
join_meshes_as_scene, join_meshes_as_scene,
Meshes,
) )
from pytorch3d.utils.ico_sphere import ico_sphere from pytorch3d.utils.ico_sphere import ico_sphere
from pytorch3d.utils.torus import torus from pytorch3d.utils.torus import torus
......
...@@ -17,19 +17,19 @@ import unittest ...@@ -17,19 +17,19 @@ import unittest
import imageio import imageio
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir, load_rgb_image from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from pytorch3d.io import save_obj from pytorch3d.io import save_obj
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
FoVPerspectiveCameras, FoVPerspectiveCameras,
PerspectiveCameras,
look_at_view_transform, look_at_view_transform,
PerspectiveCameras,
) )
from pytorch3d.renderer.lighting import PointLights from pytorch3d.renderer.lighting import PointLights
from pytorch3d.renderer.mesh import ( from pytorch3d.renderer.mesh import (
ClipFrustum,
TexturesUV,
clip_faces, clip_faces,
ClipFrustum,
convert_clipped_rasterization_to_original_faces, convert_clipped_rasterization_to_original_faces,
TexturesUV,
) )
from pytorch3d.renderer.mesh.rasterize_meshes import _RasterizeFaceVerts from pytorch3d.renderer.mesh.rasterize_meshes import _RasterizeFaceVerts
from pytorch3d.renderer.mesh.rasterizer import MeshRasterizer, RasterizationSettings from pytorch3d.renderer.mesh.rasterizer import MeshRasterizer, RasterizationSettings
......
...@@ -8,7 +8,7 @@ import unittest ...@@ -8,7 +8,7 @@ import unittest
import torch import torch
import torch.nn as nn import torch.nn as nn
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.renderer import ( from pytorch3d.renderer import (
AlphaCompositor, AlphaCompositor,
BlendParams, BlendParams,
......
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