From b48ff162d7b9c77230998c7d381bc91630ff8368 Mon Sep 17 00:00:00 2001 From: unexcellent <> Date: Tue, 29 Oct 2024 19:23:14 +0100 Subject: [PATCH] lint: enable ruff RET504 rule --- pyproject.toml | 1 - raillabel/format/frame.py | 3 +-- raillabel/format/intrinsics_pinhole.py | 4 +--- raillabel/format/transform.py | 4 +--- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 83e6ea0..9c4158d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,6 @@ ignore = [ "EM102", "F401", "SIM102", - "RET504", ] [tool.mypy] diff --git a/raillabel/format/frame.py b/raillabel/format/frame.py index 2c56a41..43590eb 100644 --- a/raillabel/format/frame.py +++ b/raillabel/format/frame.py @@ -94,14 +94,13 @@ def fromdict( Converted Frame object. """ - frame = Frame( + return Frame( uid=int(uid), timestamp=cls._timestamp_fromdict(data_dict), sensors=cls._sensors_fromdict(data_dict, sensors), frame_data=cls._frame_data_fromdict(data_dict, sensors), annotations=cls._objects_fromdict(data_dict, objects, sensors), ) - return frame def asdict(self) -> dict: """Export self as a dict compatible with the OpenLABEL schema. diff --git a/raillabel/format/intrinsics_pinhole.py b/raillabel/format/intrinsics_pinhole.py index 2e59cf4..e781dde 100644 --- a/raillabel/format/intrinsics_pinhole.py +++ b/raillabel/format/intrinsics_pinhole.py @@ -68,11 +68,9 @@ def asdict(self) -> dict: if an attribute can not be converted to the type required by the OpenLabel schema. """ - dict_repr = { + return { "camera_matrix": list(self.camera_matrix), "distortion_coeffs": list(self.distortion), "width_px": int(self.width_px), "height_px": int(self.height_px), } - - return dict_repr diff --git a/raillabel/format/transform.py b/raillabel/format/transform.py index 36f19e6..b7c4f13 100644 --- a/raillabel/format/transform.py +++ b/raillabel/format/transform.py @@ -52,9 +52,7 @@ def asdict(self) -> dict: if an attribute can not be converted to the type required by the OpenLabel schema. """ - dict_repr = { + return { "translation": self.pos.asdict(), "quaternion": self.quat.asdict(), } - - return dict_repr