Skip to content

Commit 1d0f39d

Browse files
committed
fix RUF009
1 parent fdd7b35 commit 1d0f39d

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

happypose/pose_estimators/megapose/evaluation/eval_config.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""
1515

1616
# Standard Library
17-
from dataclasses import dataclass
17+
from dataclasses import dataclass, field
1818
from typing import List, Optional
1919

2020
# MegaPose
@@ -59,7 +59,7 @@ class EvalConfig:
5959
ds_name: str = "ycbv.bop19"
6060

6161
# Inference
62-
inference: InferenceConfig = InferenceConfig() # noqa RUF009
62+
inference: InferenceConfig = field(default_factory=InferenceConfig)
6363

6464
# Run management
6565
result_id: Optional[str] = None
@@ -75,7 +75,7 @@ class EvalConfig:
7575

7676
# Infos
7777
global_batch_size: Optional[int] = None
78-
hardware: HardwareConfig = HardwareConfig() # noqa RUF009
78+
hardware: HardwareConfig = field(default_factory=HardwareConfig)
7979

8080
# Debug
8181
debug: bool = False

happypose/pose_estimators/megapose/training/training_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@ class TrainingConfig(omegaconf.dictconfig.DictConfig):
142142

143143
# Infos
144144
global_batch_size: Optional[int] = None
145-
hardware: HardwareConfig = HardwareConfig() # noqa: RUF009
145+
hardware: HardwareConfig = field(default_factory=HardwareConfig)

happypose/toolbox/renderer/types.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""
1515

1616
# Standard Library
17-
from dataclasses import dataclass
17+
from dataclasses import dataclass, field
1818
from typing import Callable, Optional, Tuple
1919

2020
# Third Party
@@ -41,6 +41,10 @@
4141
)
4242

4343

44+
def default_transform() -> Transform:
45+
return Transform((0.0, 0.0, 0.0, 1.0), (0.0, 0.0, 0.0))
46+
47+
4448
@dataclass
4549
class BatchRenderOutput:
4650
"""
@@ -92,7 +96,7 @@ class CameraRenderingData:
9296
class Panda3dCameraData:
9397
K: np.ndarray
9498
resolution: Tuple[int, int]
95-
TWC: Transform = Transform((0.0, 0.0, 0.0, 1.0), (0.0, 0.0, 0.0)) # noqa: RUF009
99+
TWC: Transform = field(default_factory=default_transform)
96100
z_near: float = 0.1
97101
z_far: float = 10
98102
node_name: str = "camera"
@@ -153,7 +157,7 @@ class Panda3dLightData:
153157
@dataclass
154158
class Panda3dObjectData:
155159
label: str
156-
TWO: Transform = Transform((0.0, 0.0, 0.0, 1.0), (0.0, 0.0, 0.0)) # noqa: RUF009
160+
TWO: Transform = field(default_factory=default_transform)
157161
color: Optional[RgbaColor] = None
158162
material: Optional[p3d.core.Material] = None
159163
remove_mesh_material: bool = False

0 commit comments

Comments
 (0)