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
View File
@@ -13,7 +13,6 @@ BATCH_SIZE = 2
H_W = 800
FX_Y = 10.0
CX_Y = H_W / 2.0
# pylint: disable=unnecessary-comprehension
C2W_FLAT = torch.eye(4)[:3, :]
CAMERA_TO_WORLDS = [
C2W_FLAT,
-3
View File
@@ -1,5 +1,3 @@
# pylint: disable=all
from copy import copy
from typing import Any
import pytest
@@ -9,7 +7,6 @@ import yaml
from nerfstudio.cameras.cameras import Cameras
from nerfstudio.configs.base_config import InstantiateConfig
from nerfstudio.data.datamanagers.base_datamanager import (
DataManager,
DataparserOutputs,
VanillaDataManager,
VanillaDataManagerConfig,
@@ -1,7 +1,7 @@
"""
Nerfstudio dataparser
"""
# pylint: disable=all
import json
from pathlib import Path
+1 -1
View File
@@ -10,7 +10,7 @@ from nerfstudio.fields.instant_ngp_field import TCNNInstantNGPField
def test_tcnn_instant_ngp_field():
"""Test the tiny-cuda-nn field"""
try:
import tinycudann as tcnn # pylint:disable=import-outside-toplevel, unused-import
import tinycudann as tcnn # noqa: F401
except ImportError as e:
# tinycudann module doesn't exist
print(e)
@@ -8,8 +8,7 @@ from nerfstudio.field_components.temporal_distortions import DNeRFDistortion
def test_dnerf_distortion():
"""Test dnerf distortion"""
# pylint: disable=import-outside-toplevel
# pylint: disable=unused-import
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
distortion = DNeRFDistortion().to(device)
+2 -7
View File
@@ -3,11 +3,6 @@ Test pipeline
"""
from pathlib import Path
# pylint: disable=too-few-public-methods
# pylint: disable=no-self-use
# pylint: disable=missing-class-docstring
# pylint: disable=unused-argument
# pylint: disable=abstract-method
import torch
from torch import nn
@@ -77,13 +72,13 @@ def test_load_state_dict():
)
pipeline = VanillaPipeline(config, "cpu")
state_dict = pipeline.state_dict()
state_dict["_model.param"].mul_(2) # pylint: disable=unsubscriptable-object
state_dict["_model.param"].mul_(2)
pipeline.load_pipeline(state_dict, 0)
assert was_called
assert pipeline.model.param[0].item() == 2
# preparation for another test
state_dict["_model.param"].mul_(2) # pylint: disable=unsubscriptable-object
state_dict["_model.param"].mul_(2)
was_called = False
# pretends to be a DDP checkpoint
ddp_state_dict = {}
+1 -1
View File
@@ -39,7 +39,7 @@ def test_scalar_first_scalar_last_quaternions():
# Expected Rotation matrix
# fmt: off
R_expected = np.array( # pylint: disable=invalid-name
R_expected = np.array(
[
[ 0.81379768, -0.44096961, 0.37852231],
[ 0.46984631, 0.88256412, 0.01802831],
-1
View File
@@ -1,4 +1,3 @@
# pylint: disable=protected-access
"""
Default test to make sure train runs
"""
+1 -1
View File
@@ -61,7 +61,7 @@ def test_broadcasting():
tensor_dataclass = DummyTensorDataclass(a=a, b=b)
def test_tensor_ops(): # pylint: disable=(too-many-statements)
def test_tensor_ops():
"""Test tensor operations"""
a = torch.ones((4, 6, 3))