Skip to content

Commit

Permalink
RecordingStream.to_native(recording) -> recording.to_native()
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 19, 2024
1 parent e78d528 commit f7888c3
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion rerun_notebook/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions rerun_py/rerun_sdk/rerun/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def log_components(
static = True

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

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

Expand Down Expand Up @@ -294,7 +294,7 @@ def log_components(
entity_path,
components=instanced,
static_=static,
recording=RecordingStream.to_native(recording),
recording=recording.to_native(),
)


Expand Down Expand Up @@ -358,7 +358,7 @@ def log_file_from_path(
Path(file_path),
entity_path_prefix=entity_path_prefix,
static_=static,
recording=RecordingStream.to_native(recording),
recording=recording.to_native(),
)


Expand Down Expand Up @@ -419,7 +419,7 @@ def log_file_from_contents(
file_contents,
entity_path_prefix=entity_path_prefix,
static_=static,
recording=RecordingStream.to_native(recording),
recording=recording.to_native(),
)


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=RecordingStream.to_native(recording),
recording=recording.to_native(),
)
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def memory_recording(recording: RecordingStream | None = None) -> MemoryRecordin
"""

return MemoryRecording(bindings.memory_recording(recording=RecordingStream.to_native(recording)))
return MemoryRecording(bindings.memory_recording(recording=recording.to_native()))


class MemoryRecording:
Expand Down
14 changes: 7 additions & 7 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=RecordingStream.to_native(recording)))
return BinaryStream(bindings.binary_stream(recording=recording.to_native()))


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=RecordingStream.to_native(recording)) # type: ignore[no-any-return]
return bindings.is_enabled(recording=recording.to_native()) # 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=RecordingStream.to_native(recording))
app_id = bindings.get_application_id(recording=recording.to_native())
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=RecordingStream.to_native(recording))
rec_id = bindings.get_recording_id(recording=recording.to_native())
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=RecordingStream.to_native(recording))
result = bindings.get_data_recording(recording=recording.to_native())
return RecordingStream(result) if result is not None else None


Expand Down Expand Up @@ -495,7 +495,7 @@ def set_global_data_recording(recording: RecordingStream) -> RecordingStream | N
The newly active global recording.
"""
result = bindings.set_global_data_recording(RecordingStream.to_native(recording))
result = bindings.set_global_data_recording(recording.to_native())
return RecordingStream(result) if result is not None else None


Expand Down Expand Up @@ -523,7 +523,7 @@ def set_thread_local_data_recording(recording: RecordingStream) -> RecordingStre
The newly active thread-local recording.
"""
result = bindings.set_thread_local_data_recording(recording=RecordingStream.to_native(recording))
result = bindings.set_thread_local_data_recording(recording=recording.to_native())
return RecordingStream(result) if result is not None else None


Expand Down
12 changes: 6 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=RecordingStream.to_native(recording),
recording=recording.to_native(),
)


Expand Down Expand Up @@ -180,7 +180,7 @@ def save(
application_id=application_id, blueprint=default_blueprint
).storage

bindings.save(path=str(path), default_blueprint=blueprint_storage, recording=RecordingStream.to_native(recording))
bindings.save(path=str(path), default_blueprint=blueprint_storage, recording=recording.to_native())


def stdout(default_blueprint: BlueprintLike | None = None, recording: RecordingStream | None = None) -> None:
Expand Down Expand Up @@ -225,7 +225,7 @@ def stdout(default_blueprint: BlueprintLike | None = None, recording: RecordingS
application_id=application_id, blueprint=default_blueprint
).storage

bindings.stdout(default_blueprint=blueprint_storage, recording=RecordingStream.to_native(recording))
bindings.stdout(default_blueprint=blueprint_storage, recording=recording.to_native())


def disconnect(recording: RecordingStream | None = None) -> None:
Expand All @@ -244,7 +244,7 @@ def disconnect(recording: RecordingStream | None = None) -> None:
"""

bindings.disconnect(recording=RecordingStream.to_native(recording))
bindings.disconnect(recording=recording.to_native())


@deprecated(
Expand Down Expand Up @@ -382,7 +382,7 @@ def serve_web(
ws_port,
server_memory_limit=server_memory_limit,
default_blueprint=blueprint_storage,
recording=RecordingStream.to_native(recording),
recording=recording.to_native(),
)


Expand Down Expand Up @@ -424,7 +424,7 @@ 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=RecordingStream.to_native(recording)
blueprint_storage, make_active, make_default, recording=recording.to_native()
)


Expand Down
10 changes: 5 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,7 @@ 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=RecordingStream.to_native(recording))
bindings.set_time_sequence(timeline, sequence, recording=recording.to_native())


def set_time_seconds(timeline: str, seconds: float, recording: RecordingStream | None = None) -> None:
Expand Down Expand Up @@ -68,7 +68,7 @@ def set_time_seconds(timeline: str, seconds: float, recording: RecordingStream |
"""

bindings.set_time_seconds(timeline, seconds, recording=RecordingStream.to_native(recording))
bindings.set_time_seconds(timeline, seconds, recording=recording.to_native())


def set_time_nanos(timeline: str, nanos: int, recording: RecordingStream | None = None) -> None:
Expand Down Expand Up @@ -104,7 +104,7 @@ def set_time_nanos(timeline: str, nanos: int, recording: RecordingStream | None
"""

bindings.set_time_nanos(timeline, nanos, recording=RecordingStream.to_native(recording))
bindings.set_time_nanos(timeline, nanos, recording=recording.to_native())


def disable_timeline(timeline: str, recording: RecordingStream | None = None) -> None:
Expand All @@ -122,7 +122,7 @@ def disable_timeline(timeline: str, recording: RecordingStream | None = None) ->
"""

bindings.disable_timeline(timeline, recording=RecordingStream.to_native(recording))
bindings.disable_timeline(timeline, recording=recording.to_native())


def reset_time(recording: RecordingStream | None = None) -> None:
Expand All @@ -143,4 +143,4 @@ def reset_time(recording: RecordingStream | None = None) -> None:
"""

bindings.reset_time(recording=RecordingStream.to_native(recording))
bindings.reset_time(recording=recording.to_native())
4 changes: 2 additions & 2 deletions scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def lint_line(
if re.search(r"\b3d\b", line):
return "we prefer '3D' over '3d'"

if "recording=rec" in line:
return "you must cast the RecordingStream first: `recording=RecordingStream.to_native(recording)"
if "recording=rec" in line and "recording=recording.to_native()" not in line:
return "you must cast the RecordingStream first: `recording=recording.to_native()"

if "FIXME" in line:
return "we prefer TODO over FIXME"
Expand Down

0 comments on commit f7888c3

Please sign in to comment.