Skip to content

Commit

Permalink
more of that
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 20, 2024
1 parent 532c4fd commit 49eb8b3
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 24 deletions.
9 changes: 3 additions & 6 deletions rerun_py/rerun_sdk/rerun/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ def log_components(
)
static = True

# Convert to a native recording
recording = recording.to_native()

instanced: dict[str, pa.Array] = {}

components = list(components)
Expand Down Expand Up @@ -294,7 +291,7 @@ def log_components(
entity_path,
components=instanced,
static_=static,
recording=recording.to_native(),
recording=recording.to_native() if recording is not None else None,
)


Expand Down Expand Up @@ -358,7 +355,7 @@ def log_file_from_path(
Path(file_path),
entity_path_prefix=entity_path_prefix,
static_=static,
recording=recording.to_native(),
recording=recording.to_native() if recording is not None else None,
)


Expand Down Expand Up @@ -419,7 +416,7 @@ def log_file_from_contents(
file_contents,
entity_path_prefix=entity_path_prefix,
static_=static,
recording=recording.to_native(),
recording=recording.to_native() if recording is not None else None,
)


Expand Down
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/_send_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,5 @@ def send_columns(
entity_path,
timelines={t.timeline_name(): t.as_arrow_array() for t in times},
components=components_args,
recording=recording.to_native(),
recording=recording.to_native() if recording is not None else None,
)
6 changes: 5 additions & 1 deletion rerun_py/rerun_sdk/rerun/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def memory_recording(recording: RecordingStream | None = None) -> MemoryRecordin
"""

return MemoryRecording(bindings.memory_recording(recording=recording.to_native()))
return MemoryRecording(
bindings.memory_recording(
recording=recording.to_native() if recording is not None else None,
)
)


class MemoryRecording:
Expand Down
10 changes: 5 additions & 5 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
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 49eb8b3

Please sign in to comment.