Switch to ruff (#1939)

* `isort` -> `ruff`

* `pylint` -> `ruff`

* Remove line

* More minor cleanup

* Better documentation for rules we are enabling

* Fix gitignore, run black

* vscode settings

---------

Co-authored-by: Matt Tancik <mattt4001@gmail.com>
This commit is contained in:
Brent YiandMatt Tancik authored and GitHub committed 2023-05-17 10:08:14 -07:00
1 parent 814db32ec4
commit d542646c72
79 files changed
+158 -237

No files matched your search

+1 -1
View File
@@ -74,7 +74,7 @@ class CameraOptimizer(nn.Module):
config: CameraOptimizerConfig,
num_cameras: int,
device: Union[torch.device, str],
**kwargs, # pylint: disable=unused-argument
**kwargs,
) -> None:
super().__init__()
self.config = config
+3 -4
View File
@@ -35,7 +35,7 @@ from nerfstudio.cameras.rays import RayBundle
from nerfstudio.data.scene_box import SceneBox
from nerfstudio.utils.tensor_dataclass import TensorDataclass
TORCH_DEVICE = Union[torch.device, str] # pylint: disable=invalid-name
TORCH_DEVICE = Union[torch.device, str]
class CameraType(Enum):
@@ -306,7 +306,7 @@ class Cameras(TensorDataclass):
image_coords = torch.stack(image_coords, dim=-1) + pixel_offset # stored as (y, x) coordinates
return image_coords
def generate_rays( # pylint: disable=too-many-statements
def generate_rays(
self,
camera_indices: Union[Int[Tensor, "*num_rays num_cameras_batch_dims"], int],
coords: Optional[Float[Tensor, "*num_rays 2"]] = None,
@@ -448,7 +448,7 @@ class Cameras(TensorDataclass):
# This will do the actual work of generating the rays now that we have standardized the inputs
# raybundle.shape == (num_rays) when done
# pylint: disable=protected-access
raybundle = cameras._generate_rays_from_coords(
camera_indices, coords, camera_opt_to_camera, distortion_params_delta, disable_distortion=disable_distortion
)
@@ -483,7 +483,6 @@ class Cameras(TensorDataclass):
# that we haven't caught yet with tests
return raybundle
# pylint: disable=too-many-statements
def _generate_rays_from_coords(
self,
camera_indices: Int[Tensor, "*num_rays num_cameras_batch_dims"],
+2 -2
View File
@@ -21,7 +21,7 @@ from torch import Tensor
# We make an exception on snake case conventions because SO3 != so3.
def exp_map_SO3xR3(tangent_vector: Float[Tensor, "b 6"]) -> Float[Tensor, "b 3 4"]: # pylint: disable=invalid-name
def exp_map_SO3xR3(tangent_vector: Float[Tensor, "b 6"]) -> Float[Tensor, "b 3 4"]:
"""Compute the exponential map of the direct product group `SO(3) x R^3`.
This can be used for learning pose deltas on SE(3), and is generally faster than `exp_map_SE3`.
@@ -59,7 +59,7 @@ def exp_map_SO3xR3(tangent_vector: Float[Tensor, "b 6"]) -> Float[Tensor, "b 3 4
return ret
def exp_map_SE3(tangent_vector: Float[Tensor, "b 6"]) -> Float[Tensor, "b 3 4"]: # pylint: disable=invalid-name
def exp_map_SE3(tangent_vector: Float[Tensor, "b 6"]) -> Float[Tensor, "b 3 4"]:
"""Compute the exponential map `se(3) -> SE(3)`.
This can be used for learning pose deltas on `SE(3)`.
+1 -1
View File
@@ -26,7 +26,7 @@ from torch import Tensor
from nerfstudio.utils.math import Gaussians, conical_frustum_to_gaussian
from nerfstudio.utils.tensor_dataclass import TensorDataclass
TORCH_DEVICE = Union[str, torch.device] # pylint: disable=invalid-name
TORCH_DEVICE = Union[str, torch.device]
@dataclass