From 9223dfd26368e4c030b41c1ec3b825088d4466f7 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 19 Nov 2024 18:08:56 +0100 Subject: [PATCH] dude --- rerun_py/rerun_sdk/rerun/recording_stream.py | 14 +++++----- rerun_py/rerun_sdk/rerun/sinks.py | 26 ++++++++++++++----- rerun_py/rerun_sdk/rerun/time.py | 27 ++++++++++++++++---- 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/rerun_py/rerun_sdk/rerun/recording_stream.py b/rerun_py/rerun_sdk/rerun/recording_stream.py index 4522e16d76425..6319b02ac03c9 100644 --- a/rerun_py/rerun_sdk/rerun/recording_stream.py +++ b/rerun_py/rerun_sdk/rerun/recording_stream.py @@ -307,7 +307,7 @@ def binary_stream(recording: RecordingStream | None = None) -> BinaryStream: An object that can be used to flush or read the data. """ - return BinaryStream(bindings.binary_stream(recording=recording.to_native())) + return BinaryStream(bindings.binary_stream(recording=recording.to_native() if recording is not None else None)) class BinaryStream: @@ -380,7 +380,7 @@ def is_enabled( This can be controlled with the environment variable `RERUN` (e.g. `RERUN=on` or `RERUN=off`). """ - return bindings.is_enabled(recording=recording.to_native()) # type: ignore[no-any-return] + return bindings.is_enabled(recording=recording.to_native() if recording is not None else None) # type: ignore[no-any-return] def get_application_id( @@ -402,7 +402,7 @@ def get_application_id( The application ID that this recording is associated with. """ - app_id = bindings.get_application_id(recording=recording.to_native()) + app_id = bindings.get_application_id(recording=recording.to_native() if recording is not None else None) return str(app_id) if app_id is not None else None @@ -434,7 +434,7 @@ def get_recording_id( The recording ID that this recording is logging to. """ - rec_id = bindings.get_recording_id(recording=recording.to_native()) + rec_id = bindings.get_recording_id(recording=recording.to_native() if recording is not None else None) return str(rec_id) if rec_id is not None else None @@ -467,7 +467,7 @@ def get_data_recording( The most appropriate recording to log data to, in the current context, if any. """ - result = bindings.get_data_recording(recording=recording.to_native()) + result = bindings.get_data_recording(recording=recording.to_native() if recording is not None else None) return RecordingStream(result) if result is not None else None @@ -523,7 +523,9 @@ def set_thread_local_data_recording(recording: RecordingStream) -> RecordingStre The newly active thread-local recording. """ - result = bindings.set_thread_local_data_recording(recording=recording.to_native()) + result = bindings.set_thread_local_data_recording( + recording=recording.to_native() if recording is not None else None + ) return RecordingStream(result) if result is not None else None diff --git a/rerun_py/rerun_sdk/rerun/sinks.py b/rerun_py/rerun_sdk/rerun/sinks.py index df223da6d4bec..5baf23a38a9b3 100644 --- a/rerun_py/rerun_sdk/rerun/sinks.py +++ b/rerun_py/rerun_sdk/rerun/sinks.py @@ -131,7 +131,7 @@ def connect_tcp( addr=addr, flush_timeout_sec=flush_timeout_sec, default_blueprint=blueprint_storage, - recording=recording.to_native(), + recording=recording.to_native() if recording is not None else None, ) @@ -180,7 +180,11 @@ def save( application_id=application_id, blueprint=default_blueprint ).storage - bindings.save(path=str(path), default_blueprint=blueprint_storage, recording=recording.to_native()) + bindings.save( + path=str(path), + default_blueprint=blueprint_storage, + recording=recording.to_native() if recording is not None else None, + ) def stdout(default_blueprint: BlueprintLike | None = None, recording: RecordingStream | None = None) -> None: @@ -225,7 +229,10 @@ def stdout(default_blueprint: BlueprintLike | None = None, recording: RecordingS application_id=application_id, blueprint=default_blueprint ).storage - bindings.stdout(default_blueprint=blueprint_storage, recording=recording.to_native()) + bindings.stdout( + default_blueprint=blueprint_storage, + recording=recording.to_native() if recording is not None else None, + ) def disconnect(recording: RecordingStream | None = None) -> None: @@ -244,7 +251,9 @@ def disconnect(recording: RecordingStream | None = None) -> None: """ - bindings.disconnect(recording=recording.to_native()) + bindings.disconnect( + recording=recording.to_native() if recording is not None else None, + ) @deprecated( @@ -382,7 +391,7 @@ def serve_web( ws_port, server_memory_limit=server_memory_limit, default_blueprint=blueprint_storage, - recording=recording.to_native(), + recording=recording.to_native() if recording is not None else None, ) @@ -423,7 +432,12 @@ def send_blueprint( blueprint_storage = create_in_memory_blueprint(application_id=application_id, blueprint=blueprint).storage - bindings.send_blueprint(blueprint_storage, make_active, make_default, recording=recording.to_native()) + bindings.send_blueprint( + blueprint_storage, + make_active, + make_default, + recording=recording.to_native() if recording is not None else None, + ) def spawn( diff --git a/rerun_py/rerun_sdk/rerun/time.py b/rerun_py/rerun_sdk/rerun/time.py index d1cc52e8db50c..91db732759b8d 100644 --- a/rerun_py/rerun_sdk/rerun/time.py +++ b/rerun_py/rerun_sdk/rerun/time.py @@ -32,7 +32,11 @@ def set_time_sequence(timeline: str, sequence: int, recording: RecordingStream | See also: [`rerun.init`][], [`rerun.set_global_data_recording`][]. """ - bindings.set_time_sequence(timeline, sequence, recording=recording.to_native()) + bindings.set_time_sequence( + timeline, + sequence, + recording=recording.to_native() if recording is not None else None, + ) def set_time_seconds(timeline: str, seconds: float, recording: RecordingStream | None = None) -> None: @@ -68,7 +72,11 @@ def set_time_seconds(timeline: str, seconds: float, recording: RecordingStream | """ - bindings.set_time_seconds(timeline, seconds, recording=recording.to_native()) + bindings.set_time_seconds( + timeline, + seconds, + recording=recording.to_native() if recording is not None else None, + ) def set_time_nanos(timeline: str, nanos: int, recording: RecordingStream | None = None) -> None: @@ -104,7 +112,11 @@ def set_time_nanos(timeline: str, nanos: int, recording: RecordingStream | None """ - bindings.set_time_nanos(timeline, nanos, recording=recording.to_native()) + bindings.set_time_nanos( + timeline, + nanos, + recording=recording.to_native() if recording is not None else None, + ) def disable_timeline(timeline: str, recording: RecordingStream | None = None) -> None: @@ -122,7 +134,10 @@ def disable_timeline(timeline: str, recording: RecordingStream | None = None) -> """ - bindings.disable_timeline(timeline, recording=recording.to_native()) + bindings.disable_timeline( + timeline, + recording=recording.to_native() if recording is not None else None, + ) def reset_time(recording: RecordingStream | None = None) -> None: @@ -143,4 +158,6 @@ def reset_time(recording: RecordingStream | None = None) -> None: """ - bindings.reset_time(recording=recording.to_native()) + bindings.reset_time( + recording=recording.to_native() if recording is not None else None, + )