Skip to content

Commit

Permalink
dude
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 19, 2024
1 parent 532c4fd commit 9223dfd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 17 deletions.
14 changes: 8 additions & 6 deletions rerun_py/rerun_sdk/rerun/recording_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand All @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand Down
26 changes: 20 additions & 6 deletions rerun_py/rerun_sdk/rerun/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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(
Expand Down Expand Up @@ -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,
)


Expand Down Expand Up @@ -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(
Expand Down
27 changes: 22 additions & 5 deletions rerun_py/rerun_sdk/rerun/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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,
)

0 comments on commit 9223dfd

Please sign in to comment.