Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
robotics
embodied-ai
human-demonstration
egocentric-video
bimanual-manipulation
tactile-sensing
License:
Upload folder using huggingface_hub (part 19)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +6 -0
- player/runtime/python/Lib/site-packages/rerun/sinks.py +546 -0
- player/runtime/python/Lib/site-packages/rerun/time.py +252 -0
- player/runtime/python/Lib/site-packages/rerun/urdf.py +415 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/__init__.py +13 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/_data.py +103 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/_turbo.py +262 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/_util.py +33 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/__init__.py +1 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/collect.py +38 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/functions/__init__.py +0 -0
- player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/functions/url_generation.py +134 -0
- player/runtime/python/Lib/site-packages/rerun/web.py +53 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/THIRD_PARTY_NOTICES.md +0 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/__init__.py +23 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/py.typed +0 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/rerun_bindings.pyd +3 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/rerun_bindings.pyi +2244 -0
- player/runtime/python/Lib/site-packages/rerun_bindings/types.py +67 -0
- player/runtime/python/Lib/site-packages/rerun_cli/THIRD_PARTY_NOTICES.md +0 -0
- player/runtime/python/Lib/site-packages/rerun_cli/__init__.py +0 -0
- player/runtime/python/Lib/site-packages/rerun_cli/__main__.py +46 -0
- player/runtime/python/Lib/site-packages/rerun_cli/rerun.exe +3 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/INSTALLER +1 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/METADATA +198 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/RECORD +569 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/REQUESTED +0 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/WHEEL +4 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/entry_points.txt +2 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/licenses/LICENSE-APACHE +201 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/licenses/LICENSE-MIT +25 -0
- player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/sboms/rerun_py.cyclonedx.json +0 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/INSTALLER +1 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/METADATA +73 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/RECORD +7 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/REQUESTED +0 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/WHEEL +4 -0
- player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/licenses/LICENSE +279 -0
- player/runtime/python/Lib/site-packages/typing_extensions.py +0 -0
- player/runtime/python/Lib/site.py +693 -0
- player/runtime/python/Lib/smtplib.py +1109 -0
- player/runtime/python/Lib/sndhdr.py +271 -0
- player/runtime/python/Lib/socket.py +983 -0
- player/runtime/python/Lib/socketserver.py +863 -0
- player/runtime/python/Lib/sqlite3/__init__.py +70 -0
- player/runtime/python/Lib/sqlite3/__main__.py +127 -0
- player/runtime/python/Lib/sqlite3/dbapi2.py +108 -0
- player/runtime/python/Lib/sqlite3/dump.py +89 -0
- player/runtime/python/Lib/sre_compile.py +7 -0
- player/runtime/python/Lib/sre_constants.py +7 -0
.gitattributes
CHANGED
|
@@ -147,3 +147,9 @@ player/runtime/python/Lib/site-packages/pyarrow/lib.cp312-win_amd64.pyd filter=l
|
|
| 147 |
player/runtime/python/Lib/site-packages/pyarrow/parquet.dll filter=lfs diff=lfs merge=lfs -text
|
| 148 |
player/runtime/python/Lib/site-packages/pyarrow/parquet.lib filter=lfs diff=lfs merge=lfs -text
|
| 149 |
player/runtime/python/Lib/site-packages/pyarrow.libs/msvcp140-0fa7eb792d3fbcf2233e4ea47e9144b9.dll filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
player/runtime/python/Lib/site-packages/pyarrow/parquet.dll filter=lfs diff=lfs merge=lfs -text
|
| 148 |
player/runtime/python/Lib/site-packages/pyarrow/parquet.lib filter=lfs diff=lfs merge=lfs -text
|
| 149 |
player/runtime/python/Lib/site-packages/pyarrow.libs/msvcp140-0fa7eb792d3fbcf2233e4ea47e9144b9.dll filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
player/runtime/python/Lib/site-packages/rerun_bindings/rerun_bindings.pyd filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
player/runtime/python/Lib/site-packages/rerun_cli/rerun.exe filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
player/runtime/python/Lib/venv/scripts/nt/python.exe filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
player/runtime/python/Lib/venv/scripts/nt/pythonw.exe filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
player/runtime/python/python312.dll filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
player/runtime/python/vcruntime140.dll filter=lfs diff=lfs merge=lfs -text
|
player/runtime/python/Lib/site-packages/rerun/sinks.py
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import logging
|
| 4 |
+
from typing import TYPE_CHECKING, TypeAlias
|
| 5 |
+
|
| 6 |
+
import rerun_bindings as bindings
|
| 7 |
+
from rerun.blueprint.api import BlueprintLike, create_in_memory_blueprint
|
| 8 |
+
from rerun.recording_stream import BinaryStream, RecordingStream, get_application_id
|
| 9 |
+
from rerun_bindings import (
|
| 10 |
+
FileSink,
|
| 11 |
+
GrpcServerSink,
|
| 12 |
+
GrpcSink,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
from ._spawn import _spawn_viewer
|
| 16 |
+
|
| 17 |
+
if TYPE_CHECKING:
|
| 18 |
+
import pathlib
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# --- Sinks ---
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def is_recording_enabled(recording: RecordingStream | None) -> bool:
|
| 25 |
+
if recording is not None:
|
| 26 |
+
return bindings.is_enabled(recording.inner) # type: ignore[no-any-return]
|
| 27 |
+
return bindings.is_enabled() # type: ignore[no-any-return]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
LogSinkLike: TypeAlias = GrpcSink | GrpcServerSink | FileSink | BinaryStream
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def set_sinks(
|
| 34 |
+
*sinks: LogSinkLike,
|
| 35 |
+
default_blueprint: BlueprintLike | None = None,
|
| 36 |
+
recording: RecordingStream | None = None,
|
| 37 |
+
) -> None:
|
| 38 |
+
"""
|
| 39 |
+
Stream data to multiple different sinks.
|
| 40 |
+
|
| 41 |
+
Duplicate sinks are not allowed. For example, two [`rerun.GrpcSink`][]s that
|
| 42 |
+
use the same `url` will cause this function to throw a `ValueError`.
|
| 43 |
+
|
| 44 |
+
This _replaces_ existing sinks. Calling `rr.init(spawn=True)`, `rr.spawn()`,
|
| 45 |
+
`rr.connect_grpc()` or similar followed by `set_sinks` will result in only
|
| 46 |
+
the sinks passed to `set_sinks` remaining active.
|
| 47 |
+
|
| 48 |
+
Only data logged _after_ the `set_sinks` call will be logged to the newly attached sinks.
|
| 49 |
+
|
| 50 |
+
Parameters
|
| 51 |
+
----------
|
| 52 |
+
sinks:
|
| 53 |
+
A list of sinks to wrap.
|
| 54 |
+
|
| 55 |
+
See [`rerun.GrpcSink`][], [`rerun.GrpcServerSink`][], [`rerun.FileSink`][],
|
| 56 |
+
[`rerun.BinaryStream`][].
|
| 57 |
+
default_blueprint:
|
| 58 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 59 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 60 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 61 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 62 |
+
recording:
|
| 63 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 64 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 65 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 66 |
+
|
| 67 |
+
Example
|
| 68 |
+
-------
|
| 69 |
+
```py
|
| 70 |
+
rr.init("rerun_example_tee")
|
| 71 |
+
rr.set_sinks(
|
| 72 |
+
rr.GrpcSink(),
|
| 73 |
+
rr.FileSink("data.rrd")
|
| 74 |
+
)
|
| 75 |
+
rr.log("my/point", rr.Points3D(position=[1.0, 2.0, 3.0]))
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
# Check for duplicates
|
| 81 |
+
seen = set()
|
| 82 |
+
duplicates = set()
|
| 83 |
+
for sink in sinks:
|
| 84 |
+
if sink in seen:
|
| 85 |
+
duplicates.add(sink)
|
| 86 |
+
else:
|
| 87 |
+
seen.add(sink)
|
| 88 |
+
if duplicates:
|
| 89 |
+
raise ValueError(f"Duplicate sinks detected: {', '.join(str(d) for d in duplicates)}")
|
| 90 |
+
|
| 91 |
+
if not is_recording_enabled(recording):
|
| 92 |
+
logging.warning("Rerun is disabled - set_sinks() call ignored")
|
| 93 |
+
return
|
| 94 |
+
|
| 95 |
+
application_id = get_application_id(recording) # NOLINT
|
| 96 |
+
if application_id is None:
|
| 97 |
+
raise ValueError(
|
| 98 |
+
"No application id found. You must call rerun.init before connecting to a viewer, or provide a recording.",
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
# If a blueprint is provided, we need to create a blueprint storage object
|
| 102 |
+
blueprint_storage = None
|
| 103 |
+
if default_blueprint is not None:
|
| 104 |
+
blueprint_storage = create_in_memory_blueprint(
|
| 105 |
+
application_id=application_id,
|
| 106 |
+
blueprint=default_blueprint,
|
| 107 |
+
).storage
|
| 108 |
+
|
| 109 |
+
bindings.set_sinks(
|
| 110 |
+
[*sinks],
|
| 111 |
+
default_blueprint=blueprint_storage,
|
| 112 |
+
recording=recording.to_native() if recording is not None else None,
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def connect_grpc(
|
| 117 |
+
url: str | None = None,
|
| 118 |
+
*,
|
| 119 |
+
default_blueprint: BlueprintLike | None = None,
|
| 120 |
+
recording: RecordingStream | None = None,
|
| 121 |
+
) -> None:
|
| 122 |
+
"""
|
| 123 |
+
Connect to a remote Rerun Viewer on the given URL.
|
| 124 |
+
|
| 125 |
+
This function returns immediately.
|
| 126 |
+
|
| 127 |
+
Parameters
|
| 128 |
+
----------
|
| 129 |
+
url:
|
| 130 |
+
The URL to connect to.
|
| 131 |
+
|
| 132 |
+
The scheme must be one of `rerun://`, `rerun+http://`, or `rerun+https://`,
|
| 133 |
+
and the pathname must be `/proxy`.
|
| 134 |
+
|
| 135 |
+
The default is `rerun+http://127.0.0.1:9876/proxy`.
|
| 136 |
+
default_blueprint:
|
| 137 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 138 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 139 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 140 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 141 |
+
recording:
|
| 142 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 143 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 144 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 145 |
+
|
| 146 |
+
"""
|
| 147 |
+
if not is_recording_enabled(recording):
|
| 148 |
+
logging.warning("Rerun is disabled - connect_grpc() call ignored")
|
| 149 |
+
return
|
| 150 |
+
|
| 151 |
+
from rerun.recording_stream import get_application_id
|
| 152 |
+
|
| 153 |
+
application_id = get_application_id(recording) # NOLINT
|
| 154 |
+
if application_id is None:
|
| 155 |
+
raise ValueError(
|
| 156 |
+
"No application id found. You must call rerun.init before connecting to a viewer, or provide a recording.",
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
# If a blueprint is provided, we need to create a blueprint storage object
|
| 160 |
+
blueprint_storage = None
|
| 161 |
+
if default_blueprint is not None:
|
| 162 |
+
blueprint_storage = create_in_memory_blueprint(
|
| 163 |
+
application_id=application_id,
|
| 164 |
+
blueprint=default_blueprint,
|
| 165 |
+
).storage
|
| 166 |
+
|
| 167 |
+
bindings.connect_grpc(
|
| 168 |
+
url=url,
|
| 169 |
+
default_blueprint=blueprint_storage,
|
| 170 |
+
recording=recording.to_native() if recording is not None else None,
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
def save(
|
| 175 |
+
path: str | pathlib.Path,
|
| 176 |
+
default_blueprint: BlueprintLike | None = None,
|
| 177 |
+
recording: RecordingStream | None = None,
|
| 178 |
+
*,
|
| 179 |
+
write_footer: bool = True,
|
| 180 |
+
) -> None:
|
| 181 |
+
"""
|
| 182 |
+
Stream all log-data to a file.
|
| 183 |
+
|
| 184 |
+
Call this _before_ you log any data!
|
| 185 |
+
|
| 186 |
+
The Rerun Viewer is able to read continuously from the resulting rrd file while it is being written.
|
| 187 |
+
However, depending on your OS and configuration, changes may not be immediately visible due to file caching.
|
| 188 |
+
This is a common issue on Windows and (to a lesser extent) on MacOS.
|
| 189 |
+
|
| 190 |
+
Parameters
|
| 191 |
+
----------
|
| 192 |
+
path:
|
| 193 |
+
The path to save the data to.
|
| 194 |
+
default_blueprint
|
| 195 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 196 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 197 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 198 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 199 |
+
recording:
|
| 200 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 201 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 202 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 203 |
+
write_footer:
|
| 204 |
+
Whether to emit a complete RRD footer (including a manifest of every chunk) at the
|
| 205 |
+
end of the stream. Defaults to `True`.
|
| 206 |
+
|
| 207 |
+
Producing a footer keeps per-chunk metadata in memory for the lifetime of the sink,
|
| 208 |
+
which grows linearly with the number of chunks logged. Pass `write_footer=False` for
|
| 209 |
+
long-running streaming sessions; the resulting file is still a valid RRD and a footer
|
| 210 |
+
can be added after the fact via `rerun rrd optimize`.
|
| 211 |
+
|
| 212 |
+
*Warning*: lack of footer will significantly hurt random-access performance and some
|
| 213 |
+
tools (e.g. LazyStore) may not work properly.
|
| 214 |
+
|
| 215 |
+
"""
|
| 216 |
+
|
| 217 |
+
if not is_recording_enabled(recording):
|
| 218 |
+
logging.warning("Rerun is disabled - save() call ignored. You must call rerun.init before saving a recording.")
|
| 219 |
+
return
|
| 220 |
+
|
| 221 |
+
from rerun.recording_stream import get_application_id
|
| 222 |
+
|
| 223 |
+
application_id = get_application_id(recording=recording) # NOLINT
|
| 224 |
+
if application_id is None:
|
| 225 |
+
raise ValueError(
|
| 226 |
+
"No application id found. You must call rerun.init before connecting to a viewer, or provide a recording.",
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
# If a blueprint is provided, we need to create a blueprint storage object
|
| 230 |
+
blueprint_storage = None
|
| 231 |
+
if default_blueprint is not None:
|
| 232 |
+
blueprint_storage = create_in_memory_blueprint(
|
| 233 |
+
application_id=application_id,
|
| 234 |
+
blueprint=default_blueprint,
|
| 235 |
+
).storage
|
| 236 |
+
|
| 237 |
+
bindings.save(
|
| 238 |
+
path=str(path),
|
| 239 |
+
default_blueprint=blueprint_storage,
|
| 240 |
+
recording=recording.to_native() if recording is not None else None,
|
| 241 |
+
write_footer=write_footer,
|
| 242 |
+
)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def stdout(
|
| 246 |
+
default_blueprint: BlueprintLike | None = None,
|
| 247 |
+
recording: RecordingStream | None = None,
|
| 248 |
+
*,
|
| 249 |
+
write_footer: bool = True,
|
| 250 |
+
) -> None:
|
| 251 |
+
"""
|
| 252 |
+
Stream all log-data to stdout.
|
| 253 |
+
|
| 254 |
+
Pipe it into a Rerun Viewer to visualize it.
|
| 255 |
+
|
| 256 |
+
Call this _before_ you log any data!
|
| 257 |
+
|
| 258 |
+
If there isn't any listener at the other end of the pipe, the `RecordingStream` will
|
| 259 |
+
default back to `buffered` mode, in order not to break the user's terminal.
|
| 260 |
+
|
| 261 |
+
Parameters
|
| 262 |
+
----------
|
| 263 |
+
default_blueprint
|
| 264 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 265 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 266 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 267 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 268 |
+
recording:
|
| 269 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 270 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 271 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 272 |
+
write_footer:
|
| 273 |
+
Whether to emit a complete RRD footer (including a manifest of every chunk) at the
|
| 274 |
+
end of the stream. Defaults to `True`. See [`rerun.save`][] for details and trade-offs.
|
| 275 |
+
|
| 276 |
+
*Warning*: lack of footer will significantly hurt random-access performance and some
|
| 277 |
+
tools (e.g. LazyStore) may not work properly.
|
| 278 |
+
|
| 279 |
+
"""
|
| 280 |
+
|
| 281 |
+
if not is_recording_enabled(recording):
|
| 282 |
+
logging.warning("Rerun is disabled - save() call ignored. You must call rerun.init before saving a recording.")
|
| 283 |
+
return
|
| 284 |
+
|
| 285 |
+
from rerun.recording_stream import get_application_id
|
| 286 |
+
|
| 287 |
+
application_id = get_application_id(recording=recording) # NOLINT
|
| 288 |
+
if application_id is None:
|
| 289 |
+
raise ValueError(
|
| 290 |
+
"No application id found. You must call rerun.init before connecting to a viewer, or provide a recording.",
|
| 291 |
+
)
|
| 292 |
+
|
| 293 |
+
# If a blueprint is provided, we need to create a blueprint storage object
|
| 294 |
+
blueprint_storage = None
|
| 295 |
+
if default_blueprint is not None:
|
| 296 |
+
blueprint_storage = create_in_memory_blueprint(
|
| 297 |
+
application_id=application_id,
|
| 298 |
+
blueprint=default_blueprint,
|
| 299 |
+
).storage
|
| 300 |
+
|
| 301 |
+
bindings.stdout(
|
| 302 |
+
default_blueprint=blueprint_storage,
|
| 303 |
+
recording=recording.to_native() if recording is not None else None,
|
| 304 |
+
write_footer=write_footer,
|
| 305 |
+
)
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
def disconnect(recording: RecordingStream | None = None) -> None:
|
| 309 |
+
"""
|
| 310 |
+
Closes all gRPC connections, servers, and files.
|
| 311 |
+
|
| 312 |
+
Closes all gRPC connections, servers, and files that have been opened with
|
| 313 |
+
[`rerun.connect_grpc`], [`rerun.serve`], [`rerun.save`] or [`rerun.spawn`].
|
| 314 |
+
|
| 315 |
+
Parameters
|
| 316 |
+
----------
|
| 317 |
+
recording:
|
| 318 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 319 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 320 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 321 |
+
|
| 322 |
+
"""
|
| 323 |
+
|
| 324 |
+
bindings.disconnect(
|
| 325 |
+
recording=recording.to_native() if recording is not None else None,
|
| 326 |
+
)
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
def serve_grpc(
|
| 330 |
+
*,
|
| 331 |
+
grpc_port: int | None = None,
|
| 332 |
+
default_blueprint: BlueprintLike | None = None,
|
| 333 |
+
recording: RecordingStream | None = None,
|
| 334 |
+
server_memory_limit: str = "1GiB",
|
| 335 |
+
newest_first: bool = False,
|
| 336 |
+
cors_allow_origin: list[str] | None = None,
|
| 337 |
+
) -> str:
|
| 338 |
+
"""
|
| 339 |
+
Serve log-data over gRPC.
|
| 340 |
+
|
| 341 |
+
You can connect to this server with the native viewer using `rerun rerun+http://localhost:{grpc_port}/proxy`.
|
| 342 |
+
|
| 343 |
+
The gRPC server will buffer all log data in memory so that late connecting viewers will get all the data.
|
| 344 |
+
You can control the amount of data buffered by the gRPC server with the `server_memory_limit` argument.
|
| 345 |
+
Once reached, the earliest logged data will be dropped. Static data is never dropped.
|
| 346 |
+
|
| 347 |
+
Returns the URI of the server so you can connect the viewer to it.
|
| 348 |
+
|
| 349 |
+
This function returns immediately. In order to keep the server running, you must keep the Python process running
|
| 350 |
+
as well.
|
| 351 |
+
|
| 352 |
+
NOTE: The grpc server is associated with a [`rerun.RecordingStream`][] object. By default, if no other recording
|
| 353 |
+
was specified, this will be the global recording. When that `RecordingStream` is disconnected, or otherwise goes
|
| 354 |
+
out of scope, the associated gRPC server will be shut down.
|
| 355 |
+
See: [Issue: #12313](https://github.com/rerun-io/rerun/issues/12313) for possible complications.
|
| 356 |
+
|
| 357 |
+
Parameters
|
| 358 |
+
----------
|
| 359 |
+
grpc_port:
|
| 360 |
+
The port to serve the gRPC server on (defaults to 9876)
|
| 361 |
+
default_blueprint:
|
| 362 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 363 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 364 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 365 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 366 |
+
recording:
|
| 367 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 368 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 369 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 370 |
+
server_memory_limit:
|
| 371 |
+
Maximum amount of memory to use for buffering log data for clients that connect late.
|
| 372 |
+
This can be a percentage of the total ram (e.g. "50%") or an absolute value (e.g. "4GB").
|
| 373 |
+
newest_first:
|
| 374 |
+
If `True`, the server will start sending back the newest messages _first_.
|
| 375 |
+
If `False`, the messages will be played back in the order they arrived.
|
| 376 |
+
cors_allow_origin:
|
| 377 |
+
Additional origin patterns allowed to make CORS requests to the gRPC server.
|
| 378 |
+
By default, only localhost and rerun.io are allowed.
|
| 379 |
+
Patterns are matched against the full `Origin` header (e.g. `"https://example.com:8080"`),
|
| 380 |
+
using glob-style matching where `*` matches any sequence of characters.
|
| 381 |
+
Examples: `"https://*.example.com"`, `"https://example.com:8080"`,
|
| 382 |
+
`"https://example.com:*"`.
|
| 383 |
+
|
| 384 |
+
"""
|
| 385 |
+
if not is_recording_enabled(recording):
|
| 386 |
+
logging.warning("Rerun is disabled - serve_grpc() call ignored")
|
| 387 |
+
return "[rerun is disabled]"
|
| 388 |
+
|
| 389 |
+
from rerun.recording_stream import get_application_id
|
| 390 |
+
|
| 391 |
+
application_id = get_application_id(recording=recording) # NOLINT
|
| 392 |
+
if application_id is None:
|
| 393 |
+
raise ValueError(
|
| 394 |
+
"No application id found. You must call rerun.init before connecting to a viewer, or provide a recording.",
|
| 395 |
+
)
|
| 396 |
+
|
| 397 |
+
# If a blueprint is provided, we need to create a blueprint storage object
|
| 398 |
+
blueprint_storage = None
|
| 399 |
+
if default_blueprint is not None:
|
| 400 |
+
blueprint_storage = create_in_memory_blueprint(
|
| 401 |
+
application_id=application_id,
|
| 402 |
+
blueprint=default_blueprint,
|
| 403 |
+
).storage
|
| 404 |
+
|
| 405 |
+
return bindings.serve_grpc(
|
| 406 |
+
grpc_port,
|
| 407 |
+
server_memory_limit=server_memory_limit,
|
| 408 |
+
default_blueprint=blueprint_storage,
|
| 409 |
+
recording=recording.to_native() if recording is not None else None,
|
| 410 |
+
newest_first=newest_first,
|
| 411 |
+
cors_allow_origin=cors_allow_origin or [],
|
| 412 |
+
)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
def send_blueprint(
|
| 416 |
+
blueprint: BlueprintLike,
|
| 417 |
+
*,
|
| 418 |
+
make_active: bool = True,
|
| 419 |
+
make_default: bool = True,
|
| 420 |
+
recording: RecordingStream | None = None,
|
| 421 |
+
) -> None:
|
| 422 |
+
"""
|
| 423 |
+
Create a blueprint from a `BlueprintLike` and send it to the `RecordingStream`.
|
| 424 |
+
|
| 425 |
+
Parameters
|
| 426 |
+
----------
|
| 427 |
+
blueprint:
|
| 428 |
+
A blueprint object to send to the viewer.
|
| 429 |
+
make_active:
|
| 430 |
+
Immediately make this the active blueprint for the associated `app_id`.
|
| 431 |
+
Note that setting this to `false` does not mean the blueprint may not still end
|
| 432 |
+
up becoming active. In particular, if `make_default` is true and there is no other
|
| 433 |
+
currently active blueprint.
|
| 434 |
+
make_default:
|
| 435 |
+
Make this the default blueprint for the `app_id`.
|
| 436 |
+
The default blueprint will be used as the template when the user resets the
|
| 437 |
+
blueprint for the app. It will also become the active blueprint if no other
|
| 438 |
+
blueprint is currently active.
|
| 439 |
+
recording:
|
| 440 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 441 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 442 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 443 |
+
|
| 444 |
+
"""
|
| 445 |
+
|
| 446 |
+
from rerun.recording_stream import get_application_id
|
| 447 |
+
|
| 448 |
+
application_id = get_application_id(recording=recording) # NOLINT
|
| 449 |
+
|
| 450 |
+
if application_id is None:
|
| 451 |
+
raise ValueError("No application id found. You must call rerun.init before sending a blueprint.")
|
| 452 |
+
|
| 453 |
+
blueprint_storage = create_in_memory_blueprint(application_id=application_id, blueprint=blueprint).storage
|
| 454 |
+
|
| 455 |
+
bindings.send_blueprint(
|
| 456 |
+
blueprint_storage,
|
| 457 |
+
make_active,
|
| 458 |
+
make_default,
|
| 459 |
+
recording=recording.to_native() if recording is not None else None,
|
| 460 |
+
)
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
def spawn(
|
| 464 |
+
*,
|
| 465 |
+
port: int = 9876,
|
| 466 |
+
connect: bool = True,
|
| 467 |
+
memory_limit: str = "75%",
|
| 468 |
+
server_memory_limit: str = "1GiB",
|
| 469 |
+
hide_welcome_screen: bool = False,
|
| 470 |
+
detach_process: bool = True,
|
| 471 |
+
executable_name: str = "rerun",
|
| 472 |
+
executable_path: str | None = None,
|
| 473 |
+
default_blueprint: BlueprintLike | None = None,
|
| 474 |
+
recording: RecordingStream | None = None,
|
| 475 |
+
) -> None:
|
| 476 |
+
"""
|
| 477 |
+
Spawn a Rerun Viewer, listening on the given port.
|
| 478 |
+
|
| 479 |
+
This is often the easiest and best way to use Rerun.
|
| 480 |
+
Just call this once at the start of your program.
|
| 481 |
+
|
| 482 |
+
You can also call [rerun.init][] with a `spawn=True` argument.
|
| 483 |
+
|
| 484 |
+
Parameters
|
| 485 |
+
----------
|
| 486 |
+
port:
|
| 487 |
+
The port to listen on.
|
| 488 |
+
connect:
|
| 489 |
+
also connect to the viewer and stream logging data to it.
|
| 490 |
+
memory_limit:
|
| 491 |
+
An upper limit on how much memory the Rerun Viewer should use.
|
| 492 |
+
When this limit is reached, Rerun will drop the oldest data.
|
| 493 |
+
Example: `16GB` or `50%` (of system total).
|
| 494 |
+
server_memory_limit:
|
| 495 |
+
An upper limit on how much memory the gRPC server running
|
| 496 |
+
in the same process as the Rerun Viewer should use.
|
| 497 |
+
When this limit is reached, Rerun will drop the oldest data.
|
| 498 |
+
Example: `16GB` or `50%` (of system total).
|
| 499 |
+
|
| 500 |
+
Defaults to `1GiB`.
|
| 501 |
+
hide_welcome_screen:
|
| 502 |
+
Hide the normal Rerun welcome screen.
|
| 503 |
+
detach_process:
|
| 504 |
+
Detach Rerun Viewer process from the application process.
|
| 505 |
+
executable_name:
|
| 506 |
+
Specifies the name of the Rerun executable.
|
| 507 |
+
You can omit the `.exe` suffix on Windows.
|
| 508 |
+
|
| 509 |
+
Defaults to `rerun`.
|
| 510 |
+
executable_path:
|
| 511 |
+
Enforce a specific executable to use instead of searching
|
| 512 |
+
through PATH for `executable_name`.
|
| 513 |
+
|
| 514 |
+
Unspecified by default.
|
| 515 |
+
recording:
|
| 516 |
+
Specifies the [`rerun.RecordingStream`][] to use if `connect = True`.
|
| 517 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 518 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 519 |
+
default_blueprint
|
| 520 |
+
Optionally set a default blueprint to use for this application. If the application
|
| 521 |
+
already has an active blueprint, the new blueprint won't become active until the user
|
| 522 |
+
clicks the "reset blueprint" button. If you want to activate the new blueprint
|
| 523 |
+
immediately, instead use the [`rerun.send_blueprint`][] API.
|
| 524 |
+
|
| 525 |
+
"""
|
| 526 |
+
|
| 527 |
+
if not is_recording_enabled(recording):
|
| 528 |
+
logging.warning("Rerun is disabled - spawn() call ignored.")
|
| 529 |
+
return
|
| 530 |
+
|
| 531 |
+
_spawn_viewer(
|
| 532 |
+
port=port,
|
| 533 |
+
memory_limit=memory_limit,
|
| 534 |
+
server_memory_limit=server_memory_limit,
|
| 535 |
+
hide_welcome_screen=hide_welcome_screen,
|
| 536 |
+
detach_process=detach_process,
|
| 537 |
+
executable_name=executable_name,
|
| 538 |
+
executable_path=executable_path,
|
| 539 |
+
)
|
| 540 |
+
|
| 541 |
+
if connect:
|
| 542 |
+
connect_grpc(
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from datetime import UTC, datetime, timedelta
|
| 4 |
+
from typing import TYPE_CHECKING, overload
|
| 5 |
+
|
| 6 |
+
import numpy as np
|
| 7 |
+
import pyarrow as pa
|
| 8 |
+
|
| 9 |
+
import rerun_bindings as bindings
|
| 10 |
+
|
| 11 |
+
if TYPE_CHECKING:
|
| 12 |
+
from rerun.recording_stream import RecordingStream
|
| 13 |
+
|
| 14 |
+
# --- Time ---
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# These overloads ensure that mypy can catch errors that would otherwise not be caught until runtime.
|
| 18 |
+
@overload
|
| 19 |
+
def set_time(timeline: str, *, recording: RecordingStream | None = None, sequence: int) -> None: ...
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
@overload
|
| 23 |
+
def set_time(
|
| 24 |
+
timeline: str,
|
| 25 |
+
*,
|
| 26 |
+
recording: RecordingStream | None = None,
|
| 27 |
+
duration: int | float | timedelta | np.timedelta64,
|
| 28 |
+
) -> None: ...
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
@overload
|
| 32 |
+
def set_time(
|
| 33 |
+
timeline: str,
|
| 34 |
+
*,
|
| 35 |
+
recording: RecordingStream | None = None,
|
| 36 |
+
timestamp: int | float | datetime | np.datetime64,
|
| 37 |
+
) -> None: ...
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def set_time(
|
| 41 |
+
timeline: str,
|
| 42 |
+
*,
|
| 43 |
+
recording: RecordingStream | None = None,
|
| 44 |
+
sequence: int | None = None,
|
| 45 |
+
duration: int | float | timedelta | np.timedelta64 | None = None,
|
| 46 |
+
timestamp: int | float | datetime | np.datetime64 | pa.TimestampScalar | None = None,
|
| 47 |
+
) -> None:
|
| 48 |
+
"""
|
| 49 |
+
Set the current time of a timeline for this thread.
|
| 50 |
+
|
| 51 |
+
Used for all subsequent logging on the same thread, until the next call to
|
| 52 |
+
[`rerun.set_time`][], [`rerun.reset_time`][] or [`rerun.disable_timeline`][].
|
| 53 |
+
|
| 54 |
+
For example: `set_time("frame_nr", sequence=frame_nr)`.
|
| 55 |
+
|
| 56 |
+
There is no requirement of monotonicity. You can move the time backwards if you like.
|
| 57 |
+
|
| 58 |
+
You are expected to set exactly ONE of the arguments `sequence`, `duration`, or `timestamp`.
|
| 59 |
+
You may NOT change the type of a timeline, so if you use `duration` for a specific timeline,
|
| 60 |
+
you must only use `duration` for that timeline going forward.
|
| 61 |
+
|
| 62 |
+
The columnar equivalent to this function is [`rerun.TimeColumn`][].
|
| 63 |
+
|
| 64 |
+
Parameters
|
| 65 |
+
----------
|
| 66 |
+
timeline:
|
| 67 |
+
The name of the timeline to set the time for.
|
| 68 |
+
recording:
|
| 69 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 70 |
+
If left unspecified, defaults to the current active data recording (if there is one).
|
| 71 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 72 |
+
sequence:
|
| 73 |
+
Used for sequential indices, like `frame_nr`.
|
| 74 |
+
Must be an integer.
|
| 75 |
+
duration:
|
| 76 |
+
Used for relative times, like `time_since_start`.
|
| 77 |
+
Must either be in seconds, a [`datetime.timedelta`][], or [`numpy.timedelta64`][].
|
| 78 |
+
For nanosecond precision, use `numpy.timedelta64(nanoseconds, 'ns')`.
|
| 79 |
+
timestamp:
|
| 80 |
+
Used for absolute time indices, like `capture_time`.
|
| 81 |
+
Must either be in seconds since Unix epoch, a [`datetime.datetime`][], or [`numpy.datetime64`][].
|
| 82 |
+
For nanosecond precision, use `numpy.datetime64(nanoseconds, 'ns')`.
|
| 83 |
+
|
| 84 |
+
"""
|
| 85 |
+
if sum(x is not None for x in (sequence, duration, timestamp)) != 1:
|
| 86 |
+
raise ValueError(
|
| 87 |
+
f"set_time: Exactly one of `sequence`, `duration`, and `timestamp` must be set (timeline='{timeline}')",
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
if sequence is not None:
|
| 91 |
+
bindings.set_time_sequence(
|
| 92 |
+
timeline,
|
| 93 |
+
sequence,
|
| 94 |
+
recording=recording.to_native() if recording is not None else None,
|
| 95 |
+
)
|
| 96 |
+
elif duration is not None:
|
| 97 |
+
nanos = to_nanos(duration)
|
| 98 |
+
bindings.set_time_duration_nanos(
|
| 99 |
+
timeline,
|
| 100 |
+
nanos,
|
| 101 |
+
recording=recording.to_native() if recording is not None else None,
|
| 102 |
+
)
|
| 103 |
+
elif timestamp is not None:
|
| 104 |
+
nanos = to_nanos_since_epoch(timestamp)
|
| 105 |
+
bindings.set_time_timestamp_nanos_since_epoch(
|
| 106 |
+
timeline,
|
| 107 |
+
nanos,
|
| 108 |
+
recording=recording.to_native() if recording is not None else None,
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def to_nanos(duration: int | np.integer | float | np.float64 | timedelta | np.timedelta64) -> int:
|
| 113 |
+
if isinstance(duration, np.timedelta64):
|
| 114 |
+
return duration.astype("timedelta64[ns]").astype("int64") # type: ignore[no-any-return]
|
| 115 |
+
elif isinstance(duration, timedelta):
|
| 116 |
+
return round(1e9 * duration.total_seconds())
|
| 117 |
+
elif isinstance(duration, (int, np.integer)):
|
| 118 |
+
return 1_000_000_000 * int(duration) # Interpret as seconds and convert to nanos
|
| 119 |
+
elif isinstance(
|
| 120 |
+
duration,
|
| 121 |
+
(float, np.floating),
|
| 122 |
+
):
|
| 123 |
+
return round(1e9 * float(duration)) # Interpret as seconds and convert to nanos
|
| 124 |
+
else:
|
| 125 |
+
raise TypeError(
|
| 126 |
+
f"set_time: duration must be an int, float, timedelta, or numpy.timedelta64 object, got {type(duration)}",
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def to_nanos_since_epoch(
|
| 131 |
+
timestamp: int | np.integer | float | np.float64 | datetime | np.datetime64 | pa.TimestampScalar,
|
| 132 |
+
) -> int:
|
| 133 |
+
# Only allowing f64 since anything less has way too little precision for measuring time since 1970
|
| 134 |
+
if isinstance(timestamp, (int, np.integer, float, np.float64)):
|
| 135 |
+
if timestamp > 1e11:
|
| 136 |
+
raise ValueError("set_time: Expected seconds since unix epoch, but it looks like this is in milliseconds")
|
| 137 |
+
return int(np.round(1e9 * timestamp)) # Interpret as seconds and convert to nanos
|
| 138 |
+
elif isinstance(timestamp, datetime):
|
| 139 |
+
# Special case pandas to avoid loss of precision
|
| 140 |
+
if (to_datetime64 := getattr(timestamp, "to_datetime64", None)) is not None:
|
| 141 |
+
datetime64: np.datetime64 = to_datetime64()
|
| 142 |
+
return int(datetime64.astype("datetime64[ns]").astype("int64"))
|
| 143 |
+
|
| 144 |
+
if timestamp.tzinfo is None:
|
| 145 |
+
timestamp = timestamp.replace(tzinfo=UTC)
|
| 146 |
+
else:
|
| 147 |
+
timestamp = timestamp.astimezone(UTC)
|
| 148 |
+
epoch = datetime(1970, 1, 1, tzinfo=UTC)
|
| 149 |
+
|
| 150 |
+
return int(np.round(1e9 * (timestamp - epoch).total_seconds()))
|
| 151 |
+
elif isinstance(timestamp, np.datetime64):
|
| 152 |
+
return int(timestamp.astype("datetime64[ns]").astype("int64"))
|
| 153 |
+
elif isinstance(timestamp, pa.TimestampScalar):
|
| 154 |
+
return int(timestamp.value)
|
| 155 |
+
else:
|
| 156 |
+
raise TypeError(
|
| 157 |
+
f"set_time: timestamp must be an int, float, datetime, numpy.datetime64, or pyarrow.TimestampScalar object, got {type(timestamp)}",
|
| 158 |
+
)
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
# TODO(emilk): rename to something with the word `index`, and maybe unify with `reset_time`?
|
| 162 |
+
def disable_timeline(timeline: str, recording: RecordingStream | None = None) -> None:
|
| 163 |
+
"""
|
| 164 |
+
Clear time information for the specified timeline on this thread.
|
| 165 |
+
|
| 166 |
+
Parameters
|
| 167 |
+
----------
|
| 168 |
+
timeline:
|
| 169 |
+
The name of the timeline to clear the time for.
|
| 170 |
+
recording:
|
| 171 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 172 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 173 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 174 |
+
|
| 175 |
+
"""
|
| 176 |
+
|
| 177 |
+
bindings.disable_timeline(
|
| 178 |
+
timeline,
|
| 179 |
+
recording=recording.to_native() if recording is not None else None,
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
# TODO(emilk): rename to something with the word `index`, and maybe unify with `disable_timeline`?
|
| 184 |
+
def reset_time(recording: RecordingStream | None = None) -> None:
|
| 185 |
+
"""
|
| 186 |
+
Clear all timeline information on this thread.
|
| 187 |
+
|
| 188 |
+
This is the same as calling `disable_timeline` for all of the active timelines.
|
| 189 |
+
|
| 190 |
+
Used for all subsequent logging on the same thread,
|
| 191 |
+
until the next call to [`rerun.set_time`][].
|
| 192 |
+
|
| 193 |
+
Parameters
|
| 194 |
+
----------
|
| 195 |
+
recording:
|
| 196 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 197 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 198 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 199 |
+
|
| 200 |
+
"""
|
| 201 |
+
|
| 202 |
+
bindings.reset_time(
|
| 203 |
+
recording=recording.to_native() if recording is not None else None,
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def set_log_tick_enabled(enabled: bool, recording: RecordingStream | None = None) -> None:
|
| 208 |
+
"""
|
| 209 |
+
Enable or disable automatic injection of the `log_tick` timeline into logged data.
|
| 210 |
+
|
| 211 |
+
`log_tick` is a per-recording counter that increments on every logging call.
|
| 212 |
+
It is **disabled** by default (it can also be controlled via the `RERUN_LOG_TICK` environment variable).
|
| 213 |
+
|
| 214 |
+
Parameters
|
| 215 |
+
----------
|
| 216 |
+
enabled:
|
| 217 |
+
Whether to inject the `log_tick` timeline.
|
| 218 |
+
recording:
|
| 219 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 220 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 221 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 222 |
+
|
| 223 |
+
"""
|
| 224 |
+
|
| 225 |
+
bindings.set_log_tick_enabled(
|
| 226 |
+
enabled,
|
| 227 |
+
recording=recording.to_native() if recording is not None else None,
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def set_log_time_enabled(enabled: bool, recording: RecordingStream | None = None) -> None:
|
| 232 |
+
"""
|
| 233 |
+
Enable or disable automatic injection of the `log_time` timeline into logged data.
|
| 234 |
+
|
| 235 |
+
`log_time` is the wall-clock time at which data was logged.
|
| 236 |
+
It is **enabled** by default (it can also be controlled via the `RERUN_LOG_TIME` environment variable).
|
| 237 |
+
|
| 238 |
+
Parameters
|
| 239 |
+
----------
|
| 240 |
+
enabled:
|
| 241 |
+
Whether to inject the `log_time` timeline.
|
| 242 |
+
recording:
|
| 243 |
+
Specifies the [`rerun.RecordingStream`][] to use.
|
| 244 |
+
If left unspecified, defaults to the current active data recording, if there is one.
|
| 245 |
+
See also: [`rerun.init`][], [`rerun.set_global_data_recording`][].
|
| 246 |
+
|
| 247 |
+
"""
|
| 248 |
+
|
| 249 |
+
bindings.set_log_time_enabled(
|
| 250 |
+
enabled,
|
| 251 |
+
recording=recording.to_native() if recording is not None else None,
|
| 252 |
+
)
|
player/runtime/python/Lib/site-packages/rerun/urdf.py
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import warnings
|
| 4 |
+
from typing import TYPE_CHECKING
|
| 5 |
+
|
| 6 |
+
from rerun_bindings import _UrdfJointInternal, _UrdfLinkInternal, _UrdfMimicInternal, _UrdfTreeInternal
|
| 7 |
+
|
| 8 |
+
if TYPE_CHECKING:
|
| 9 |
+
from collections.abc import Sequence
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
import pyarrow as pa
|
| 13 |
+
|
| 14 |
+
from . import Transform3D
|
| 15 |
+
from ._baseclasses import ComponentColumnList
|
| 16 |
+
from .chunk import LazyChunkStream
|
| 17 |
+
from .recording_stream import RecordingStream
|
| 18 |
+
|
| 19 |
+
__all__ = ["UrdfJoint", "UrdfLink", "UrdfMimic", "UrdfTree"]
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class UrdfMimic:
|
| 23 |
+
"""
|
| 24 |
+
A URDF `<mimic>` tag specification.
|
| 25 |
+
|
| 26 |
+
A mimic joint's value is derived from a driver joint as
|
| 27 |
+
`value = multiplier * driver_value + offset`.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
def __init__(self, inner: _UrdfMimicInternal) -> None:
|
| 31 |
+
self._inner = inner
|
| 32 |
+
|
| 33 |
+
@property
|
| 34 |
+
def joint(self) -> str:
|
| 35 |
+
"""Name of the driver joint."""
|
| 36 |
+
return self._inner.joint
|
| 37 |
+
|
| 38 |
+
@property
|
| 39 |
+
def multiplier(self) -> float:
|
| 40 |
+
"""Multiplier applied to the driver joint's value (defaults to `1.0`)."""
|
| 41 |
+
return self._inner.multiplier
|
| 42 |
+
|
| 43 |
+
@property
|
| 44 |
+
def offset(self) -> float:
|
| 45 |
+
"""Offset added after multiplying the driver joint's value (defaults to `0.0`)."""
|
| 46 |
+
return self._inner.offset
|
| 47 |
+
|
| 48 |
+
def __repr__(self) -> str:
|
| 49 |
+
return self._inner.__repr__()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class UrdfJoint:
|
| 53 |
+
"""A URDF joint with properties and transform computation."""
|
| 54 |
+
|
| 55 |
+
def __init__(self, inner: _UrdfJointInternal) -> None:
|
| 56 |
+
self._inner = inner
|
| 57 |
+
|
| 58 |
+
@property
|
| 59 |
+
def name(self) -> str:
|
| 60 |
+
"""Name of the joint."""
|
| 61 |
+
return self._inner.name
|
| 62 |
+
|
| 63 |
+
@property
|
| 64 |
+
def joint_type(self) -> str:
|
| 65 |
+
"""Type of the joint (revolute, continuous, prismatic, fixed, etc.)."""
|
| 66 |
+
return self._inner.joint_type
|
| 67 |
+
|
| 68 |
+
@property
|
| 69 |
+
def parent_link(self) -> str:
|
| 70 |
+
"""Name of the parent link."""
|
| 71 |
+
return self._inner.parent_link
|
| 72 |
+
|
| 73 |
+
@property
|
| 74 |
+
def child_link(self) -> str:
|
| 75 |
+
"""Name of the child link."""
|
| 76 |
+
return self._inner.child_link
|
| 77 |
+
|
| 78 |
+
@property
|
| 79 |
+
def axis(self) -> tuple[float, float, float]:
|
| 80 |
+
"""Axis of the joint."""
|
| 81 |
+
return self._inner.axis
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def origin_xyz(self) -> tuple[float, float, float]:
|
| 85 |
+
"""Origin of the joint (translation)."""
|
| 86 |
+
return self._inner.origin_xyz
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def origin_rpy(self) -> tuple[float, float, float]:
|
| 90 |
+
"""Origin of the joint (rotation in roll, pitch, yaw)."""
|
| 91 |
+
return self._inner.origin_rpy
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def limit_lower(self) -> float:
|
| 95 |
+
"""Lower limit of the joint."""
|
| 96 |
+
return self._inner.limit_lower
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def limit_upper(self) -> float:
|
| 100 |
+
"""Upper limit of the joint."""
|
| 101 |
+
return self._inner.limit_upper
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def limit_effort(self) -> float:
|
| 105 |
+
"""Effort limit of the joint."""
|
| 106 |
+
return self._inner.limit_effort
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def limit_velocity(self) -> float:
|
| 110 |
+
"""Velocity limit of the joint."""
|
| 111 |
+
return self._inner.limit_velocity
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def mimic(self) -> UrdfMimic | None:
|
| 115 |
+
"""Mimic-tag specification, or `None` if this joint is not a mimic joint."""
|
| 116 |
+
inner = self._inner.mimic
|
| 117 |
+
return UrdfMimic(inner) if inner is not None else None
|
| 118 |
+
|
| 119 |
+
def compute_transform(self, value: float, clamp: bool = True) -> Transform3D:
|
| 120 |
+
"""
|
| 121 |
+
Compute a Transform3D for this joint at the given value.
|
| 122 |
+
|
| 123 |
+
Parameters
|
| 124 |
+
----------
|
| 125 |
+
value:
|
| 126 |
+
Joint angle in radians (revolute/continuous) or distance in meters (prismatic).
|
| 127 |
+
Ignored for fixed joints. Values outside limits are clamped with a warning if `clamp` is True.
|
| 128 |
+
clamp:
|
| 129 |
+
Whether to clamp & warn about values outside joint limits.
|
| 130 |
+
|
| 131 |
+
Returns
|
| 132 |
+
-------
|
| 133 |
+
Transform3D
|
| 134 |
+
Transform with rotation, translation, parent_frame, and child_frame ready to log.
|
| 135 |
+
|
| 136 |
+
"""
|
| 137 |
+
from . import Transform3D
|
| 138 |
+
from .encodings import Quaternion
|
| 139 |
+
|
| 140 |
+
result = self._inner.compute_transform(value, clamp=clamp)
|
| 141 |
+
|
| 142 |
+
if result["warning"] is not None:
|
| 143 |
+
warnings.warn(result["warning"], UserWarning, stacklevel=2)
|
| 144 |
+
|
| 145 |
+
return Transform3D(
|
| 146 |
+
quaternion=Quaternion(xyzw=result["quaternion_xyzw"]),
|
| 147 |
+
translation=result["translation"],
|
| 148 |
+
parent_frame=result["parent_frame"],
|
| 149 |
+
child_frame=result["child_frame"],
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
def compute_transform_columns(self, values: Sequence[float], *, clamp: bool = True) -> ComponentColumnList:
|
| 153 |
+
"""
|
| 154 |
+
Compute transforms for this joint at multiple values, returning columnar data for use with `send_columns`.
|
| 155 |
+
|
| 156 |
+
Parameters
|
| 157 |
+
----------
|
| 158 |
+
values:
|
| 159 |
+
Joint values: angles in radians (revolute/continuous) or distances in meters (prismatic).
|
| 160 |
+
Values outside limits are clamped with a warning if `clamp` is True.
|
| 161 |
+
clamp:
|
| 162 |
+
Whether to clamp & warn about values outside joint limits.
|
| 163 |
+
|
| 164 |
+
Returns
|
| 165 |
+
-------
|
| 166 |
+
ComponentColumnList
|
| 167 |
+
Columnar transform data ready for use with [`rerun.send_columns`][].
|
| 168 |
+
|
| 169 |
+
"""
|
| 170 |
+
from . import Transform3D
|
| 171 |
+
|
| 172 |
+
result = self._inner.compute_transform_columns(list(values), clamp=clamp)
|
| 173 |
+
|
| 174 |
+
for warning in result["warnings"]:
|
| 175 |
+
warnings.warn(warning, UserWarning, stacklevel=2)
|
| 176 |
+
|
| 177 |
+
return Transform3D.columns(
|
| 178 |
+
translation=result["translations"],
|
| 179 |
+
quaternion=result["quaternions_xyzw"],
|
| 180 |
+
parent_frame=[result["parent_frame"]] * len(values),
|
| 181 |
+
child_frame=[result["child_frame"]] * len(values),
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
def __repr__(self) -> str:
|
| 185 |
+
return self._inner.__repr__()
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
class UrdfLink:
|
| 189 |
+
"""A URDF link."""
|
| 190 |
+
|
| 191 |
+
def __init__(self, inner: _UrdfLinkInternal) -> None:
|
| 192 |
+
self._inner = inner
|
| 193 |
+
|
| 194 |
+
@property
|
| 195 |
+
def name(self) -> str:
|
| 196 |
+
"""Name of the link."""
|
| 197 |
+
return self._inner.name
|
| 198 |
+
|
| 199 |
+
def __repr__(self) -> str:
|
| 200 |
+
return self._inner.__repr__()
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
class UrdfTree:
|
| 204 |
+
"""
|
| 205 |
+
A URDF robot model with joints and links.
|
| 206 |
+
|
| 207 |
+
Use [`log_urdf_to_recording`][rerun.urdf.UrdfTree.log_urdf_to_recording] to log the full model (geometry + static transforms), then animate
|
| 208 |
+
individual joints by logging [`archetypes.Transform3D`][rerun.archetypes.Transform3D] computed via
|
| 209 |
+
[`UrdfJoint.compute_transform`][rerun.urdf.UrdfJoint.compute_transform].
|
| 210 |
+
"""
|
| 211 |
+
|
| 212 |
+
def __init__(self, inner: _UrdfTreeInternal) -> None:
|
| 213 |
+
self._inner = inner
|
| 214 |
+
|
| 215 |
+
@staticmethod
|
| 216 |
+
def from_file_path(
|
| 217 |
+
path: str | Path,
|
| 218 |
+
entity_path_prefix: str | None = None,
|
| 219 |
+
*,
|
| 220 |
+
frame_prefix: str | None = None,
|
| 221 |
+
static_transform_entity_path: str | None = None,
|
| 222 |
+
) -> UrdfTree:
|
| 223 |
+
"""
|
| 224 |
+
Load a URDF file from the given path.
|
| 225 |
+
|
| 226 |
+
Parameters
|
| 227 |
+
----------
|
| 228 |
+
path:
|
| 229 |
+
Path to the URDF file.
|
| 230 |
+
entity_path_prefix:
|
| 231 |
+
Optional entity path prefix.
|
| 232 |
+
frame_prefix:
|
| 233 |
+
Optional prefix for all frame IDs.
|
| 234 |
+
Use to load the same URDF multiple times with unique frames.
|
| 235 |
+
static_transform_entity_path:
|
| 236 |
+
Optional entity path to use when logging static transforms.
|
| 237 |
+
If omitted, defaults to `/tf_static`.
|
| 238 |
+
This path is not affected by `entity_path_prefix`.
|
| 239 |
+
|
| 240 |
+
"""
|
| 241 |
+
return UrdfTree(
|
| 242 |
+
_UrdfTreeInternal.from_file_path(
|
| 243 |
+
path,
|
| 244 |
+
entity_path_prefix,
|
| 245 |
+
frame_prefix=frame_prefix,
|
| 246 |
+
static_transform_entity_path=static_transform_entity_path,
|
| 247 |
+
)
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
@property
|
| 251 |
+
def name(self) -> str:
|
| 252 |
+
"""Name of the robot defined in this URDF."""
|
| 253 |
+
return self._inner.name
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
def frame_prefix(self) -> str | None:
|
| 257 |
+
"""The frame prefix, if set."""
|
| 258 |
+
return self._inner.frame_prefix
|
| 259 |
+
|
| 260 |
+
def root_link(self) -> UrdfLink:
|
| 261 |
+
"""Get the root link of the URDF."""
|
| 262 |
+
return UrdfLink(self._inner.root_link())
|
| 263 |
+
|
| 264 |
+
def joints(self) -> list[UrdfJoint]:
|
| 265 |
+
"""Get all joints in the URDF."""
|
| 266 |
+
return [UrdfJoint(j) for j in self._inner.joints()]
|
| 267 |
+
|
| 268 |
+
def get_joint_by_name(self, joint_name: str) -> UrdfJoint | None:
|
| 269 |
+
"""
|
| 270 |
+
Get a joint by name.
|
| 271 |
+
|
| 272 |
+
Parameters
|
| 273 |
+
----------
|
| 274 |
+
joint_name:
|
| 275 |
+
Name of the joint.
|
| 276 |
+
|
| 277 |
+
"""
|
| 278 |
+
inner = self._inner.get_joint_by_name(joint_name)
|
| 279 |
+
return UrdfJoint(inner) if inner else None
|
| 280 |
+
|
| 281 |
+
def get_joint_child(self, joint: UrdfJoint) -> UrdfLink:
|
| 282 |
+
"""
|
| 283 |
+
Get the child link of a joint.
|
| 284 |
+
|
| 285 |
+
Parameters
|
| 286 |
+
----------
|
| 287 |
+
joint:
|
| 288 |
+
The joint whose child link to retrieve.
|
| 289 |
+
|
| 290 |
+
"""
|
| 291 |
+
return UrdfLink(self._inner.get_joint_child(joint._inner))
|
| 292 |
+
|
| 293 |
+
def get_link_by_name(self, link_name: str) -> UrdfLink | None:
|
| 294 |
+
"""
|
| 295 |
+
Get a link by name.
|
| 296 |
+
|
| 297 |
+
Parameters
|
| 298 |
+
----------
|
| 299 |
+
link_name:
|
| 300 |
+
Name of the link.
|
| 301 |
+
|
| 302 |
+
"""
|
| 303 |
+
inner = self._inner.get_link_by_name(link_name)
|
| 304 |
+
return UrdfLink(inner) if inner else None
|
| 305 |
+
|
| 306 |
+
def get_visual_geometry_paths(self, link: str | UrdfLink) -> list[str]:
|
| 307 |
+
"""
|
| 308 |
+
Get the entity paths for all visual geometries of the given link, if any.
|
| 309 |
+
|
| 310 |
+
Parameters
|
| 311 |
+
----------
|
| 312 |
+
link:
|
| 313 |
+
The link for which to get visual geometry paths,
|
| 314 |
+
either by name or as an UrdfLink instance.
|
| 315 |
+
|
| 316 |
+
"""
|
| 317 |
+
if isinstance(link, str):
|
| 318 |
+
inner = self._inner.get_link_by_name(link)
|
| 319 |
+
if inner is None:
|
| 320 |
+
return []
|
| 321 |
+
else:
|
| 322 |
+
inner = link._inner
|
| 323 |
+
return self._inner.get_visual_geometry_paths(inner)
|
| 324 |
+
|
| 325 |
+
def get_collision_geometry_paths(self, link: str | UrdfLink) -> list[str]:
|
| 326 |
+
"""
|
| 327 |
+
Get the entity paths for all collision geometries of the given link, if any.
|
| 328 |
+
|
| 329 |
+
Parameters
|
| 330 |
+
----------
|
| 331 |
+
link:
|
| 332 |
+
The link for which to retrieve the collision geometry entity paths,
|
| 333 |
+
either by name or as an UrdfLink instance.
|
| 334 |
+
|
| 335 |
+
"""
|
| 336 |
+
if isinstance(link, str):
|
| 337 |
+
inner = self._inner.get_link_by_name(link)
|
| 338 |
+
if inner is None:
|
| 339 |
+
return []
|
| 340 |
+
else:
|
| 341 |
+
inner = link._inner
|
| 342 |
+
return self._inner.get_collision_geometry_paths(inner)
|
| 343 |
+
|
| 344 |
+
def log_urdf_to_recording(self, recording: RecordingStream | None = None) -> None:
|
| 345 |
+
"""
|
| 346 |
+
Log the full robot model (geometry + static transforms) to a recording stream.
|
| 347 |
+
|
| 348 |
+
This can be used as alternative to [`rerun.log_file_from_path`][] for URDF files,
|
| 349 |
+
especially in cases where you need the extra configuration options of `UrdfTree`
|
| 350 |
+
(e.g. `frame_prefix` for multi-robot setups).
|
| 351 |
+
|
| 352 |
+
Parameters
|
| 353 |
+
----------
|
| 354 |
+
recording:
|
| 355 |
+
The recording stream to log to. If `None`, the current active recording is used.
|
| 356 |
+
|
| 357 |
+
"""
|
| 358 |
+
self._inner.log(recording.to_native() if recording is not None else None)
|
| 359 |
+
|
| 360 |
+
def stream(self, *, include_joint_transforms: bool = True) -> LazyChunkStream:
|
| 361 |
+
"""
|
| 362 |
+
Return a lazy stream over chunks emitted from this URDF tree.
|
| 363 |
+
|
| 364 |
+
!!! warning
|
| 365 |
+
This method is experimental and returns the experimental
|
| 366 |
+
`rerun.chunk.LazyChunkStream` API.
|
| 367 |
+
|
| 368 |
+
Parameters
|
| 369 |
+
----------
|
| 370 |
+
include_joint_transforms:
|
| 371 |
+
Whether to include the static joint transforms from the URDF.
|
| 372 |
+
|
| 373 |
+
"""
|
| 374 |
+
from .chunk import LazyChunkStream
|
| 375 |
+
|
| 376 |
+
return LazyChunkStream(self._inner.stream(include_joint_transforms=include_joint_transforms))
|
| 377 |
+
|
| 378 |
+
def compute_joint_transform_batches(
|
| 379 |
+
self,
|
| 380 |
+
names: pa.Array,
|
| 381 |
+
values: pa.Array,
|
| 382 |
+
*,
|
| 383 |
+
clamp: bool = False,
|
| 384 |
+
) -> pa.Array:
|
| 385 |
+
"""
|
| 386 |
+
Compute batches of 3D transform components from Arrow list arrays containing joint names and values.
|
| 387 |
+
|
| 388 |
+
`names` must be a `ListArray` with `Utf8` values.
|
| 389 |
+
`values` must be a `ListArray` with values castable to `Float64`.
|
| 390 |
+
|
| 391 |
+
The output is a `ListArray` with `translation`, `quaternion`, `parent_frame`, and
|
| 392 |
+
`child_frame` fields and the same outer row count as the inputs.
|
| 393 |
+
|
| 394 |
+
Note: this is intended as a helper for lens pipelines, where you would usually pipe this output
|
| 395 |
+
through an additional lens that scatters each batch into final `Transform3D` component rows.
|
| 396 |
+
|
| 397 |
+
Parameters
|
| 398 |
+
----------
|
| 399 |
+
names:
|
| 400 |
+
Joint names for each row.
|
| 401 |
+
values:
|
| 402 |
+
Joint values for each row.
|
| 403 |
+
clamp:
|
| 404 |
+
Whether to clamp & warn about values outside joint limits.
|
| 405 |
+
|
| 406 |
+
Returns
|
| 407 |
+
-------
|
| 408 |
+
pa.Array
|
| 409 |
+
Transform batches with one outer row for each input row.
|
| 410 |
+
|
| 411 |
+
"""
|
| 412 |
+
return self._inner.compute_joint_transform_batches(names, values, clamp=clamp)
|
| 413 |
+
|
| 414 |
+
def __repr__(self) -> str:
|
| 415 |
+
return self._inner.__repr__()
|
player/runtime/python/Lib/site-packages/rerun/utilities/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from ._data import (
|
| 4 |
+
ColorGrid as ColorGrid,
|
| 5 |
+
ColorSpiral as ColorSpiral,
|
| 6 |
+
build_color_grid as build_color_grid,
|
| 7 |
+
build_color_spiral as build_color_spiral,
|
| 8 |
+
color_grid as color_grid,
|
| 9 |
+
color_spiral as color_spiral,
|
| 10 |
+
)
|
| 11 |
+
from ._util import (
|
| 12 |
+
bounce_lerp as bounce_lerp,
|
| 13 |
+
)
|
player/runtime/python/Lib/site-packages/rerun/utilities/_data.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Simple data to be used for Rerun demos."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from collections import namedtuple
|
| 6 |
+
from math import cos, sin, tau
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
from ._turbo import turbo_colormap_data
|
| 11 |
+
|
| 12 |
+
ColorGrid = namedtuple("ColorGrid", ["positions", "colors"])
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def build_color_grid(x_count: int = 10, y_count: int = 10, z_count: int = 10, *, twist: float = 0) -> ColorGrid:
|
| 16 |
+
"""
|
| 17 |
+
Create a cube of points with colors.
|
| 18 |
+
|
| 19 |
+
The total point cloud will have x_count * y_count * z_count points.
|
| 20 |
+
|
| 21 |
+
Parameters
|
| 22 |
+
----------
|
| 23 |
+
x_count, y_count, z_count:
|
| 24 |
+
Number of points in each dimension.
|
| 25 |
+
twist:
|
| 26 |
+
Angle to twist from bottom to top of the cube
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
grid = np.mgrid[
|
| 31 |
+
slice(-10, 10, x_count * 1j),
|
| 32 |
+
slice(-10, 10, y_count * 1j),
|
| 33 |
+
slice(-10, 10, z_count * 1j),
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
angle = np.linspace(-float(twist) / 2, float(twist) / 2, z_count)
|
| 37 |
+
for z in range(z_count):
|
| 38 |
+
xv, yv, zv = grid[:, :, :, z]
|
| 39 |
+
rot_xv = xv * cos(angle[z]) - yv * sin(angle[z])
|
| 40 |
+
rot_yv = xv * sin(angle[z]) + yv * cos(angle[z])
|
| 41 |
+
grid[:, :, :, z] = [rot_xv, rot_yv, zv]
|
| 42 |
+
|
| 43 |
+
positions = np.vstack([xyz.ravel() for xyz in grid])
|
| 44 |
+
|
| 45 |
+
colors = np.vstack([
|
| 46 |
+
xyz.ravel()
|
| 47 |
+
for xyz in np.mgrid[
|
| 48 |
+
slice(0, 255, x_count * 1j),
|
| 49 |
+
slice(0, 255, y_count * 1j),
|
| 50 |
+
slice(0, 255, z_count * 1j),
|
| 51 |
+
]
|
| 52 |
+
])
|
| 53 |
+
|
| 54 |
+
return ColorGrid(positions.T, colors.T.astype(np.uint8))
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
color_grid = build_color_grid()
|
| 58 |
+
"""Default color grid"""
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
ColorSpiral = namedtuple("ColorSpiral", ["positions", "colors"])
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def build_color_spiral(
|
| 65 |
+
num_points: int = 100,
|
| 66 |
+
*,
|
| 67 |
+
radius: float = 2,
|
| 68 |
+
angular_step: float = 0.02,
|
| 69 |
+
angular_offset: float = 0,
|
| 70 |
+
z_step: float = 0.1,
|
| 71 |
+
) -> ColorSpiral:
|
| 72 |
+
"""
|
| 73 |
+
Create a spiral of points with colors along the Z axis.
|
| 74 |
+
|
| 75 |
+
Parameters
|
| 76 |
+
----------
|
| 77 |
+
num_points:
|
| 78 |
+
Total number of points.
|
| 79 |
+
radius:
|
| 80 |
+
The radius of the spiral.
|
| 81 |
+
angular_step:
|
| 82 |
+
The factor applied between each step along the trigonometric circle.
|
| 83 |
+
angular_offset:
|
| 84 |
+
Offsets the starting position on the trigonometric circle.
|
| 85 |
+
z_step:
|
| 86 |
+
The factor applied between each step along the Z axis.
|
| 87 |
+
|
| 88 |
+
"""
|
| 89 |
+
positions = np.array([
|
| 90 |
+
[
|
| 91 |
+
cos(i * tau * angular_step + angular_offset) * radius,
|
| 92 |
+
sin(i * tau * angular_step + angular_offset) * radius,
|
| 93 |
+
i * z_step,
|
| 94 |
+
]
|
| 95 |
+
for i in range(num_points)
|
| 96 |
+
])
|
| 97 |
+
colors = turbo_colormap_data[np.linspace(0, len(turbo_colormap_data) - 1, num_points, dtype=int)]
|
| 98 |
+
|
| 99 |
+
return ColorSpiral(positions, colors)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
color_spiral = build_color_spiral()
|
| 103 |
+
"""Default color spiral"""
|
player/runtime/python/Lib/site-packages/rerun/utilities/_turbo.py
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
turbo_colormap_data = np.array([
|
| 6 |
+
[0.18995, 0.07176, 0.23217],
|
| 7 |
+
[0.19483, 0.08339, 0.26149],
|
| 8 |
+
[0.19956, 0.09498, 0.29024],
|
| 9 |
+
[0.20415, 0.10652, 0.31844],
|
| 10 |
+
[0.20860, 0.11802, 0.34607],
|
| 11 |
+
[0.21291, 0.12947, 0.37314],
|
| 12 |
+
[0.21708, 0.14087, 0.39964],
|
| 13 |
+
[0.22111, 0.15223, 0.42558],
|
| 14 |
+
[0.22500, 0.16354, 0.45096],
|
| 15 |
+
[0.22875, 0.17481, 0.47578],
|
| 16 |
+
[0.23236, 0.18603, 0.50004],
|
| 17 |
+
[0.23582, 0.19720, 0.52373],
|
| 18 |
+
[0.23915, 0.20833, 0.54686],
|
| 19 |
+
[0.24234, 0.21941, 0.56942],
|
| 20 |
+
[0.24539, 0.23044, 0.59142],
|
| 21 |
+
[0.24830, 0.24143, 0.61286],
|
| 22 |
+
[0.25107, 0.25237, 0.63374],
|
| 23 |
+
[0.25369, 0.26327, 0.65406],
|
| 24 |
+
[0.25618, 0.27412, 0.67381],
|
| 25 |
+
[0.25853, 0.28492, 0.69300],
|
| 26 |
+
[0.26074, 0.29568, 0.71162],
|
| 27 |
+
[0.26280, 0.30639, 0.72968],
|
| 28 |
+
[0.26473, 0.31706, 0.74718],
|
| 29 |
+
[0.26652, 0.32768, 0.76412],
|
| 30 |
+
[0.26816, 0.33825, 0.78050],
|
| 31 |
+
[0.26967, 0.34878, 0.79631],
|
| 32 |
+
[0.27103, 0.35926, 0.81156],
|
| 33 |
+
[0.27226, 0.36970, 0.82624],
|
| 34 |
+
[0.27334, 0.38008, 0.84037],
|
| 35 |
+
[0.27429, 0.39043, 0.85393],
|
| 36 |
+
[0.27509, 0.40072, 0.86692],
|
| 37 |
+
[0.27576, 0.41097, 0.87936],
|
| 38 |
+
[0.27628, 0.42118, 0.89123],
|
| 39 |
+
[0.27667, 0.43134, 0.90254],
|
| 40 |
+
[0.27691, 0.44145, 0.91328],
|
| 41 |
+
[0.27701, 0.45152, 0.92347],
|
| 42 |
+
[0.27698, 0.46153, 0.93309],
|
| 43 |
+
[0.27680, 0.47151, 0.94214],
|
| 44 |
+
[0.27648, 0.48144, 0.95064],
|
| 45 |
+
[0.27603, 0.49132, 0.95857],
|
| 46 |
+
[0.27543, 0.50115, 0.96594],
|
| 47 |
+
[0.27469, 0.51094, 0.97275],
|
| 48 |
+
[0.27381, 0.52069, 0.97899],
|
| 49 |
+
[0.27273, 0.53040, 0.98461],
|
| 50 |
+
[0.27106, 0.54015, 0.98930],
|
| 51 |
+
[0.26878, 0.54995, 0.99303],
|
| 52 |
+
[0.26592, 0.55979, 0.99583],
|
| 53 |
+
[0.26252, 0.56967, 0.99773],
|
| 54 |
+
[0.25862, 0.57958, 0.99876],
|
| 55 |
+
[0.25425, 0.58950, 0.99896],
|
| 56 |
+
[0.24946, 0.59943, 0.99835],
|
| 57 |
+
[0.24427, 0.60937, 0.99697],
|
| 58 |
+
[0.23874, 0.61931, 0.99485],
|
| 59 |
+
[0.23288, 0.62923, 0.99202],
|
| 60 |
+
[0.22676, 0.63913, 0.98851],
|
| 61 |
+
[0.22039, 0.64901, 0.98436],
|
| 62 |
+
[0.21382, 0.65886, 0.97959],
|
| 63 |
+
[0.20708, 0.66866, 0.97423],
|
| 64 |
+
[0.20021, 0.67842, 0.96833],
|
| 65 |
+
[0.19326, 0.68812, 0.96190],
|
| 66 |
+
[0.18625, 0.69775, 0.95498],
|
| 67 |
+
[0.17923, 0.70732, 0.94761],
|
| 68 |
+
[0.17223, 0.71680, 0.93981],
|
| 69 |
+
[0.16529, 0.72620, 0.93161],
|
| 70 |
+
[0.15844, 0.73551, 0.92305],
|
| 71 |
+
[0.15173, 0.74472, 0.91416],
|
| 72 |
+
[0.14519, 0.75381, 0.90496],
|
| 73 |
+
[0.13886, 0.76279, 0.89550],
|
| 74 |
+
[0.13278, 0.77165, 0.88580],
|
| 75 |
+
[0.12698, 0.78037, 0.87590],
|
| 76 |
+
[0.12151, 0.78896, 0.86581],
|
| 77 |
+
[0.11639, 0.79740, 0.85559],
|
| 78 |
+
[0.11167, 0.80569, 0.84525],
|
| 79 |
+
[0.10738, 0.81381, 0.83484],
|
| 80 |
+
[0.10357, 0.82177, 0.82437],
|
| 81 |
+
[0.10026, 0.82955, 0.81389],
|
| 82 |
+
[0.09750, 0.83714, 0.80342],
|
| 83 |
+
[0.09532, 0.84455, 0.79299],
|
| 84 |
+
[0.09377, 0.85175, 0.78264],
|
| 85 |
+
[0.09287, 0.85875, 0.77240],
|
| 86 |
+
[0.09267, 0.86554, 0.76230],
|
| 87 |
+
[0.09320, 0.87211, 0.75237],
|
| 88 |
+
[0.09451, 0.87844, 0.74265],
|
| 89 |
+
[0.09662, 0.88454, 0.73316],
|
| 90 |
+
[0.09958, 0.89040, 0.72393],
|
| 91 |
+
[0.10342, 0.89600, 0.71500],
|
| 92 |
+
[0.10815, 0.90142, 0.70599],
|
| 93 |
+
[0.11374, 0.90673, 0.69651],
|
| 94 |
+
[0.12014, 0.91193, 0.68660],
|
| 95 |
+
[0.12733, 0.91701, 0.67627],
|
| 96 |
+
[0.13526, 0.92197, 0.66556],
|
| 97 |
+
[0.14391, 0.92680, 0.65448],
|
| 98 |
+
[0.15323, 0.93151, 0.64308],
|
| 99 |
+
[0.16319, 0.93609, 0.63137],
|
| 100 |
+
[0.17377, 0.94053, 0.61938],
|
| 101 |
+
[0.18491, 0.94484, 0.60713],
|
| 102 |
+
[0.19659, 0.94901, 0.59466],
|
| 103 |
+
[0.20877, 0.95304, 0.58199],
|
| 104 |
+
[0.22142, 0.95692, 0.56914],
|
| 105 |
+
[0.23449, 0.96065, 0.55614],
|
| 106 |
+
[0.24797, 0.96423, 0.54303],
|
| 107 |
+
[0.26180, 0.96765, 0.52981],
|
| 108 |
+
[0.27597, 0.97092, 0.51653],
|
| 109 |
+
[0.29042, 0.97403, 0.50321],
|
| 110 |
+
[0.30513, 0.97697, 0.48987],
|
| 111 |
+
[0.32006, 0.97974, 0.47654],
|
| 112 |
+
[0.33517, 0.98234, 0.46325],
|
| 113 |
+
[0.35043, 0.98477, 0.45002],
|
| 114 |
+
[0.36581, 0.98702, 0.43688],
|
| 115 |
+
[0.38127, 0.98909, 0.42386],
|
| 116 |
+
[0.39678, 0.99098, 0.41098],
|
| 117 |
+
[0.41229, 0.99268, 0.39826],
|
| 118 |
+
[0.42778, 0.99419, 0.38575],
|
| 119 |
+
[0.44321, 0.99551, 0.37345],
|
| 120 |
+
[0.45854, 0.99663, 0.36140],
|
| 121 |
+
[0.47375, 0.99755, 0.34963],
|
| 122 |
+
[0.48879, 0.99828, 0.33816],
|
| 123 |
+
[0.50362, 0.99879, 0.32701],
|
| 124 |
+
[0.51822, 0.99910, 0.31622],
|
| 125 |
+
[0.53255, 0.99919, 0.30581],
|
| 126 |
+
[0.54658, 0.99907, 0.29581],
|
| 127 |
+
[0.56026, 0.99873, 0.28623],
|
| 128 |
+
[0.57357, 0.99817, 0.27712],
|
| 129 |
+
[0.58646, 0.99739, 0.26849],
|
| 130 |
+
[0.59891, 0.99638, 0.26038],
|
| 131 |
+
[0.61088, 0.99514, 0.25280],
|
| 132 |
+
[0.62233, 0.99366, 0.24579],
|
| 133 |
+
[0.63323, 0.99195, 0.23937],
|
| 134 |
+
[0.64362, 0.98999, 0.23356],
|
| 135 |
+
[0.65394, 0.98775, 0.22835],
|
| 136 |
+
[0.66428, 0.98524, 0.22370],
|
| 137 |
+
[0.67462, 0.98246, 0.21960],
|
| 138 |
+
[0.68494, 0.97941, 0.21602],
|
| 139 |
+
[0.69525, 0.97610, 0.21294],
|
| 140 |
+
[0.70553, 0.97255, 0.21032],
|
| 141 |
+
[0.71577, 0.96875, 0.20815],
|
| 142 |
+
[0.72596, 0.96470, 0.20640],
|
| 143 |
+
[0.73610, 0.96043, 0.20504],
|
| 144 |
+
[0.74617, 0.95593, 0.20406],
|
| 145 |
+
[0.75617, 0.95121, 0.20343],
|
| 146 |
+
[0.76608, 0.94627, 0.20311],
|
| 147 |
+
[0.77591, 0.94113, 0.20310],
|
| 148 |
+
[0.78563, 0.93579, 0.20336],
|
| 149 |
+
[0.79524, 0.93025, 0.20386],
|
| 150 |
+
[0.80473, 0.92452, 0.20459],
|
| 151 |
+
[0.81410, 0.91861, 0.20552],
|
| 152 |
+
[0.82333, 0.91253, 0.20663],
|
| 153 |
+
[0.83241, 0.90627, 0.20788],
|
| 154 |
+
[0.84133, 0.89986, 0.20926],
|
| 155 |
+
[0.85010, 0.89328, 0.21074],
|
| 156 |
+
[0.85868, 0.88655, 0.21230],
|
| 157 |
+
[0.86709, 0.87968, 0.21391],
|
| 158 |
+
[0.87530, 0.87267, 0.21555],
|
| 159 |
+
[0.88331, 0.86553, 0.21719],
|
| 160 |
+
[0.89112, 0.85826, 0.21880],
|
| 161 |
+
[0.89870, 0.85087, 0.22038],
|
| 162 |
+
[0.90605, 0.84337, 0.22188],
|
| 163 |
+
[0.91317, 0.83576, 0.22328],
|
| 164 |
+
[0.92004, 0.82806, 0.22456],
|
| 165 |
+
[0.92666, 0.82025, 0.22570],
|
| 166 |
+
[0.93301, 0.81236, 0.22667],
|
| 167 |
+
[0.93909, 0.80439, 0.22744],
|
| 168 |
+
[0.94489, 0.79634, 0.22800],
|
| 169 |
+
[0.95039, 0.78823, 0.22831],
|
| 170 |
+
[0.95560, 0.78005, 0.22836],
|
| 171 |
+
[0.96049, 0.77181, 0.22811],
|
| 172 |
+
[0.96507, 0.76352, 0.22754],
|
| 173 |
+
[0.96931, 0.75519, 0.22663],
|
| 174 |
+
[0.97323, 0.74682, 0.22536],
|
| 175 |
+
[0.97679, 0.73842, 0.22369],
|
| 176 |
+
[0.98000, 0.73000, 0.22161],
|
| 177 |
+
[0.98289, 0.72140, 0.21918],
|
| 178 |
+
[0.98549, 0.71250, 0.21650],
|
| 179 |
+
[0.98781, 0.70330, 0.21358],
|
| 180 |
+
[0.98986, 0.69382, 0.21043],
|
| 181 |
+
[0.99163, 0.68408, 0.20706],
|
| 182 |
+
[0.99314, 0.67408, 0.20348],
|
| 183 |
+
[0.99438, 0.66386, 0.19971],
|
| 184 |
+
[0.99535, 0.65341, 0.19577],
|
| 185 |
+
[0.99607, 0.64277, 0.19165],
|
| 186 |
+
[0.99654, 0.63193, 0.18738],
|
| 187 |
+
[0.99675, 0.62093, 0.18297],
|
| 188 |
+
[0.99672, 0.60977, 0.17842],
|
| 189 |
+
[0.99644, 0.59846, 0.17376],
|
| 190 |
+
[0.99593, 0.58703, 0.16899],
|
| 191 |
+
[0.99517, 0.57549, 0.16412],
|
| 192 |
+
[0.99419, 0.56386, 0.15918],
|
| 193 |
+
[0.99297, 0.55214, 0.15417],
|
| 194 |
+
[0.99153, 0.54036, 0.14910],
|
| 195 |
+
[0.98987, 0.52854, 0.14398],
|
| 196 |
+
[0.98799, 0.51667, 0.13883],
|
| 197 |
+
[0.98590, 0.50479, 0.13367],
|
| 198 |
+
[0.98360, 0.49291, 0.12849],
|
| 199 |
+
[0.98108, 0.48104, 0.12332],
|
| 200 |
+
[0.97837, 0.46920, 0.11817],
|
| 201 |
+
[0.97545, 0.45740, 0.11305],
|
| 202 |
+
[0.97234, 0.44565, 0.10797],
|
| 203 |
+
[0.96904, 0.43399, 0.10294],
|
| 204 |
+
[0.96555, 0.42241, 0.09798],
|
| 205 |
+
[0.96187, 0.41093, 0.09310],
|
| 206 |
+
[0.95801, 0.39958, 0.08831],
|
| 207 |
+
[0.95398, 0.38836, 0.08362],
|
| 208 |
+
[0.94977, 0.37729, 0.07905],
|
| 209 |
+
[0.94538, 0.36638, 0.07461],
|
| 210 |
+
[0.94084, 0.35566, 0.07031],
|
| 211 |
+
[0.93612, 0.34513, 0.06616],
|
| 212 |
+
[0.93125, 0.33482, 0.06218],
|
| 213 |
+
[0.92623, 0.32473, 0.05837],
|
| 214 |
+
[0.92105, 0.31489, 0.05475],
|
| 215 |
+
[0.91572, 0.30530, 0.05134],
|
| 216 |
+
[0.91024, 0.29599, 0.04814],
|
| 217 |
+
[0.90463, 0.28696, 0.04516],
|
| 218 |
+
[0.89888, 0.27824, 0.04243],
|
| 219 |
+
[0.89298, 0.26981, 0.03993],
|
| 220 |
+
[0.88691, 0.26152, 0.03753],
|
| 221 |
+
[0.88066, 0.25334, 0.03521],
|
| 222 |
+
[0.87422, 0.24526, 0.03297],
|
| 223 |
+
[0.86760, 0.23730, 0.03082],
|
| 224 |
+
[0.86079, 0.22945, 0.02875],
|
| 225 |
+
[0.85380, 0.22170, 0.02677],
|
| 226 |
+
[0.84662, 0.21407, 0.02487],
|
| 227 |
+
[0.83926, 0.20654, 0.02305],
|
| 228 |
+
[0.83172, 0.19912, 0.02131],
|
| 229 |
+
[0.82399, 0.19182, 0.01966],
|
| 230 |
+
[0.81608, 0.18462, 0.01809],
|
| 231 |
+
[0.80799, 0.17753, 0.01660],
|
| 232 |
+
[0.79971, 0.17055, 0.01520],
|
| 233 |
+
[0.79125, 0.16368, 0.01387],
|
| 234 |
+
[0.78260, 0.15693, 0.01264],
|
| 235 |
+
[0.77377, 0.15028, 0.01148],
|
| 236 |
+
[0.76476, 0.14374, 0.01041],
|
| 237 |
+
[0.75556, 0.13731, 0.00942],
|
| 238 |
+
[0.74617, 0.13098, 0.00851],
|
| 239 |
+
[0.73661, 0.12477, 0.00769],
|
| 240 |
+
[0.72686, 0.11867, 0.00695],
|
| 241 |
+
[0.71692, 0.11268, 0.00629],
|
| 242 |
+
[0.70680, 0.10680, 0.00571],
|
| 243 |
+
[0.69650, 0.10102, 0.00522],
|
| 244 |
+
[0.68602, 0.09536, 0.00481],
|
| 245 |
+
[0.67535, 0.08980, 0.00449],
|
| 246 |
+
[0.66449, 0.08436, 0.00424],
|
| 247 |
+
[0.65345, 0.07902, 0.00408],
|
| 248 |
+
[0.64223, 0.07380, 0.00401],
|
| 249 |
+
[0.63082, 0.06868, 0.00401],
|
| 250 |
+
[0.61923, 0.06367, 0.00410],
|
| 251 |
+
[0.60746, 0.05878, 0.00427],
|
| 252 |
+
[0.59550, 0.05399, 0.00453],
|
| 253 |
+
[0.58336, 0.04931, 0.00486],
|
| 254 |
+
[0.57103, 0.04474, 0.00529],
|
| 255 |
+
[0.55852, 0.04028, 0.00579],
|
| 256 |
+
[0.54583, 0.03593, 0.00638],
|
| 257 |
+
[0.53295, 0.03169, 0.00705],
|
| 258 |
+
[0.51989, 0.02756, 0.00780],
|
| 259 |
+
[0.50664, 0.02354, 0.00863],
|
| 260 |
+
[0.49321, 0.01963, 0.00955],
|
| 261 |
+
[0.47960, 0.01583, 0.01055],
|
| 262 |
+
])
|
player/runtime/python/Lib/site-packages/rerun/utilities/_util.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Simple utilities to be used for Rerun demos."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def bounce_lerp(
|
| 12 |
+
a: float,
|
| 13 |
+
b: float,
|
| 14 |
+
t: float | np.ndarray[Any, np.dtype[Any]],
|
| 15 |
+
) -> float | np.ndarray[Any, np.dtype[Any]]:
|
| 16 |
+
"""
|
| 17 |
+
A linear interpolator that bounces between `a` and `b` as `t` goes above `1.0`.
|
| 18 |
+
|
| 19 |
+
Parameters
|
| 20 |
+
----------
|
| 21 |
+
a:
|
| 22 |
+
Start value (t == 0).
|
| 23 |
+
b:
|
| 24 |
+
End value (t == 1).
|
| 25 |
+
t:
|
| 26 |
+
Interpolation coefficient.
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
+
tf = t % 1
|
| 30 |
+
if int(t) % 2 == 0:
|
| 31 |
+
return (1.0 - tf) * a + tf * b
|
| 32 |
+
else:
|
| 33 |
+
return tf * a + (1.0 - tf) * b
|
player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""DataFusion utilities."""
|
player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/collect.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
if TYPE_CHECKING:
|
| 6 |
+
from datafusion import DataFrame, Expr
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def collect_to_string_list(df: DataFrame, col: str | Expr, remove_nulls: bool = True) -> list[str | None]:
|
| 10 |
+
"""
|
| 11 |
+
Collect a single column of a DataFrame into a Python string list.
|
| 12 |
+
|
| 13 |
+
This is a convenience function. DataFusion collection returns a stream
|
| 14 |
+
of record batches. Sometimes it is preferable to extract a single column
|
| 15 |
+
out of all of these batches and convert it to a string.
|
| 16 |
+
|
| 17 |
+
Parameters
|
| 18 |
+
----------
|
| 19 |
+
df:
|
| 20 |
+
The input DataFusion DataFrame
|
| 21 |
+
col:
|
| 22 |
+
The column to collect. You can provide either a string column
|
| 23 |
+
name or a DataFusion expression.
|
| 24 |
+
remove_nulls:
|
| 25 |
+
If true, any `null` values will be removed from the result. If false
|
| 26 |
+
these will be converted into None.
|
| 27 |
+
|
| 28 |
+
"""
|
| 29 |
+
batches = df.select(col).collect()
|
| 30 |
+
|
| 31 |
+
# Dataframe.collect() will return a list of record batches, but we only care
|
| 32 |
+
# about a single column. We want to combine the results of all batches into
|
| 33 |
+
# a single list. We also know from the above `select` that we will get a
|
| 34 |
+
# single column of data.
|
| 35 |
+
|
| 36 |
+
if remove_nulls:
|
| 37 |
+
return [str(r) for rss in batches for rs in rss for r in rs if r.is_valid]
|
| 38 |
+
return [str(r) if r.is_valid else None for rss in batches for rs in rss for r in rs]
|
player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/functions/__init__.py
ADDED
|
File without changes
|
player/runtime/python/Lib/site-packages/rerun/utilities/datafusion/functions/url_generation.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
import pyarrow as pa
|
| 6 |
+
|
| 7 |
+
from rerun.error_utils import RerunMissingDependencyError
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from rerun.catalog import DatasetEntry
|
| 11 |
+
|
| 12 |
+
HAS_DATAFUSION = True
|
| 13 |
+
try:
|
| 14 |
+
from datafusion import Expr, ScalarUDF, col, lit
|
| 15 |
+
except ModuleNotFoundError:
|
| 16 |
+
HAS_DATAFUSION = False
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def segment_url(
|
| 20 |
+
dataset: DatasetEntry,
|
| 21 |
+
*,
|
| 22 |
+
segment_id: str | Expr | None = None,
|
| 23 |
+
timestamp: str | Expr | None = None,
|
| 24 |
+
timeline_name: str | None = None,
|
| 25 |
+
time_range_start: str | Expr | None = None,
|
| 26 |
+
time_range_end: str | Expr | None = None,
|
| 27 |
+
selection: str | Expr | None = None,
|
| 28 |
+
) -> Expr:
|
| 29 |
+
"""
|
| 30 |
+
Compute the URL for a segment within a dataset.
|
| 31 |
+
|
| 32 |
+
This is a Rerun focused DataFusion function that will create a DataFusion
|
| 33 |
+
expression for the segment URL.
|
| 34 |
+
|
| 35 |
+
Parameters
|
| 36 |
+
----------
|
| 37 |
+
dataset:
|
| 38 |
+
The input Rerun Dataset.
|
| 39 |
+
segment_id:
|
| 40 |
+
Expression or column name for the segment ID. If not provided, the column named `rerun_segment_id` will be used.
|
| 41 |
+
timestamp:
|
| 42 |
+
Expression or column name for a timestamp. Generate a URL that specifies the position of the time cursor when
|
| 43 |
+
opened by the viewer.
|
| 44 |
+
timeline_name:
|
| 45 |
+
Specifies which timeline to use when used in combination with `timestamp` and/or `time_range_start`/
|
| 46 |
+
`time_range_end`. By default, this will use the same string as `timestamp` if provided.
|
| 47 |
+
time_range_start:
|
| 48 |
+
Expression or column name for the start of a time range selection. Must be used together with `time_range_end`.
|
| 49 |
+
Generates a URL that specifies a time range to be selected when opened by the viewer.
|
| 50 |
+
time_range_end:
|
| 51 |
+
Expression or column name for the end of a time range selection. Must be used together with `time_range_start`.
|
| 52 |
+
Generates a URL that specifies a time range to be selected when opened by the viewer.
|
| 53 |
+
selection:
|
| 54 |
+
Expression or column name for the data path to select. The syntax is an entity path, optionally
|
| 55 |
+
followed by an instance index and/or component name (e.g. `/world/points`,
|
| 56 |
+
`/world/points[#42]`, `/world/points:Color`, `/world/points[#42]:Color`).
|
| 57 |
+
Generates a URL that specifies the data to be selected when opened by the viewer.
|
| 58 |
+
|
| 59 |
+
"""
|
| 60 |
+
if not HAS_DATAFUSION:
|
| 61 |
+
raise RerunMissingDependencyError("datafusion", "catalog")
|
| 62 |
+
|
| 63 |
+
if (time_range_start is None) != (time_range_end is None):
|
| 64 |
+
raise ValueError("time_range_start and time_range_end must both be provided or both be omitted")
|
| 65 |
+
|
| 66 |
+
if segment_id is None:
|
| 67 |
+
segment_id = col("rerun_segment_id")
|
| 68 |
+
if isinstance(segment_id, str):
|
| 69 |
+
segment_id = col(segment_id)
|
| 70 |
+
|
| 71 |
+
rust_udf = _make_rust_udf()
|
| 72 |
+
|
| 73 |
+
origin_expr = lit(dataset.catalog.url)
|
| 74 |
+
entry_id_expr = lit(pa.scalar(dataset.id.as_bytes(), type=pa.binary(16)))
|
| 75 |
+
|
| 76 |
+
# Derive timeline_name default from timestamp if not explicitly provided
|
| 77 |
+
if timeline_name is None and timestamp is not None:
|
| 78 |
+
timeline_name = str(timestamp)
|
| 79 |
+
|
| 80 |
+
# Validate that timeline_name is available when needed
|
| 81 |
+
has_time_range = time_range_start is not None
|
| 82 |
+
if timeline_name is None and (timestamp is not None or has_time_range):
|
| 83 |
+
raise ValueError("timeline_name must be provided when using time_range without timestamp")
|
| 84 |
+
|
| 85 |
+
# Build timestamp expression
|
| 86 |
+
if timestamp is not None:
|
| 87 |
+
if isinstance(timestamp, str):
|
| 88 |
+
timestamp = col(timestamp)
|
| 89 |
+
ts_expr = timestamp
|
| 90 |
+
else:
|
| 91 |
+
ts_expr = lit(None)
|
| 92 |
+
|
| 93 |
+
# Build timeline expression
|
| 94 |
+
timeline_expr = lit(timeline_name) if timeline_name is not None else lit(None)
|
| 95 |
+
|
| 96 |
+
# Build time range expressions
|
| 97 |
+
if time_range_start is not None and time_range_end is not None:
|
| 98 |
+
if isinstance(time_range_start, str):
|
| 99 |
+
time_range_start = col(time_range_start)
|
| 100 |
+
if isinstance(time_range_end, str):
|
| 101 |
+
time_range_end = col(time_range_end)
|
| 102 |
+
range_start_expr = time_range_start
|
| 103 |
+
range_end_expr = time_range_end
|
| 104 |
+
else:
|
| 105 |
+
range_start_expr = lit(None)
|
| 106 |
+
range_end_expr = lit(None)
|
| 107 |
+
|
| 108 |
+
# Build selection expression
|
| 109 |
+
if selection is not None:
|
| 110 |
+
if isinstance(selection, str):
|
| 111 |
+
selection = col(selection)
|
| 112 |
+
selection_expr = selection
|
| 113 |
+
else:
|
| 114 |
+
selection_expr = lit(None)
|
| 115 |
+
|
| 116 |
+
return rust_udf(
|
| 117 |
+
origin_expr,
|
| 118 |
+
entry_id_expr,
|
| 119 |
+
segment_id,
|
| 120 |
+
ts_expr,
|
| 121 |
+
timeline_expr,
|
| 122 |
+
range_start_expr,
|
| 123 |
+
range_end_expr,
|
| 124 |
+
selection_expr,
|
| 125 |
+
).alias("segment_url")
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def _make_rust_udf() -> ScalarUDF:
|
| 129 |
+
if not HAS_DATAFUSION:
|
| 130 |
+
raise RerunMissingDependencyError("datafusion", "catalog")
|
| 131 |
+
|
| 132 |
+
from rerun_bindings import SegmentUrlUdfInternal # type: ignore[attr-defined]
|
| 133 |
+
|
| 134 |
+
return ScalarUDF.from_pycapsule(SegmentUrlUdfInternal())
|
player/runtime/python/Lib/site-packages/rerun/web.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
import rerun_bindings as bindings
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def _packaged_assets_archive_path() -> str | None:
|
| 9 |
+
"""
|
| 10 |
+
Path to the web viewer assets archive shipped in the wheel, or `None` if absent.
|
| 11 |
+
|
| 12 |
+
Some wheels are built without web viewer assets embedded in the extension module.
|
| 13 |
+
They instead ship the assets as `rerun/web_viewer.zip`,
|
| 14 |
+
which is expected to be served from disk.
|
| 15 |
+
"""
|
| 16 |
+
path = Path(__file__).parent / "web_viewer.zip"
|
| 17 |
+
return str(path) if path.is_file() else None
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def serve_web_viewer(*, web_port: int | None = None, open_browser: bool = True, connect_to: str | None = None) -> None:
|
| 21 |
+
"""
|
| 22 |
+
Host a web viewer over HTTP.
|
| 23 |
+
|
| 24 |
+
You can pass this function the URL returned from [`rerun.serve_grpc`][] and [`rerun.RecordingStream.serve_grpc`][]
|
| 25 |
+
so that the spawned web viewer connects to that server.
|
| 26 |
+
|
| 27 |
+
Note that this is NOT a log sink, and this does NOT host a gRPC server.
|
| 28 |
+
If you want to log data to a gRPC server and connect the web viewer to it, you can do so like this:
|
| 29 |
+
```
|
| 30 |
+
server_uri = rr.serve_grpc()
|
| 31 |
+
rr.serve_web_viewer(connect_to=server_uri)
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
This function returns immediately.
|
| 35 |
+
In order to keep the web server running you must keep the Python process running too.
|
| 36 |
+
|
| 37 |
+
Parameters
|
| 38 |
+
----------
|
| 39 |
+
web_port:
|
| 40 |
+
The port to serve the web viewer on (defaults to 9090).
|
| 41 |
+
open_browser:
|
| 42 |
+
Open the default browser to the viewer.
|
| 43 |
+
connect_to:
|
| 44 |
+
If `open_browser` is true, then this is the URL the web viewer will connect to.
|
| 45 |
+
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
bindings.serve_web_viewer(
|
| 49 |
+
web_port=web_port,
|
| 50 |
+
open_browser=open_browser,
|
| 51 |
+
connect_to=connect_to,
|
| 52 |
+
assets_archive_path=_packaged_assets_archive_path(),
|
| 53 |
+
)
|
player/runtime/python/Lib/site-packages/rerun_bindings/THIRD_PARTY_NOTICES.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
player/runtime/python/Lib/site-packages/rerun_bindings/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from .rerun_bindings import *
|
| 4 |
+
|
| 5 |
+
# Private classes don't automatically get re-exported
|
| 6 |
+
from .rerun_bindings import (
|
| 7 |
+
_dec_active_tracing_sessions as _dec_active_tracing_sessions,
|
| 8 |
+
_get_trace_context_var as _get_trace_context_var,
|
| 9 |
+
_get_tracing_session_var as _get_tracing_session_var,
|
| 10 |
+
_get_write_access_grant as _get_write_access_grant,
|
| 11 |
+
_inc_active_tracing_sessions as _inc_active_tracing_sessions,
|
| 12 |
+
_IndexValuesLikeInternal as _IndexValuesLikeInternal,
|
| 13 |
+
_is_telemetry_active as _is_telemetry_active,
|
| 14 |
+
_log_tracing_session_finished as _log_tracing_session_finished,
|
| 15 |
+
_log_tracing_session_started as _log_tracing_session_started,
|
| 16 |
+
_new_metrics_collector as _new_metrics_collector,
|
| 17 |
+
_optimization_profile_values as _optimization_profile_values,
|
| 18 |
+
_ServerInternal as _ServerInternal,
|
| 19 |
+
_UrdfJointInternal as _UrdfJointInternal,
|
| 20 |
+
_UrdfLinkInternal as _UrdfLinkInternal,
|
| 21 |
+
_UrdfMimicInternal as _UrdfMimicInternal,
|
| 22 |
+
_UrdfTreeInternal as _UrdfTreeInternal,
|
| 23 |
+
)
|
player/runtime/python/Lib/site-packages/rerun_bindings/py.typed
ADDED
|
File without changes
|
player/runtime/python/Lib/site-packages/rerun_bindings/rerun_bindings.pyd
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3189c5efdefa2d810f710e569ec40c242ec30ee01711904d85def66c3ba47d80
|
| 3 |
+
size 170249216
|
player/runtime/python/Lib/site-packages/rerun_bindings/rerun_bindings.pyi
ADDED
|
@@ -0,0 +1,2244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from collections.abc import Callable, Iterable, Iterator, Sequence
|
| 5 |
+
from datetime import datetime, timedelta
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
import datafusion as dfn
|
| 10 |
+
import numpy as np
|
| 11 |
+
import numpy.typing as npt
|
| 12 |
+
import pyarrow as pa
|
| 13 |
+
|
| 14 |
+
from .types import (
|
| 15 |
+
GopBatchingRuleDict as GopBatchingRuleDict,
|
| 16 |
+
IndexValuesLike as IndexValuesLike,
|
| 17 |
+
MergeSplitSettingsDict as MergeSplitSettingsDict,
|
| 18 |
+
OwnChunkRuleDict as OwnChunkRuleDict,
|
| 19 |
+
TemporalTimelineType as TemporalTimelineType,
|
| 20 |
+
TimelineType as TimelineType,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# NOTE
|
| 24 |
+
#
|
| 25 |
+
# The pure Python wrapper/internal pyo3 object is documented in `rerun_py/ARCHITECTURE.md`.
|
| 26 |
+
#
|
| 27 |
+
# Refrain from adding doc strings for APIs that is wrapped on the Python side as they are unchecked and just add duplication.
|
| 28 |
+
|
| 29 |
+
class IndexColumnDescriptor:
|
| 30 |
+
"""
|
| 31 |
+
The descriptor of an index column.
|
| 32 |
+
|
| 33 |
+
Index columns contain the index values for when the data was updated. They
|
| 34 |
+
generally correspond to Rerun timelines.
|
| 35 |
+
|
| 36 |
+
Column descriptors are used to describe the columns in a
|
| 37 |
+
[`Schema`][rerun.catalog.Schema]. They are read-only. To select an index
|
| 38 |
+
column, use [`IndexColumnSelector`][rerun.catalog.IndexColumnSelector].
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
@property
|
| 42 |
+
def name(self) -> str:
|
| 43 |
+
"""
|
| 44 |
+
The name of the index.
|
| 45 |
+
|
| 46 |
+
This property is read-only.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
@property
|
| 50 |
+
def is_static(self) -> bool:
|
| 51 |
+
"""Part of generic ColumnDescriptor interface: always False for Index."""
|
| 52 |
+
|
| 53 |
+
class IndexColumnSelector:
|
| 54 |
+
"""
|
| 55 |
+
A selector for an index column.
|
| 56 |
+
|
| 57 |
+
Index columns contain the index values for when the data was updated. They
|
| 58 |
+
generally correspond to Rerun timelines.
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
def __init__(self, index: str) -> None:
|
| 62 |
+
"""
|
| 63 |
+
Create a new `IndexColumnSelector`.
|
| 64 |
+
|
| 65 |
+
Parameters
|
| 66 |
+
----------
|
| 67 |
+
index:
|
| 68 |
+
The name of the index to select. Usually the name of a timeline.
|
| 69 |
+
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
@property
|
| 73 |
+
def name(self) -> str:
|
| 74 |
+
"""
|
| 75 |
+
The name of the index.
|
| 76 |
+
|
| 77 |
+
This property is read-only.
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
class ComponentColumnDescriptor:
|
| 81 |
+
"""
|
| 82 |
+
The descriptor of a component column.
|
| 83 |
+
|
| 84 |
+
Component columns contain the data for a specific component of an entity.
|
| 85 |
+
|
| 86 |
+
Column descriptors are used to describe the columns in a
|
| 87 |
+
[`Schema`][rerun.catalog.Schema]. They are read-only. To select a component
|
| 88 |
+
column, use [`ComponentColumnSelector`][rerun.catalog.ComponentColumnSelector].
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
@property
|
| 92 |
+
def entity_path(self) -> str:
|
| 93 |
+
"""
|
| 94 |
+
The entity path.
|
| 95 |
+
|
| 96 |
+
This property is read-only.
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
@property
|
| 100 |
+
def is_property(self) -> bool:
|
| 101 |
+
"""Is this column a property?""" # noqa: D400
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def component_type(self) -> str | None:
|
| 105 |
+
"""
|
| 106 |
+
The component type, if any.
|
| 107 |
+
|
| 108 |
+
This property is read-only.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
@property
|
| 112 |
+
def archetype(self) -> str | None:
|
| 113 |
+
"""
|
| 114 |
+
The archetype name, if any.
|
| 115 |
+
|
| 116 |
+
This property is read-only.
|
| 117 |
+
"""
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def component(self) -> str:
|
| 121 |
+
"""
|
| 122 |
+
The component.
|
| 123 |
+
|
| 124 |
+
This property is read-only.
|
| 125 |
+
"""
|
| 126 |
+
|
| 127 |
+
@property
|
| 128 |
+
def is_static(self) -> bool:
|
| 129 |
+
"""
|
| 130 |
+
Whether the column is static.
|
| 131 |
+
|
| 132 |
+
This property is read-only.
|
| 133 |
+
"""
|
| 134 |
+
|
| 135 |
+
@property
|
| 136 |
+
def name(self) -> str:
|
| 137 |
+
"""
|
| 138 |
+
The name of this column.
|
| 139 |
+
|
| 140 |
+
This property is read-only.
|
| 141 |
+
"""
|
| 142 |
+
|
| 143 |
+
class ComponentColumnSelector:
|
| 144 |
+
"""
|
| 145 |
+
A selector for a component column.
|
| 146 |
+
|
| 147 |
+
Component columns contain the data for a specific component of an entity.
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
def __init__(self, entity_path: str, component: str) -> None:
|
| 151 |
+
"""
|
| 152 |
+
Create a new `ComponentColumnSelector`.
|
| 153 |
+
|
| 154 |
+
Parameters
|
| 155 |
+
----------
|
| 156 |
+
entity_path:
|
| 157 |
+
The entity path to select.
|
| 158 |
+
component:
|
| 159 |
+
The component to select. Example: `Points3D:positions`.
|
| 160 |
+
|
| 161 |
+
"""
|
| 162 |
+
|
| 163 |
+
@property
|
| 164 |
+
def entity_path(self) -> str:
|
| 165 |
+
"""
|
| 166 |
+
The entity path.
|
| 167 |
+
|
| 168 |
+
This property is read-only.
|
| 169 |
+
"""
|
| 170 |
+
|
| 171 |
+
@property
|
| 172 |
+
def component(self) -> str:
|
| 173 |
+
"""
|
| 174 |
+
The component.
|
| 175 |
+
|
| 176 |
+
This property is read-only.
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
class SchemaInternal:
|
| 180 |
+
def index_columns(self) -> list[IndexColumnDescriptor]: ...
|
| 181 |
+
def component_columns(self) -> list[ComponentColumnDescriptor]: ...
|
| 182 |
+
def column_for(self, entity_path: str, component: str) -> ComponentColumnDescriptor | None: ...
|
| 183 |
+
def column_for_selector(
|
| 184 |
+
self, selector: str | ComponentColumnSelector | ComponentColumnDescriptor
|
| 185 |
+
) -> ComponentColumnDescriptor: ...
|
| 186 |
+
def __arrow_c_schema__(self) -> Any: ...
|
| 187 |
+
|
| 188 |
+
class ChunkInternal:
|
| 189 |
+
@property
|
| 190 |
+
def id(self) -> str: ...
|
| 191 |
+
@property
|
| 192 |
+
def entity_path(self) -> str: ...
|
| 193 |
+
@property
|
| 194 |
+
def num_rows(self) -> int: ...
|
| 195 |
+
@property
|
| 196 |
+
def num_columns(self) -> int: ...
|
| 197 |
+
@property
|
| 198 |
+
def is_static(self) -> bool: ...
|
| 199 |
+
@property
|
| 200 |
+
def is_empty(self) -> bool: ...
|
| 201 |
+
@property
|
| 202 |
+
def timeline_names(self) -> list[str]: ...
|
| 203 |
+
def to_record_batch(self) -> pa.RecordBatch: ...
|
| 204 |
+
def with_entity_path(self, entity_path: str) -> ChunkInternal: ...
|
| 205 |
+
@staticmethod
|
| 206 |
+
def from_record_batch(
|
| 207 |
+
record_batch: pa.RecordBatch,
|
| 208 |
+
index_mode: str,
|
| 209 |
+
index_columns: list[str],
|
| 210 |
+
entity_path: str | None,
|
| 211 |
+
) -> list[ChunkInternal]: ...
|
| 212 |
+
@staticmethod
|
| 213 |
+
def from_columns(
|
| 214 |
+
entity_path: str,
|
| 215 |
+
timelines: dict[str, Any],
|
| 216 |
+
components: dict[ComponentDescriptor, Any],
|
| 217 |
+
) -> ChunkInternal: ...
|
| 218 |
+
@staticmethod
|
| 219 |
+
def from_property(name: str, components: dict[ComponentDescriptor, Any]) -> ChunkInternal: ...
|
| 220 |
+
def format(self, *, width: int, redact: bool, trim_metadata_keys: bool) -> str: ...
|
| 221 |
+
def apply_lenses(self, lenses: list[LensInternal]) -> list[ChunkInternal]: ...
|
| 222 |
+
def apply_selector(self, source: str, selector: SelectorInternal) -> ChunkInternal: ...
|
| 223 |
+
def __repr__(self) -> str: ...
|
| 224 |
+
def __len__(self) -> int: ...
|
| 225 |
+
|
| 226 |
+
def format_bytes(num_bytes: float) -> str:
|
| 227 |
+
"""Format a byte count with binary units, e.g. `12.1 KiB`."""
|
| 228 |
+
|
| 229 |
+
def format_uint(number: int) -> str:
|
| 230 |
+
"""Format an unsigned integer with thousands separators."""
|
| 231 |
+
|
| 232 |
+
def format_index_value(timeline_type: str, value: int) -> str:
|
| 233 |
+
"""Format one index value of a timeline, as the viewer does, with timestamps in UTC and always dated."""
|
| 234 |
+
|
| 235 |
+
def _get_write_access_grant(
|
| 236 |
+
client: CatalogClientInternal, *, key: str
|
| 237 |
+
) -> tuple[str, str, str, str, list[tuple[str, bytes]]]:
|
| 238 |
+
"""Used for testing only."""
|
| 239 |
+
|
| 240 |
+
def _optimization_profile_values(name: str) -> dict[str, object]:
|
| 241 |
+
"""
|
| 242 |
+
Test-only: return a dict of the Rust `OptimizationProfile::<NAME>` field values.
|
| 243 |
+
|
| 244 |
+
Used by the Python parity test to confirm that
|
| 245 |
+
`OptimizationProfile.{LIVE,OBJECT_STORE}` on the Python side stays in sync
|
| 246 |
+
with the Rust constants this module forwards into `ChunkStoreConfig` /
|
| 247 |
+
`CompactionOptions` above.
|
| 248 |
+
|
| 249 |
+
Names: `"LIVE"`, `"OBJECT_STORE"`.
|
| 250 |
+
"""
|
| 251 |
+
|
| 252 |
+
# AI generated stubs for `PyRecordingStream` related class and functions
|
| 253 |
+
# TODO(#9187): this will be entirely replaced when `RecordingStream` is itself written in Rust
|
| 254 |
+
class PyRecordingStream:
|
| 255 |
+
def is_forked_child(self) -> bool:
|
| 256 |
+
"""
|
| 257 |
+
Determine if this stream is operating in the context of a forked child process.
|
| 258 |
+
|
| 259 |
+
This means the stream was created in the parent process. It now exists in the child
|
| 260 |
+
process by way of fork, but it is effectively a zombie since its batcher and sink
|
| 261 |
+
threads would not have been copied.
|
| 262 |
+
|
| 263 |
+
Calling operations such as flush or set_sink will result in an error.
|
| 264 |
+
"""
|
| 265 |
+
|
| 266 |
+
class ChunkBatcherConfig:
|
| 267 |
+
"""Defines the different batching thresholds used within the RecordingStream."""
|
| 268 |
+
|
| 269 |
+
def __init__(
|
| 270 |
+
self,
|
| 271 |
+
flush_tick: int | float | timedelta | None = None,
|
| 272 |
+
flush_num_bytes: int | None = None,
|
| 273 |
+
flush_num_rows: int | None = None,
|
| 274 |
+
chunk_max_rows_if_unsorted: int | None = None,
|
| 275 |
+
) -> None:
|
| 276 |
+
"""
|
| 277 |
+
Initialize the chunk batcher configuration.
|
| 278 |
+
|
| 279 |
+
Parameters
|
| 280 |
+
----------
|
| 281 |
+
flush_tick:
|
| 282 |
+
Duration of the periodic tick, by default `None`.
|
| 283 |
+
Equivalent to setting: `RERUN_FLUSH_TICK_SECS` environment variable.
|
| 284 |
+
|
| 285 |
+
flush_num_bytes:
|
| 286 |
+
Flush if the accumulated payload has a size in bytes equal or greater than this, by default `None`.
|
| 287 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_BYTES` environment variable.
|
| 288 |
+
|
| 289 |
+
flush_num_rows:
|
| 290 |
+
Flush if the accumulated payload has a number of rows equal or greater than this, by default `None`.
|
| 291 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_ROWS` environment variable.
|
| 292 |
+
|
| 293 |
+
chunk_max_rows_if_unsorted:
|
| 294 |
+
Split a chunk if it contains >= rows than this threshold and one or more of its timelines are unsorted,
|
| 295 |
+
by default `None`.
|
| 296 |
+
Equivalent to setting: `RERUN_CHUNK_MAX_ROWS_IF_UNSORTED` environment variable.
|
| 297 |
+
|
| 298 |
+
"""
|
| 299 |
+
|
| 300 |
+
@property
|
| 301 |
+
def flush_tick(self) -> timedelta:
|
| 302 |
+
"""
|
| 303 |
+
Duration of the periodic tick.
|
| 304 |
+
|
| 305 |
+
Equivalent to setting: `RERUN_FLUSH_TICK_SECS` environment variable.
|
| 306 |
+
"""
|
| 307 |
+
|
| 308 |
+
@flush_tick.setter
|
| 309 |
+
def flush_tick(self, value: float | int | timedelta) -> None:
|
| 310 |
+
"""
|
| 311 |
+
Duration of the periodic tick.
|
| 312 |
+
|
| 313 |
+
Equivalent to setting: `RERUN_FLUSH_TICK_SECS` environment variable.
|
| 314 |
+
"""
|
| 315 |
+
|
| 316 |
+
@property
|
| 317 |
+
def flush_num_bytes(self) -> int:
|
| 318 |
+
"""
|
| 319 |
+
Flush if the accumulated payload has a size in bytes equal or greater than this.
|
| 320 |
+
|
| 321 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_BYTES` environment variable.
|
| 322 |
+
"""
|
| 323 |
+
|
| 324 |
+
@flush_num_bytes.setter
|
| 325 |
+
def flush_num_bytes(self, value: int) -> None:
|
| 326 |
+
"""
|
| 327 |
+
Flush if the accumulated payload has a size in bytes equal or greater than this.
|
| 328 |
+
|
| 329 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_BYTES` environment variable.
|
| 330 |
+
"""
|
| 331 |
+
|
| 332 |
+
@property
|
| 333 |
+
def flush_num_rows(self) -> int:
|
| 334 |
+
"""
|
| 335 |
+
Flush if the accumulated payload has a number of rows equal or greater than this.
|
| 336 |
+
|
| 337 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_ROWS` environment variable.
|
| 338 |
+
"""
|
| 339 |
+
|
| 340 |
+
@flush_num_rows.setter
|
| 341 |
+
def flush_num_rows(self, value: int) -> None:
|
| 342 |
+
"""
|
| 343 |
+
Flush if the accumulated payload has a number of rows equal or greater than this.
|
| 344 |
+
|
| 345 |
+
Equivalent to setting: `RERUN_FLUSH_NUM_ROWS` environment variable.
|
| 346 |
+
"""
|
| 347 |
+
|
| 348 |
+
@property
|
| 349 |
+
def chunk_max_rows_if_unsorted(self) -> int:
|
| 350 |
+
"""
|
| 351 |
+
Split a chunk if it contains >= rows than this threshold and one or more of its timelines are unsorted.
|
| 352 |
+
|
| 353 |
+
Equivalent to setting: `RERUN_CHUNK_MAX_ROWS_IF_UNSORTED` environment variable.
|
| 354 |
+
"""
|
| 355 |
+
|
| 356 |
+
@chunk_max_rows_if_unsorted.setter
|
| 357 |
+
def chunk_max_rows_if_unsorted(self, value: int) -> None:
|
| 358 |
+
"""
|
| 359 |
+
Split a chunk if it contains >= rows than this threshold and one or more of its timelines are unsorted.
|
| 360 |
+
|
| 361 |
+
Equivalent to setting: `RERUN_CHUNK_MAX_ROWS_IF_UNSORTED` environment variable.
|
| 362 |
+
"""
|
| 363 |
+
|
| 364 |
+
@staticmethod
|
| 365 |
+
def DEFAULT() -> ChunkBatcherConfig:
|
| 366 |
+
"""Default configuration, applicable to most use cases."""
|
| 367 |
+
|
| 368 |
+
@staticmethod
|
| 369 |
+
def LOW_LATENCY() -> ChunkBatcherConfig:
|
| 370 |
+
"""Low-latency configuration, preferred when streaming directly to a viewer."""
|
| 371 |
+
|
| 372 |
+
@staticmethod
|
| 373 |
+
def ALWAYS_TEST_ONLY() -> ChunkBatcherConfig:
|
| 374 |
+
"""
|
| 375 |
+
Always flushes ASAP.
|
| 376 |
+
|
| 377 |
+
!!! warning
|
| 378 |
+
Test-only configuration. Produces an unrealistically large number of chunks and is
|
| 379 |
+
not suitable for production workloads. With a file sink in particular, per-chunk
|
| 380 |
+
metadata is accumulated in memory until the SDK process ends and the file footer
|
| 381 |
+
can be written, which can drive memory usage through the roof. Use
|
| 382 |
+
[`LOW_LATENCY`][rerun_bindings.ChunkBatcherConfig.LOW_LATENCY] instead for fast
|
| 383 |
+
flushing in real applications.
|
| 384 |
+
"""
|
| 385 |
+
|
| 386 |
+
@staticmethod
|
| 387 |
+
def NEVER() -> ChunkBatcherConfig:
|
| 388 |
+
"""Never flushes unless manually told to (or hitting one the builtin invariants)."""
|
| 389 |
+
|
| 390 |
+
class PyMemorySinkStorage:
|
| 391 |
+
def concat_as_bytes(self, concat: PyMemorySinkStorage | None = None) -> bytes:
|
| 392 |
+
"""
|
| 393 |
+
Concatenate the contents of the [`MemorySinkStorage`] as bytes.
|
| 394 |
+
|
| 395 |
+
Note: This will do a blocking flush before returning!
|
| 396 |
+
"""
|
| 397 |
+
|
| 398 |
+
def num_msgs(self) -> int:
|
| 399 |
+
"""
|
| 400 |
+
Count the number of pending messages in the [`MemorySinkStorage`].
|
| 401 |
+
|
| 402 |
+
This will do a blocking flush before returning!
|
| 403 |
+
"""
|
| 404 |
+
|
| 405 |
+
def drain_as_bytes(self) -> bytes:
|
| 406 |
+
"""
|
| 407 |
+
Drain all messages logged to the [`MemorySinkStorage`] and return as bytes.
|
| 408 |
+
|
| 409 |
+
This will do a blocking flush before returning!
|
| 410 |
+
"""
|
| 411 |
+
|
| 412 |
+
class PyBinarySinkStorage:
|
| 413 |
+
def read(self, *, flush: bool = True, flush_timeout_sec: float = 1e38) -> bytes | None:
|
| 414 |
+
"""
|
| 415 |
+
Read the bytes from the binary sink.
|
| 416 |
+
|
| 417 |
+
If `flush` is `True`, the sink will be flushed before reading.
|
| 418 |
+
If all the data was not successfully flushed within the given timeout,
|
| 419 |
+
an exception will be raised.
|
| 420 |
+
|
| 421 |
+
Parameters
|
| 422 |
+
----------
|
| 423 |
+
flush:
|
| 424 |
+
If true (default), the stream will be flushed before reading.
|
| 425 |
+
flush_timeout_sec:
|
| 426 |
+
If `flush` is `True`, wait at most this many seconds.
|
| 427 |
+
If the timeout is reached, an error is raised.
|
| 428 |
+
|
| 429 |
+
"""
|
| 430 |
+
|
| 431 |
+
def flush(self, *, timeout_sec: float = 1e38) -> None:
|
| 432 |
+
"""
|
| 433 |
+
Flushes the binary sink and ensures that all logged messages have been encoded into the stream.
|
| 434 |
+
|
| 435 |
+
This will block until the flush is complete, or the timeout is reached, or an error occurs.
|
| 436 |
+
|
| 437 |
+
If all the data was not successfully flushed within the given timeout,
|
| 438 |
+
an exception will be raised.
|
| 439 |
+
|
| 440 |
+
Parameters
|
| 441 |
+
----------
|
| 442 |
+
timeout_sec:
|
| 443 |
+
Wait at most this many seconds.
|
| 444 |
+
If the timeout is reached, an error is raised.
|
| 445 |
+
|
| 446 |
+
"""
|
| 447 |
+
|
| 448 |
+
#
|
| 449 |
+
# init
|
| 450 |
+
#
|
| 451 |
+
|
| 452 |
+
def flush_and_cleanup_orphaned_recordings() -> None:
|
| 453 |
+
"""Flush and then cleanup any orphaned recordings."""
|
| 454 |
+
|
| 455 |
+
def new_recording(
|
| 456 |
+
application_id: str,
|
| 457 |
+
recording_id: str | None = None,
|
| 458 |
+
make_default: bool = True,
|
| 459 |
+
make_thread_default: bool = True,
|
| 460 |
+
default_enabled: bool = True,
|
| 461 |
+
send_properties: bool = True,
|
| 462 |
+
batcher_config: ChunkBatcherConfig | None = None,
|
| 463 |
+
) -> PyRecordingStream:
|
| 464 |
+
"""Create a new recording stream."""
|
| 465 |
+
|
| 466 |
+
def new_blueprint(
|
| 467 |
+
application_id: str,
|
| 468 |
+
make_default: bool = True,
|
| 469 |
+
make_thread_default: bool = True,
|
| 470 |
+
default_enabled: bool = True,
|
| 471 |
+
) -> PyRecordingStream:
|
| 472 |
+
"""Create a new blueprint stream."""
|
| 473 |
+
|
| 474 |
+
def shutdown() -> None:
|
| 475 |
+
"""Shutdown the Rerun SDK."""
|
| 476 |
+
|
| 477 |
+
def cleanup_if_forked_child() -> None:
|
| 478 |
+
"""Cleans up internal state if this is the child of a forked process."""
|
| 479 |
+
|
| 480 |
+
def spawn(
|
| 481 |
+
port: int = 9876,
|
| 482 |
+
memory_limit: str = ...,
|
| 483 |
+
server_memory_limit: str = ...,
|
| 484 |
+
hide_welcome_screen: bool = False,
|
| 485 |
+
detach_process: bool = True,
|
| 486 |
+
executable_name: str = ...,
|
| 487 |
+
executable_path: str | None = None,
|
| 488 |
+
extra_args: list[str] = ...,
|
| 489 |
+
extra_env: list[tuple[str, str]] = ...,
|
| 490 |
+
headless: bool = False,
|
| 491 |
+
) -> int | None:
|
| 492 |
+
"""Spawn a new viewer."""
|
| 493 |
+
|
| 494 |
+
#
|
| 495 |
+
# recordings
|
| 496 |
+
#
|
| 497 |
+
|
| 498 |
+
def get_application_id(recording: PyRecordingStream | None = None) -> str | None:
|
| 499 |
+
"""Get the current recording stream's application ID."""
|
| 500 |
+
|
| 501 |
+
def get_recording_id(recording: PyRecordingStream | None = None) -> str | None:
|
| 502 |
+
"""Get the current recording stream's recording ID."""
|
| 503 |
+
|
| 504 |
+
def get_data_recording(recording: PyRecordingStream | None = None) -> PyRecordingStream | None:
|
| 505 |
+
"""Returns the currently active data recording in the global scope, if any; fallbacks to the specified recording otherwise, if any."""
|
| 506 |
+
|
| 507 |
+
def get_global_data_recording() -> PyRecordingStream | None:
|
| 508 |
+
"""Returns the currently active data recording in the global scope, if any."""
|
| 509 |
+
|
| 510 |
+
def set_global_data_recording(recording: PyRecordingStream | None = None) -> PyRecordingStream | None:
|
| 511 |
+
"""
|
| 512 |
+
Replaces the currently active recording in the global scope with the specified one.
|
| 513 |
+
|
| 514 |
+
Returns the previous one, if any.
|
| 515 |
+
"""
|
| 516 |
+
|
| 517 |
+
def get_thread_local_data_recording() -> PyRecordingStream | None:
|
| 518 |
+
"""Returns the currently active data recording in the thread-local scope, if any."""
|
| 519 |
+
|
| 520 |
+
def set_thread_local_data_recording(recording: PyRecordingStream | None = None) -> PyRecordingStream | None:
|
| 521 |
+
"""
|
| 522 |
+
Replaces the currently active recording in the thread-local scope with the specified one.
|
| 523 |
+
|
| 524 |
+
Returns the previous one, if any.
|
| 525 |
+
"""
|
| 526 |
+
|
| 527 |
+
def get_blueprint_recording(overrides: PyRecordingStream | None = None) -> PyRecordingStream | None:
|
| 528 |
+
"""Returns the currently active blueprint recording in the global scope, if any; fallbacks to the specified recording otherwise, if any."""
|
| 529 |
+
|
| 530 |
+
def get_global_blueprint_recording() -> PyRecordingStream | None:
|
| 531 |
+
"""Returns the currently active blueprint recording in the global scope, if any."""
|
| 532 |
+
|
| 533 |
+
def set_global_blueprint_recording(recording: PyRecordingStream | None = None) -> PyRecordingStream | None:
|
| 534 |
+
"""
|
| 535 |
+
Replaces the currently active recording in the global scope with the specified one.
|
| 536 |
+
|
| 537 |
+
Returns the previous one, if any.
|
| 538 |
+
"""
|
| 539 |
+
|
| 540 |
+
def get_thread_local_blueprint_recording() -> PyRecordingStream | None:
|
| 541 |
+
"""Returns the currently active blueprint recording in the thread-local scope, if any."""
|
| 542 |
+
|
| 543 |
+
def set_thread_local_blueprint_recording(
|
| 544 |
+
recording: PyRecordingStream | None = None,
|
| 545 |
+
) -> PyRecordingStream | None:
|
| 546 |
+
"""
|
| 547 |
+
Replaces the currently active recording in the thread-local scope with the specified one.
|
| 548 |
+
|
| 549 |
+
Returns the previous one, if any.
|
| 550 |
+
|
| 551 |
+
"""
|
| 552 |
+
|
| 553 |
+
def check_for_rrd_footer(file_path: str | os.PathLike[str]) -> bool:
|
| 554 |
+
"""
|
| 555 |
+
Check if the RRD has a valid RRD footer.
|
| 556 |
+
|
| 557 |
+
This is useful for unit-tests to verify that data has been fully flushed to disk.
|
| 558 |
+
"""
|
| 559 |
+
|
| 560 |
+
def disconnect_orphaned_recordings() -> None:
|
| 561 |
+
"""
|
| 562 |
+
Disconnect any orphaned recordings.
|
| 563 |
+
|
| 564 |
+
This can be used to make sure that recordings get closed/finalized
|
| 565 |
+
properly when all references have been dropped.
|
| 566 |
+
"""
|
| 567 |
+
|
| 568 |
+
#
|
| 569 |
+
# component descriptor
|
| 570 |
+
#
|
| 571 |
+
|
| 572 |
+
class ComponentDescriptor:
|
| 573 |
+
"""
|
| 574 |
+
A `ComponentDescriptor` fully describes the semantics of a column of data.
|
| 575 |
+
|
| 576 |
+
Every component at a given entity path is uniquely identified by the
|
| 577 |
+
`component` field of the descriptor. The `archetype` and `component_type`
|
| 578 |
+
fields provide additional information about the semantics of the data.
|
| 579 |
+
"""
|
| 580 |
+
|
| 581 |
+
def __init__(self, component: str, archetype: str | None = None, component_type: str | None = None) -> None:
|
| 582 |
+
"""Creates a component descriptor."""
|
| 583 |
+
|
| 584 |
+
@property
|
| 585 |
+
def archetype(self) -> str | None:
|
| 586 |
+
"""
|
| 587 |
+
Optional name of the `Archetype` associated with this data.
|
| 588 |
+
|
| 589 |
+
`None` if the data wasn't logged through an archetype.
|
| 590 |
+
|
| 591 |
+
Example: `rerun.archetypes.Points3D`.
|
| 592 |
+
"""
|
| 593 |
+
|
| 594 |
+
@property
|
| 595 |
+
def component(self) -> str:
|
| 596 |
+
"""
|
| 597 |
+
Uniquely identifies of the component associated with this data.
|
| 598 |
+
|
| 599 |
+
Example: `Points3D:positions`.
|
| 600 |
+
"""
|
| 601 |
+
|
| 602 |
+
@property
|
| 603 |
+
def component_type(self) -> str | None:
|
| 604 |
+
"""
|
| 605 |
+
Optional type information for this component.
|
| 606 |
+
|
| 607 |
+
Can be used to inform applications on how to interpret the data.
|
| 608 |
+
|
| 609 |
+
Example: `rerun.components.Position3D`.
|
| 610 |
+
"""
|
| 611 |
+
|
| 612 |
+
def with_overrides(self, archetype: str | None = None, component_type: str | None = None) -> ComponentDescriptor:
|
| 613 |
+
"""Unconditionally sets `archetype` and `component_type` to the given ones (if specified)."""
|
| 614 |
+
|
| 615 |
+
def or_with_overrides(self, archetype: str | None = None, component_type: str | None = None) -> ComponentDescriptor:
|
| 616 |
+
"""Sets `archetype` and `component_type` to the given one iff it's not already set."""
|
| 617 |
+
|
| 618 |
+
def with_builtin_archetype(self, archetype: str) -> ComponentDescriptor:
|
| 619 |
+
"""Sets `archetype` in a format similar to built-in archetypes."""
|
| 620 |
+
|
| 621 |
+
#
|
| 622 |
+
# sinks
|
| 623 |
+
#
|
| 624 |
+
|
| 625 |
+
def is_enabled(recording: PyRecordingStream | None = None) -> bool:
|
| 626 |
+
"""Whether the recording stream enabled."""
|
| 627 |
+
|
| 628 |
+
def binary_stream(recording: PyRecordingStream | None = None) -> PyBinarySinkStorage | None:
|
| 629 |
+
"""Create a new binary stream sink, and return the associated binary stream."""
|
| 630 |
+
|
| 631 |
+
class GrpcSink:
|
| 632 |
+
"""
|
| 633 |
+
Connect to an existing Rerun gRPC server and stream the recording to it.
|
| 634 |
+
|
| 635 |
+
This is a gRPC client: it connects to a server but does not host one.
|
| 636 |
+
Use [`rerun.GrpcServerSink`][] to host a server that SDKs and Viewers can connect to.
|
| 637 |
+
|
| 638 |
+
Used in [`rerun.RecordingStream.set_sinks`][].
|
| 639 |
+
"""
|
| 640 |
+
|
| 641 |
+
def __init__(self, url: str | None = None) -> None:
|
| 642 |
+
"""
|
| 643 |
+
Initialize a gRPC sink.
|
| 644 |
+
|
| 645 |
+
Parameters
|
| 646 |
+
----------
|
| 647 |
+
url:
|
| 648 |
+
The URL to connect to
|
| 649 |
+
|
| 650 |
+
The scheme must be one of `rerun://`, `rerun+http://`, or `rerun+https://`,
|
| 651 |
+
and the pathname must be `/proxy`.
|
| 652 |
+
|
| 653 |
+
The default is `rerun+http://127.0.0.1:9876/proxy`.
|
| 654 |
+
|
| 655 |
+
"""
|
| 656 |
+
|
| 657 |
+
class GrpcServerSink:
|
| 658 |
+
"""
|
| 659 |
+
Host a Rerun gRPC server and stream the recording to connected clients.
|
| 660 |
+
|
| 661 |
+
This is a gRPC server: SDKs and Viewers connect to it.
|
| 662 |
+
Use [`rerun.GrpcSink`][] to connect as a client to an existing server.
|
| 663 |
+
Replacing the recording's sinks or dropping the recording shuts down the server.
|
| 664 |
+
|
| 665 |
+
Used in [`rerun.RecordingStream.set_sinks`][].
|
| 666 |
+
"""
|
| 667 |
+
|
| 668 |
+
def __init__(
|
| 669 |
+
self,
|
| 670 |
+
# Binding all interfaces is the intended default; see `rerun.server.Server`.
|
| 671 |
+
bind_ip: str = "0.0.0.0", # noqa: S104
|
| 672 |
+
port: int = 9876,
|
| 673 |
+
*,
|
| 674 |
+
server_memory_limit: str = "1GiB",
|
| 675 |
+
newest_first: bool = False,
|
| 676 |
+
cors_allow_origin: list[str] | None = None,
|
| 677 |
+
) -> None:
|
| 678 |
+
"""Create a hosted gRPC server sink."""
|
| 679 |
+
|
| 680 |
+
@property
|
| 681 |
+
def uri(self) -> str:
|
| 682 |
+
"""URI that a Rerun Viewer can use to connect to this server."""
|
| 683 |
+
|
| 684 |
+
class FileSink:
|
| 685 |
+
"""
|
| 686 |
+
Used in [`rerun.RecordingStream.set_sinks`][].
|
| 687 |
+
|
| 688 |
+
Save the recording stream to a file.
|
| 689 |
+
"""
|
| 690 |
+
|
| 691 |
+
def __init__(self, path: str | os.PathLike[str], *, write_footer: bool = True) -> None:
|
| 692 |
+
"""
|
| 693 |
+
Initialize a file sink.
|
| 694 |
+
|
| 695 |
+
Parameters
|
| 696 |
+
----------
|
| 697 |
+
path:
|
| 698 |
+
Path to write to. The file will be overwritten.
|
| 699 |
+
write_footer:
|
| 700 |
+
Whether to emit a complete RRD footer (including a manifest of every chunk) at the
|
| 701 |
+
end of the stream. Defaults to `True`.
|
| 702 |
+
|
| 703 |
+
Producing a footer keeps per-chunk metadata in memory for the lifetime of the sink,
|
| 704 |
+
which grows linearly with the number of chunks logged. Pass `write_footer=False` for
|
| 705 |
+
long-running streaming sessions; the resulting file is still a valid RRD and a
|
| 706 |
+
footer can be added after the fact via `rerun rrd optimize`.
|
| 707 |
+
|
| 708 |
+
*Warning*: lack of footer will significantly hurt random-access performance and some
|
| 709 |
+
tools (e.g. LazyStore) may not work properly.
|
| 710 |
+
|
| 711 |
+
"""
|
| 712 |
+
|
| 713 |
+
def set_sinks(
|
| 714 |
+
sinks: list[Any],
|
| 715 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 716 |
+
recording: PyRecordingStream | None = None,
|
| 717 |
+
) -> None:
|
| 718 |
+
"""Stream data to multiple sinks."""
|
| 719 |
+
|
| 720 |
+
def connect_grpc(
|
| 721 |
+
url: str | None,
|
| 722 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 723 |
+
recording: PyRecordingStream | None = None,
|
| 724 |
+
) -> None:
|
| 725 |
+
"""Connect the recording stream to a remote Rerun Viewer on the given URL."""
|
| 726 |
+
|
| 727 |
+
def connect_grpc_blueprint(
|
| 728 |
+
url: str | None,
|
| 729 |
+
make_active: bool,
|
| 730 |
+
make_default: bool,
|
| 731 |
+
blueprint_stream: PyRecordingStream,
|
| 732 |
+
) -> None:
|
| 733 |
+
"""Special binding for directly sending a blueprint stream to a connection."""
|
| 734 |
+
|
| 735 |
+
def save(
|
| 736 |
+
path: str,
|
| 737 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 738 |
+
recording: PyRecordingStream | None = None,
|
| 739 |
+
*,
|
| 740 |
+
write_footer: bool = True,
|
| 741 |
+
) -> None:
|
| 742 |
+
"""Save the recording stream to a file."""
|
| 743 |
+
|
| 744 |
+
def save_blueprint(path: str, blueprint_stream: PyRecordingStream) -> None:
|
| 745 |
+
"""Special binding for directly savings a blueprint stream to a file."""
|
| 746 |
+
|
| 747 |
+
def stdout(
|
| 748 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 749 |
+
recording: PyRecordingStream | None = None,
|
| 750 |
+
*,
|
| 751 |
+
write_footer: bool = True,
|
| 752 |
+
) -> None:
|
| 753 |
+
"""Save to stdout."""
|
| 754 |
+
|
| 755 |
+
def memory_recording(recording: PyRecordingStream | None = None) -> PyMemorySinkStorage | None:
|
| 756 |
+
"""Create an in-memory rrd file."""
|
| 757 |
+
|
| 758 |
+
def set_callback_sink(
|
| 759 |
+
callback: Callable[[bytes], Any],
|
| 760 |
+
recording: PyRecordingStream | None = None,
|
| 761 |
+
) -> None:
|
| 762 |
+
"""Set callback sink."""
|
| 763 |
+
|
| 764 |
+
def set_callback_sink_blueprint(
|
| 765 |
+
callback: Callable[[bytes], Any],
|
| 766 |
+
make_active: bool,
|
| 767 |
+
make_default: bool,
|
| 768 |
+
blueprint_stream: PyRecordingStream | None,
|
| 769 |
+
) -> None:
|
| 770 |
+
"""Set callback sink for blueprint."""
|
| 771 |
+
|
| 772 |
+
def serve_grpc(
|
| 773 |
+
grpc_port: int | None,
|
| 774 |
+
server_memory_limit: str,
|
| 775 |
+
newest_first: bool = False,
|
| 776 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 777 |
+
recording: PyRecordingStream | None = None,
|
| 778 |
+
cors_allow_origin: list[str] = ..., # type: ignore[assignment]
|
| 779 |
+
) -> str:
|
| 780 |
+
"""
|
| 781 |
+
Spawn a gRPC server which an SDK or Viewer can connect to.
|
| 782 |
+
|
| 783 |
+
Returns the URI of the server so you can connect the viewer to it.
|
| 784 |
+
"""
|
| 785 |
+
|
| 786 |
+
def serve_web_viewer(
|
| 787 |
+
web_port: int | None = None,
|
| 788 |
+
open_browser: bool = True,
|
| 789 |
+
connect_to: str | None = None,
|
| 790 |
+
assets_archive_path: str | None = None,
|
| 791 |
+
) -> None:
|
| 792 |
+
"""
|
| 793 |
+
Serve a web-viewer over HTTP.
|
| 794 |
+
|
| 795 |
+
This only serves HTML+JS+Wasm, but does NOT host a gRPC server.
|
| 796 |
+
"""
|
| 797 |
+
|
| 798 |
+
def serve_web(
|
| 799 |
+
open_browser: bool,
|
| 800 |
+
web_port: int | None,
|
| 801 |
+
grpc_port: int | None,
|
| 802 |
+
server_memory_limit: str,
|
| 803 |
+
default_blueprint: PyMemorySinkStorage | None = None,
|
| 804 |
+
recording: PyRecordingStream | None = None,
|
| 805 |
+
cors_allow_origin: list[str] = ..., # type: ignore[assignment]
|
| 806 |
+
assets_archive_path: str | None = None,
|
| 807 |
+
) -> None:
|
| 808 |
+
"""Serve a web-viewer AND host a gRPC server."""
|
| 809 |
+
|
| 810 |
+
def disconnect(recording: PyRecordingStream | None = None) -> None:
|
| 811 |
+
"""
|
| 812 |
+
Disconnect from remote server (if any).
|
| 813 |
+
|
| 814 |
+
Subsequent log messages will be buffered and either sent on the next call to `connect_grpc` or `spawn`.
|
| 815 |
+
"""
|
| 816 |
+
|
| 817 |
+
def finalize_deferred_sinks(recording: PyRecordingStream | None = None) -> None:
|
| 818 |
+
"""
|
| 819 |
+
Finalize any deferred-finalization sinks (i.e. file-like sinks that write a footer at the end).
|
| 820 |
+
|
| 821 |
+
For a bare `FileSink` this is equivalent to `disconnect()`. For a `MultiSink` containing both
|
| 822 |
+
streaming and file-like children, only the file-like children are dropped — the streaming
|
| 823 |
+
children stay live. For all other sinks this is a no-op.
|
| 824 |
+
|
| 825 |
+
Used by `RecordingStream.__exit__` so that file-backed recordings are consumable as soon as
|
| 826 |
+
the `with`-block exits, without waiting for `__del__` / GC.
|
| 827 |
+
"""
|
| 828 |
+
|
| 829 |
+
def flush(*, timeout_sec: float = 1e38, recording: PyRecordingStream | None = None) -> None:
|
| 830 |
+
"""Block until outstanding data has been flushed to the sink."""
|
| 831 |
+
|
| 832 |
+
#
|
| 833 |
+
# time
|
| 834 |
+
#
|
| 835 |
+
|
| 836 |
+
def set_time_sequence(
|
| 837 |
+
timeline: str,
|
| 838 |
+
sequence: int,
|
| 839 |
+
recording: PyRecordingStream | None = None,
|
| 840 |
+
) -> None:
|
| 841 |
+
"""Set the current time for this thread as an integer sequence."""
|
| 842 |
+
|
| 843 |
+
def set_time_duration_nanos(
|
| 844 |
+
timeline: str,
|
| 845 |
+
nanos: int,
|
| 846 |
+
recording: PyRecordingStream | None = None,
|
| 847 |
+
) -> None:
|
| 848 |
+
"""Set the current duration for this thread in nanoseconds."""
|
| 849 |
+
|
| 850 |
+
def set_time_timestamp_nanos_since_epoch(
|
| 851 |
+
timeline: str,
|
| 852 |
+
nanos: int,
|
| 853 |
+
recording: PyRecordingStream | None = None,
|
| 854 |
+
) -> None:
|
| 855 |
+
"""Set the current time for this thread in nanoseconds."""
|
| 856 |
+
|
| 857 |
+
def send_recording_name(
|
| 858 |
+
name: str,
|
| 859 |
+
recording: PyRecordingStream | None = None,
|
| 860 |
+
) -> None:
|
| 861 |
+
"""Send the name of the recording."""
|
| 862 |
+
|
| 863 |
+
def send_recording_start_time_nanos(
|
| 864 |
+
nanos: int,
|
| 865 |
+
recording: PyRecordingStream | None = None,
|
| 866 |
+
) -> None:
|
| 867 |
+
"""Send the start time of the recording."""
|
| 868 |
+
|
| 869 |
+
def disable_timeline(
|
| 870 |
+
timeline: str,
|
| 871 |
+
recording: PyRecordingStream | None = None,
|
| 872 |
+
) -> None:
|
| 873 |
+
"""Clear time information for the specified timeline on this thread."""
|
| 874 |
+
|
| 875 |
+
def reset_time(recording: PyRecordingStream | None = None) -> None:
|
| 876 |
+
"""Clear all timeline information on this thread."""
|
| 877 |
+
|
| 878 |
+
def set_log_tick_enabled(enabled: bool, recording: PyRecordingStream | None = None) -> None:
|
| 879 |
+
"""Enable or disable automatic injection of the `log_tick` timeline (disabled by default)."""
|
| 880 |
+
|
| 881 |
+
def set_log_time_enabled(enabled: bool, recording: PyRecordingStream | None = None) -> None:
|
| 882 |
+
"""Enable or disable automatic injection of the `log_time` timeline (enabled by default)."""
|
| 883 |
+
|
| 884 |
+
#
|
| 885 |
+
# log any
|
| 886 |
+
#
|
| 887 |
+
|
| 888 |
+
def log_arrow_msg(
|
| 889 |
+
entity_path: str,
|
| 890 |
+
components: dict[Any, Any],
|
| 891 |
+
static_: bool,
|
| 892 |
+
recording: PyRecordingStream | None = None,
|
| 893 |
+
) -> None:
|
| 894 |
+
"""Log an arrow message."""
|
| 895 |
+
|
| 896 |
+
def send_arrow_chunk(
|
| 897 |
+
entity_path: str,
|
| 898 |
+
timelines: dict[Any, Any],
|
| 899 |
+
components: dict[Any, Any],
|
| 900 |
+
recording: PyRecordingStream | None = None,
|
| 901 |
+
) -> None:
|
| 902 |
+
"""
|
| 903 |
+
Directly send an arrow chunk to the recording stream.
|
| 904 |
+
|
| 905 |
+
Params
|
| 906 |
+
------
|
| 907 |
+
entity_path: `str`
|
| 908 |
+
The entity path to log the chunk to.
|
| 909 |
+
timelines: `Dict[str, arrow::Int64Array]`
|
| 910 |
+
A dictionary mapping timeline names to their values.
|
| 911 |
+
components: `Dict[ComponentDescriptor, arrow::ListArray]`
|
| 912 |
+
A dictionary mapping component types to their values.
|
| 913 |
+
"""
|
| 914 |
+
|
| 915 |
+
def send_chunks(
|
| 916 |
+
chunks: ChunkInternal | Iterable[ChunkInternal],
|
| 917 |
+
recording: PyRecordingStream | None = None,
|
| 918 |
+
) -> None:
|
| 919 |
+
"""
|
| 920 |
+
Send chunks to the recording stream.
|
| 921 |
+
|
| 922 |
+
Accepts a single chunk or any iterable of chunks. Blocks until every chunk
|
| 923 |
+
has been pushed to the recording's batcher.
|
| 924 |
+
"""
|
| 925 |
+
|
| 926 |
+
def log_file_from_path(
|
| 927 |
+
file_path: str | os.PathLike[str],
|
| 928 |
+
entity_path_prefix: str | None = None,
|
| 929 |
+
static_: bool = False,
|
| 930 |
+
recording: PyRecordingStream | None = None,
|
| 931 |
+
) -> None:
|
| 932 |
+
"""Log a file by path."""
|
| 933 |
+
|
| 934 |
+
def log_file_from_contents(
|
| 935 |
+
file_path: str | os.PathLike[str],
|
| 936 |
+
file_contents: bytes,
|
| 937 |
+
entity_path_prefix: str | None = None,
|
| 938 |
+
static_: bool = False,
|
| 939 |
+
recording: PyRecordingStream | None = None,
|
| 940 |
+
) -> None:
|
| 941 |
+
"""Log a file by contents."""
|
| 942 |
+
|
| 943 |
+
def send_blueprint(
|
| 944 |
+
blueprint: PyMemorySinkStorage,
|
| 945 |
+
make_active: bool = False,
|
| 946 |
+
make_default: bool = True,
|
| 947 |
+
recording: PyRecordingStream | None = None,
|
| 948 |
+
) -> None:
|
| 949 |
+
"""Send a blueprint to the given recording stream."""
|
| 950 |
+
|
| 951 |
+
#
|
| 952 |
+
# misc
|
| 953 |
+
#
|
| 954 |
+
|
| 955 |
+
def version() -> str:
|
| 956 |
+
"""Return a verbose version string."""
|
| 957 |
+
|
| 958 |
+
def is_dev_build() -> bool:
|
| 959 |
+
"""Return True if the Rerun SDK is a dev/debug build."""
|
| 960 |
+
|
| 961 |
+
def get_app_url() -> str:
|
| 962 |
+
"""
|
| 963 |
+
Get an url to an instance of the web-viewer.
|
| 964 |
+
|
| 965 |
+
This may point to app.rerun.io or localhost depending on
|
| 966 |
+
whether [`start_web_viewer_server()`] was called.
|
| 967 |
+
"""
|
| 968 |
+
|
| 969 |
+
def start_web_viewer_server(port: int, assets_archive_path: str | None = None) -> None:
|
| 970 |
+
"""Start a web server to host the run web-assets."""
|
| 971 |
+
|
| 972 |
+
def escape_entity_path_part(part: str) -> str:
|
| 973 |
+
"""Escape an entity path."""
|
| 974 |
+
|
| 975 |
+
def new_entity_path(parts: list[str]) -> str:
|
| 976 |
+
"""Create an entity path."""
|
| 977 |
+
|
| 978 |
+
def new_property_entity_path(parts: list[str]) -> str:
|
| 979 |
+
"""Create a property entity path."""
|
| 980 |
+
|
| 981 |
+
def asset_video_read_frame_timestamps_nanos(video_bytes_arrow_array: Any, media_type: str | None = None) -> list[int]:
|
| 982 |
+
"""
|
| 983 |
+
Reads the timestamps of all frames in a video asset.
|
| 984 |
+
|
| 985 |
+
Implementation note:
|
| 986 |
+
On the Python side we start out with a pyarrow array of bytes. Converting it to
|
| 987 |
+
Python `bytes` can be done with `to_pybytes` but this requires copying the data.
|
| 988 |
+
So instead, we pass the arrow array directly.
|
| 989 |
+
"""
|
| 990 |
+
|
| 991 |
+
def video_detect_gop_start(sample: bytes, codec_fourcc: int) -> bool:
|
| 992 |
+
"""
|
| 993 |
+
Detect whether a video sample starts a group of pictures, i.e. is a keyframe.
|
| 994 |
+
|
| 995 |
+
H.264/H.265 samples must be in Annex B format.
|
| 996 |
+
`codec_fourcc` is a `rerun.components.VideoCodec` enum value.
|
| 997 |
+
"""
|
| 998 |
+
|
| 999 |
+
def video_length_prefixed_to_annex_b(sample: bytes, length_prefix_size: int = 4) -> bytes:
|
| 1000 |
+
"""Convert a length-prefixed (AVCC-style) NAL unit sample to Annex B (start-code-prefixed)."""
|
| 1001 |
+
|
| 1002 |
+
#####################################################################################################################
|
| 1003 |
+
## CATALOG ##
|
| 1004 |
+
#####################################################################################################################
|
| 1005 |
+
|
| 1006 |
+
class EntryId:
|
| 1007 |
+
"""A unique identifier for an entry in the catalog."""
|
| 1008 |
+
|
| 1009 |
+
def __init__(self, id: str) -> None:
|
| 1010 |
+
"""Create a new `EntryId` from a string."""
|
| 1011 |
+
|
| 1012 |
+
def __str__(self) -> str:
|
| 1013 |
+
"""Return str(self)."""
|
| 1014 |
+
|
| 1015 |
+
def as_bytes(self) -> bytes:
|
| 1016 |
+
"""Return the raw 16-byte representation."""
|
| 1017 |
+
|
| 1018 |
+
class EntryKind:
|
| 1019 |
+
"""The kinds of entries that can be stored in the catalog."""
|
| 1020 |
+
|
| 1021 |
+
DATASET: EntryKind
|
| 1022 |
+
DATASET_VIEW: EntryKind
|
| 1023 |
+
TABLE: EntryKind
|
| 1024 |
+
TABLE_VIEW: EntryKind
|
| 1025 |
+
BLUEPRINT_DATASET: EntryKind
|
| 1026 |
+
ASSET_DATASET: EntryKind
|
| 1027 |
+
|
| 1028 |
+
def __str__(self, /) -> str:
|
| 1029 |
+
"""Return str(self)."""
|
| 1030 |
+
|
| 1031 |
+
def __int__(self) -> int:
|
| 1032 |
+
"""int(self)""" # noqa: D400
|
| 1033 |
+
|
| 1034 |
+
class EntryDetailsInternal:
|
| 1035 |
+
@property
|
| 1036 |
+
def id(self) -> EntryId: ...
|
| 1037 |
+
@property
|
| 1038 |
+
def name(self) -> str: ...
|
| 1039 |
+
@property
|
| 1040 |
+
def kind(self) -> EntryKind: ...
|
| 1041 |
+
@property
|
| 1042 |
+
def created_at(self) -> datetime: ...
|
| 1043 |
+
@property
|
| 1044 |
+
def updated_at(self) -> datetime: ...
|
| 1045 |
+
|
| 1046 |
+
class DatasetInfoInternal:
|
| 1047 |
+
@property
|
| 1048 |
+
def dataset_name(self) -> str: ...
|
| 1049 |
+
@property
|
| 1050 |
+
def num_segments(self) -> int: ...
|
| 1051 |
+
@property
|
| 1052 |
+
def size_bytes(self) -> int: ...
|
| 1053 |
+
@property
|
| 1054 |
+
def layers(self) -> list[tuple[str, int]]: ...
|
| 1055 |
+
@property
|
| 1056 |
+
def timelines(
|
| 1057 |
+
self,
|
| 1058 |
+
) -> list[tuple[str, Literal["sequence", "timestamp", "duration"], int, int | None, int | None]]: ...
|
| 1059 |
+
@property
|
| 1060 |
+
def num_entities(self) -> int: ...
|
| 1061 |
+
@property
|
| 1062 |
+
def num_component_columns(self) -> int: ...
|
| 1063 |
+
@property
|
| 1064 |
+
def property_columns(self) -> list[str]: ...
|
| 1065 |
+
|
| 1066 |
+
class DatasetEntryInternal:
|
| 1067 |
+
def catalog(self) -> CatalogClientInternal: ...
|
| 1068 |
+
def delete(self) -> None: ...
|
| 1069 |
+
def set_name(self, name: str) -> None: ...
|
| 1070 |
+
def entry_details(self) -> EntryDetailsInternal: ...
|
| 1071 |
+
|
| 1072 |
+
# ---
|
| 1073 |
+
|
| 1074 |
+
@property
|
| 1075 |
+
def manifest_url(self) -> str: ...
|
| 1076 |
+
def schema(self) -> SchemaInternal: ...
|
| 1077 |
+
def _dataset_revision(self) -> int | None: ...
|
| 1078 |
+
|
| 1079 |
+
# ---
|
| 1080 |
+
|
| 1081 |
+
def blueprint_dataset(self) -> DatasetEntryInternal | None: ...
|
| 1082 |
+
def asset_dataset(self) -> DatasetEntryInternal | None: ...
|
| 1083 |
+
def _ensure_asset_dataset(self) -> None: ...
|
| 1084 |
+
def default_blueprint_segment_id(self) -> str | None: ...
|
| 1085 |
+
def set_default_blueprint_segment_id(self, segment_id: str | None) -> None: ...
|
| 1086 |
+
def default_segment_table_blueprint_segment_id(self) -> str | None: ...
|
| 1087 |
+
def set_default_segment_table_blueprint_segment_id(self, segment_id: str | None) -> None: ...
|
| 1088 |
+
|
| 1089 |
+
# ---
|
| 1090 |
+
|
| 1091 |
+
def segment_ids(self) -> list[str]: ...
|
| 1092 |
+
def info(self) -> DatasetInfoInternal: ...
|
| 1093 |
+
def segment_table(self) -> dfn.DataFrame: ...
|
| 1094 |
+
def manifest(self) -> dfn.DataFrame: ...
|
| 1095 |
+
def segment_url(
|
| 1096 |
+
self,
|
| 1097 |
+
segment_id: str,
|
| 1098 |
+
timeline: str | None = None,
|
| 1099 |
+
start: datetime | timedelta | int | None = None,
|
| 1100 |
+
end: datetime | timedelta | int | None = None,
|
| 1101 |
+
) -> str: ...
|
| 1102 |
+
|
| 1103 |
+
# ---
|
| 1104 |
+
|
| 1105 |
+
def filter_segments(self, segment_ids: list[str]) -> DatasetSelectionInternal: ...
|
| 1106 |
+
def filter_contents(self, exprs: list[str]) -> DatasetSelectionInternal: ...
|
| 1107 |
+
|
| 1108 |
+
# ---
|
| 1109 |
+
|
| 1110 |
+
def write_bytes(
|
| 1111 |
+
self,
|
| 1112 |
+
data: bytes,
|
| 1113 |
+
storage_prefix: str | None,
|
| 1114 |
+
kind: Literal["segment", "blueprint", "asset"],
|
| 1115 |
+
layer: str,
|
| 1116 |
+
on_duplicate: str,
|
| 1117 |
+
) -> WriteOperationInternal: ...
|
| 1118 |
+
def write_path(
|
| 1119 |
+
self,
|
| 1120 |
+
path: str,
|
| 1121 |
+
storage_prefix: str | None,
|
| 1122 |
+
kind: Literal["segment", "blueprint", "asset"],
|
| 1123 |
+
layer: str,
|
| 1124 |
+
on_duplicate: str,
|
| 1125 |
+
) -> WriteOperationInternal: ...
|
| 1126 |
+
def register(
|
| 1127 |
+
self,
|
| 1128 |
+
recording_uris: list[str],
|
| 1129 |
+
recording_layers: list[str],
|
| 1130 |
+
on_duplicate: str,
|
| 1131 |
+
*,
|
| 1132 |
+
object_store_config: str | None = None,
|
| 1133 |
+
) -> RegistrationHandleInternal: ...
|
| 1134 |
+
def register_prefix(
|
| 1135 |
+
self,
|
| 1136 |
+
recordings_prefix: str,
|
| 1137 |
+
layer_name: str,
|
| 1138 |
+
on_duplicate: str,
|
| 1139 |
+
*,
|
| 1140 |
+
object_store_config: str | None = None,
|
| 1141 |
+
) -> RegistrationHandleInternal: ...
|
| 1142 |
+
def unregister(
|
| 1143 |
+
self,
|
| 1144 |
+
*,
|
| 1145 |
+
segments_to_drop: list[str],
|
| 1146 |
+
layers_to_drop: list[str],
|
| 1147 |
+
force: bool = False,
|
| 1148 |
+
) -> UnregistrationHandleInternal: ...
|
| 1149 |
+
|
| 1150 |
+
# ---
|
| 1151 |
+
|
| 1152 |
+
def assets_for_segment(self, segment_id: str) -> list[str]: ...
|
| 1153 |
+
def _get_segment_properties(self, segment_id: str) -> tuple[pa.RecordBatch, int] | None: ...
|
| 1154 |
+
def _set_segment_properties(
|
| 1155 |
+
self,
|
| 1156 |
+
segment_id: str,
|
| 1157 |
+
properties: pa.RecordBatch,
|
| 1158 |
+
expected_revision: int | None = None,
|
| 1159 |
+
) -> int: ...
|
| 1160 |
+
def delete_segment_properties(self, segment_ids: list[str]) -> None: ...
|
| 1161 |
+
|
| 1162 |
+
# ---
|
| 1163 |
+
|
| 1164 |
+
def layer(self, name: str) -> LayerInternal: ...
|
| 1165 |
+
def segment(self, segment_id: str) -> SegmentInternal: ...
|
| 1166 |
+
def segment_store(self, segment_id: str, *, include_assets: bool = True) -> LazyStoreInternal: ...
|
| 1167 |
+
|
| 1168 |
+
# ---
|
| 1169 |
+
|
| 1170 |
+
def do_maintenance(
|
| 1171 |
+
self,
|
| 1172 |
+
optimize_indexes: bool = False,
|
| 1173 |
+
retrain_indexes: bool = False,
|
| 1174 |
+
compact_fragments: bool = False,
|
| 1175 |
+
cleanup_before: datetime | None = None,
|
| 1176 |
+
unsafe_allow_recent_cleanup: bool = False,
|
| 1177 |
+
) -> None: ...
|
| 1178 |
+
|
| 1179 |
+
class LayerInternal:
|
| 1180 |
+
def __str__(self) -> str: ...
|
| 1181 |
+
@property
|
| 1182 |
+
def name(self) -> str: ...
|
| 1183 |
+
@property
|
| 1184 |
+
def dataset(self) -> DatasetEntryInternal: ...
|
| 1185 |
+
def segment_ids(self) -> list[str]: ...
|
| 1186 |
+
|
| 1187 |
+
class SegmentInternal:
|
| 1188 |
+
def __str__(self) -> str: ...
|
| 1189 |
+
@property
|
| 1190 |
+
def id(self) -> str: ...
|
| 1191 |
+
@property
|
| 1192 |
+
def dataset(self) -> DatasetEntryInternal: ...
|
| 1193 |
+
@property
|
| 1194 |
+
def url(self) -> str: ...
|
| 1195 |
+
def schema(self, *, include_assets: bool = False) -> SchemaInternal: ...
|
| 1196 |
+
def layers(self) -> set[str]: ...
|
| 1197 |
+
def delete_layer(self, name: str) -> UnregistrationHandleInternal: ...
|
| 1198 |
+
|
| 1199 |
+
class SegmentUrlUdfInternal:
|
| 1200 |
+
"""Rust-backed ScalarUDF for building segment URLs."""
|
| 1201 |
+
|
| 1202 |
+
def __datafusion_scalar_udf__(self) -> Any:
|
| 1203 |
+
"""Scalar UDF pycapsule."""
|
| 1204 |
+
|
| 1205 |
+
class DatasetSelectionInternal:
|
| 1206 |
+
"""Internal Rust implementation of DatasetSelection."""
|
| 1207 |
+
|
| 1208 |
+
# Properties
|
| 1209 |
+
@property
|
| 1210 |
+
def dataset(self) -> DatasetEntryInternal: ...
|
| 1211 |
+
@property
|
| 1212 |
+
def filtered_segment_ids(self) -> set[str] | None: ...
|
| 1213 |
+
@property
|
| 1214 |
+
def content_filters(self) -> list[str] | None: ...
|
| 1215 |
+
|
| 1216 |
+
# Methods
|
| 1217 |
+
def schema(self) -> SchemaInternal: ...
|
| 1218 |
+
def arrow_schema(self) -> pa.Schema: ...
|
| 1219 |
+
def segment_ids(self) -> list[str]: ...
|
| 1220 |
+
def reader(
|
| 1221 |
+
self,
|
| 1222 |
+
*,
|
| 1223 |
+
index: str | None,
|
| 1224 |
+
include_semantically_empty_columns: bool = False,
|
| 1225 |
+
include_tombstone_columns: bool = False,
|
| 1226 |
+
fill_latest_at: bool = False,
|
| 1227 |
+
using_index_values: dict[str, IndexValuesLike] | None = None,
|
| 1228 |
+
) -> dfn.DataFrame: ...
|
| 1229 |
+
def read_arrow(
|
| 1230 |
+
self,
|
| 1231 |
+
*,
|
| 1232 |
+
index: str | None,
|
| 1233 |
+
include_semantically_empty_columns: bool = False,
|
| 1234 |
+
include_tombstone_columns: bool = False,
|
| 1235 |
+
fill_latest_at: bool = False,
|
| 1236 |
+
using_index_values: dict[str, IndexValuesLike] | None = None,
|
| 1237 |
+
) -> pa.RecordBatchReader: ...
|
| 1238 |
+
def filter_segments(self, segment_ids: list[str]) -> DatasetSelectionInternal: ...
|
| 1239 |
+
def filter_contents(self, exprs: list[str]) -> DatasetSelectionInternal: ...
|
| 1240 |
+
|
| 1241 |
+
class TableEntryInternal:
|
| 1242 |
+
def catalog(self) -> CatalogClientInternal: ...
|
| 1243 |
+
def delete(self) -> None: ...
|
| 1244 |
+
def set_name(self, name: str) -> None: ...
|
| 1245 |
+
def entry_details(self) -> EntryDetailsInternal: ...
|
| 1246 |
+
|
| 1247 |
+
# ---
|
| 1248 |
+
|
| 1249 |
+
def blueprint_dataset(self) -> DatasetEntryInternal: ...
|
| 1250 |
+
def default_blueprint_segment_id(self) -> str | None: ...
|
| 1251 |
+
def set_default_blueprint_segment_id(self, segment_id: str | None) -> None: ...
|
| 1252 |
+
|
| 1253 |
+
# ---
|
| 1254 |
+
|
| 1255 |
+
def __datafusion_table_provider__(self, session: Any) -> Any: ...
|
| 1256 |
+
def reader(self) -> dfn.DataFrame: ...
|
| 1257 |
+
def to_arrow_reader(self) -> pa.RecordBatchReader: ...
|
| 1258 |
+
|
| 1259 |
+
# ---
|
| 1260 |
+
|
| 1261 |
+
@property
|
| 1262 |
+
def storage_url(self) -> str: ...
|
| 1263 |
+
def write_batches(
|
| 1264 |
+
self,
|
| 1265 |
+
batches: pa.RecordBatchReader,
|
| 1266 |
+
insert_mode: TableInsertModeInternal,
|
| 1267 |
+
) -> None: ...
|
| 1268 |
+
|
| 1269 |
+
class TableInsertModeInternal:
|
| 1270 |
+
"""The modes of operation when writing tables."""
|
| 1271 |
+
|
| 1272 |
+
APPEND: TableInsertModeInternal
|
| 1273 |
+
OVERWRITE: TableInsertModeInternal
|
| 1274 |
+
REPLACE: TableInsertModeInternal
|
| 1275 |
+
|
| 1276 |
+
class _UrdfTreeInternal:
|
| 1277 |
+
"""Internal Rust implementation of a parsed URDF tree."""
|
| 1278 |
+
|
| 1279 |
+
@staticmethod
|
| 1280 |
+
def from_file_path(
|
| 1281 |
+
path: str | os.PathLike[str],
|
| 1282 |
+
entity_path_prefix: str | None = None,
|
| 1283 |
+
*,
|
| 1284 |
+
frame_prefix: str | None = None,
|
| 1285 |
+
static_transform_entity_path: str | None = None,
|
| 1286 |
+
) -> _UrdfTreeInternal: ...
|
| 1287 |
+
@property
|
| 1288 |
+
def name(self) -> str: ...
|
| 1289 |
+
@property
|
| 1290 |
+
def frame_prefix(self) -> str | None: ...
|
| 1291 |
+
def root_link(self) -> _UrdfLinkInternal: ...
|
| 1292 |
+
def joints(self) -> list[_UrdfJointInternal]: ...
|
| 1293 |
+
def get_joint_by_name(self, joint_name: str) -> _UrdfJointInternal | None: ...
|
| 1294 |
+
def get_joint_child(self, joint: _UrdfJointInternal) -> _UrdfLinkInternal: ...
|
| 1295 |
+
def get_link_by_name(self, link_name: str) -> _UrdfLinkInternal | None: ...
|
| 1296 |
+
def get_collision_geometry_paths(self, link: str | _UrdfLinkInternal) -> list[str]: ...
|
| 1297 |
+
def get_visual_geometry_paths(self, link: str | _UrdfLinkInternal) -> list[str]: ...
|
| 1298 |
+
def log(self, recording: PyRecordingStream | None = None) -> None: ...
|
| 1299 |
+
def stream(self, *, include_joint_transforms: bool = True) -> LazyChunkStreamInternal: ...
|
| 1300 |
+
def compute_joint_transform_batches(
|
| 1301 |
+
self,
|
| 1302 |
+
names: pa.Array,
|
| 1303 |
+
values: pa.Array,
|
| 1304 |
+
*,
|
| 1305 |
+
clamp: bool = False,
|
| 1306 |
+
) -> pa.Array: ...
|
| 1307 |
+
|
| 1308 |
+
class _UrdfJointInternal:
|
| 1309 |
+
"""Internal Rust representation of a URDF joint."""
|
| 1310 |
+
|
| 1311 |
+
@property
|
| 1312 |
+
def name(self) -> str: ...
|
| 1313 |
+
@property
|
| 1314 |
+
def joint_type(self) -> str: ...
|
| 1315 |
+
@property
|
| 1316 |
+
def parent_link(self) -> str: ...
|
| 1317 |
+
@property
|
| 1318 |
+
def child_link(self) -> str: ...
|
| 1319 |
+
@property
|
| 1320 |
+
def axis(self) -> tuple[float, float, float]: ...
|
| 1321 |
+
@property
|
| 1322 |
+
def origin_xyz(self) -> tuple[float, float, float]: ...
|
| 1323 |
+
@property
|
| 1324 |
+
def origin_rpy(self) -> tuple[float, float, float]: ...
|
| 1325 |
+
@property
|
| 1326 |
+
def limit_lower(self) -> float: ...
|
| 1327 |
+
@property
|
| 1328 |
+
def limit_upper(self) -> float: ...
|
| 1329 |
+
@property
|
| 1330 |
+
def limit_effort(self) -> float: ...
|
| 1331 |
+
@property
|
| 1332 |
+
def limit_velocity(self) -> float: ...
|
| 1333 |
+
@property
|
| 1334 |
+
def mimic(self) -> _UrdfMimicInternal | None:
|
| 1335 |
+
"""The ``<mimic>`` tag for this joint, or ``None`` if this is not a mimic joint."""
|
| 1336 |
+
|
| 1337 |
+
def compute_transform(self, value: float, clamp: bool = False) -> dict[str, Any]:
|
| 1338 |
+
"""
|
| 1339 |
+
Compute the transform components for this joint at the given value.
|
| 1340 |
+
|
| 1341 |
+
The result is wrapped in a dictionary for easy conversion to the final types in Python.
|
| 1342 |
+
|
| 1343 |
+
If `clamp` is True, values outside joint limits will be clamped and a warning is generated.
|
| 1344 |
+
If `clamp` is False (default), values outside limits are used as-is without warnings.
|
| 1345 |
+
"""
|
| 1346 |
+
|
| 1347 |
+
def compute_transform_columns(self, values: list[float], *, clamp: bool = False) -> dict[str, Any]:
|
| 1348 |
+
"""
|
| 1349 |
+
Compute transforms for this joint at multiple values in a single call.
|
| 1350 |
+
|
| 1351 |
+
Returns a dictionary with translations, quaternions, frame names, and warnings
|
| 1352 |
+
for use with columnar APIs like `send_columns`.
|
| 1353 |
+
|
| 1354 |
+
If `clamp` is True, values outside joint limits will be clamped and a warning is generated.
|
| 1355 |
+
If `clamp` is False (default), values outside limits are used as-is without warnings.
|
| 1356 |
+
"""
|
| 1357 |
+
|
| 1358 |
+
class _UrdfMimicInternal:
|
| 1359 |
+
"""Internal Rust representation of a URDF ``<mimic>`` tag."""
|
| 1360 |
+
|
| 1361 |
+
@property
|
| 1362 |
+
def joint(self) -> str: ...
|
| 1363 |
+
@property
|
| 1364 |
+
def multiplier(self) -> float: ...
|
| 1365 |
+
@property
|
| 1366 |
+
def offset(self) -> float: ...
|
| 1367 |
+
|
| 1368 |
+
class _UrdfLinkInternal:
|
| 1369 |
+
"""Internal Rust representation of a URDF link."""
|
| 1370 |
+
|
| 1371 |
+
@property
|
| 1372 |
+
def name(self) -> str: ...
|
| 1373 |
+
|
| 1374 |
+
class _IndexValuesLikeInternal:
|
| 1375 |
+
"""
|
| 1376 |
+
A Python wrapper for [`IndexValuesLike`] extraction and conversion.
|
| 1377 |
+
|
| 1378 |
+
Provides a Python-accessible interface to normalize various index value
|
| 1379 |
+
representations (PyArrow arrays, NumPy arrays, ChunkedArrays) into sorted
|
| 1380 |
+
int64 index values.
|
| 1381 |
+
"""
|
| 1382 |
+
|
| 1383 |
+
def __init__(self, values: IndexValuesLike) -> None: ...
|
| 1384 |
+
def to_index_values(self) -> npt.NDArray[np.int64]: ...
|
| 1385 |
+
def len(self) -> int: ...
|
| 1386 |
+
|
| 1387 |
+
class TableProviderAdapterInternal:
|
| 1388 |
+
"""Internal opaque adapter exposing a Rust DataFusion `TableProvider` to Python via the FFI capsule protocol."""
|
| 1389 |
+
|
| 1390 |
+
def __datafusion_table_provider__(self, session: Any) -> Any: ...
|
| 1391 |
+
|
| 1392 |
+
class BearerTokenObjectStoreAuth:
|
| 1393 |
+
"""
|
| 1394 |
+
Authenticates object store fetches with an `Authorization: Bearer` header.
|
| 1395 |
+
|
| 1396 |
+
`get_token` is called before each batch of fetches, so it may refresh expiring credentials.
|
| 1397 |
+
It runs on a background thread while the query executes.
|
| 1398 |
+
"""
|
| 1399 |
+
|
| 1400 |
+
def __init__(self, get_token: Callable[[], str]) -> None:
|
| 1401 |
+
"""
|
| 1402 |
+
Create an authenticator from a callable returning the current bearer token.
|
| 1403 |
+
|
| 1404 |
+
`get_token` is invoked during queries and must return a `str`.
|
| 1405 |
+
"""
|
| 1406 |
+
|
| 1407 |
+
class CatalogClientInternal:
|
| 1408 |
+
def __init__(
|
| 1409 |
+
self,
|
| 1410 |
+
url: str,
|
| 1411 |
+
token: str | None = None,
|
| 1412 |
+
object_store_auth: BearerTokenObjectStoreAuth | None = None,
|
| 1413 |
+
client_name: str | None = None,
|
| 1414 |
+
) -> None: ...
|
| 1415 |
+
|
| 1416 |
+
# ---
|
| 1417 |
+
|
| 1418 |
+
@staticmethod
|
| 1419 |
+
def datafusion_major_version() -> int: ...
|
| 1420 |
+
|
| 1421 |
+
# ---
|
| 1422 |
+
|
| 1423 |
+
@property
|
| 1424 |
+
def url(self) -> str: ...
|
| 1425 |
+
@property
|
| 1426 |
+
def token(self) -> str | None: ...
|
| 1427 |
+
|
| 1428 |
+
# ---
|
| 1429 |
+
|
| 1430 |
+
def version_info(self) -> tuple[str, str | None, str | None, list[str]]: ...
|
| 1431 |
+
def rtt_seconds(self, num_pings: int) -> float: ...
|
| 1432 |
+
def bandwidth_bytes_per_sec(self, num_bytes: int, rtt_seconds: float) -> float | None: ...
|
| 1433 |
+
def stage_file(self, path: str, *, key: str) -> str: ...
|
| 1434 |
+
def stage_bytes(self, data: bytes, *, key: str) -> str: ...
|
| 1435 |
+
def datasets(self, include_hidden: bool) -> list[DatasetEntryInternal]: ...
|
| 1436 |
+
def tables(self, include_hidden: bool) -> list[TableEntryInternal]: ...
|
| 1437 |
+
|
| 1438 |
+
# ---
|
| 1439 |
+
|
| 1440 |
+
def get_dataset(self, id: EntryId) -> DatasetEntryInternal: ...
|
| 1441 |
+
def get_table(self, id: EntryId) -> TableEntryInternal: ...
|
| 1442 |
+
|
| 1443 |
+
# ---
|
| 1444 |
+
|
| 1445 |
+
def create_dataset(self, name: str) -> DatasetEntryInternal: ...
|
| 1446 |
+
def register_table(self, name: str, url: str) -> TableEntryInternal: ...
|
| 1447 |
+
def create_table(self, name: str, schema: pa.Schema, url: str | None) -> TableEntryInternal: ...
|
| 1448 |
+
def ctx(self) -> dfn.SessionContext: ...
|
| 1449 |
+
|
| 1450 |
+
# ---
|
| 1451 |
+
|
| 1452 |
+
def do_global_maintenance(self) -> None: ...
|
| 1453 |
+
|
| 1454 |
+
# ---
|
| 1455 |
+
|
| 1456 |
+
def _entry_id_from_entry_name(self, name: str) -> EntryId: ...
|
| 1457 |
+
|
| 1458 |
+
class WriteOperationInternal:
|
| 1459 |
+
def status(self) -> str: ...
|
| 1460 |
+
def wait(self, timeout_secs: int | None = None) -> tuple[list[str], str]: ...
|
| 1461 |
+
|
| 1462 |
+
class RegistrationHandleInternal:
|
| 1463 |
+
def iter_results(self, timeout_secs: int | None = None) -> Iterator[tuple[str, str, str | None]]: ...
|
| 1464 |
+
def wait(self, timeout_secs: int | None = None) -> list[str]: ...
|
| 1465 |
+
def cancel(self) -> None: ...
|
| 1466 |
+
|
| 1467 |
+
class UnregistrationHandleInternal:
|
| 1468 |
+
def wait(self, timeout_secs: int | None = None) -> None: ...
|
| 1469 |
+
def cancel(self) -> None: ...
|
| 1470 |
+
|
| 1471 |
+
#####################################################################################################################
|
| 1472 |
+
## VIEWER_CLIENT ##
|
| 1473 |
+
#####################################################################################################################
|
| 1474 |
+
|
| 1475 |
+
class ViewerClientInternal:
|
| 1476 |
+
"""Internal implementation. Use ViewerClient from rerun.experimental instead."""
|
| 1477 |
+
|
| 1478 |
+
def __init__(self, addr: str) -> None: ...
|
| 1479 |
+
def send_table(self, id: str, table: pa.RecordBatch) -> None: ...
|
| 1480 |
+
def viewer_control(self, request_json: str) -> str: ...
|
| 1481 |
+
|
| 1482 |
+
class NotFoundError(Exception):
|
| 1483 |
+
"""Raised when the requested resource is not found."""
|
| 1484 |
+
|
| 1485 |
+
class AlreadyExistsError(Exception):
|
| 1486 |
+
"""Raised when trying to create a resource that already exists."""
|
| 1487 |
+
|
| 1488 |
+
# The `asset` property layout, shared with the servers that read it.
|
| 1489 |
+
ASSET_PROPERTY: str
|
| 1490 |
+
ASSET_MODE_COMPONENT: str
|
| 1491 |
+
ASSET_SEGMENTS_COMPONENT: str
|
| 1492 |
+
ASSET_MODE_OPT_IN: str
|
| 1493 |
+
ASSET_MODE_OPT_OUT: str
|
| 1494 |
+
|
| 1495 |
+
class SelectorInternal:
|
| 1496 |
+
def __init__(self, query: str) -> None: ...
|
| 1497 |
+
def execute(self, source: pa.Array) -> pa.Array | None: ...
|
| 1498 |
+
def execute_per_row(self, source: pa.Array) -> pa.Array | None: ...
|
| 1499 |
+
def pipe(self, func: Any) -> SelectorInternal: ...
|
| 1500 |
+
def try_to_string(self) -> str | None: ...
|
| 1501 |
+
def __repr__(self) -> str: ...
|
| 1502 |
+
def __str__(self) -> str: ...
|
| 1503 |
+
|
| 1504 |
+
class DeriveLensInternal:
|
| 1505 |
+
def __init__(
|
| 1506 |
+
self,
|
| 1507 |
+
input_component: str,
|
| 1508 |
+
*,
|
| 1509 |
+
output_entity: str | None = None,
|
| 1510 |
+
scatter: bool = False,
|
| 1511 |
+
) -> None: ...
|
| 1512 |
+
def to_component(
|
| 1513 |
+
self,
|
| 1514 |
+
component: ComponentDescriptor,
|
| 1515 |
+
selector: SelectorInternal,
|
| 1516 |
+
cast_to: pa.DataType | Literal["auto"] | None = None,
|
| 1517 |
+
) -> DeriveLensInternal: ...
|
| 1518 |
+
def to_timeline(
|
| 1519 |
+
self, timeline_name: str, timeline_type: TimelineType, selector: SelectorInternal
|
| 1520 |
+
) -> DeriveLensInternal: ...
|
| 1521 |
+
|
| 1522 |
+
class MutateLensInternal:
|
| 1523 |
+
def __init__(
|
| 1524 |
+
self,
|
| 1525 |
+
input_component: str,
|
| 1526 |
+
selector: SelectorInternal,
|
| 1527 |
+
*,
|
| 1528 |
+
keep_row_ids: bool = False,
|
| 1529 |
+
) -> None: ...
|
| 1530 |
+
|
| 1531 |
+
LensInternal = DeriveLensInternal | MutateLensInternal
|
| 1532 |
+
|
| 1533 |
+
class _ServerInternal:
|
| 1534 |
+
def __init__(
|
| 1535 |
+
self,
|
| 1536 |
+
*,
|
| 1537 |
+
host: str,
|
| 1538 |
+
port: int,
|
| 1539 |
+
datasets: dict[str, list[str]],
|
| 1540 |
+
dataset_prefixes: dict[str, str],
|
| 1541 |
+
tables: dict[str, str],
|
| 1542 |
+
) -> None:
|
| 1543 |
+
"""
|
| 1544 |
+
Create and start a Rerun server.
|
| 1545 |
+
|
| 1546 |
+
Parameters
|
| 1547 |
+
----------
|
| 1548 |
+
host:
|
| 1549 |
+
The IP address to bind the server to.
|
| 1550 |
+
port:
|
| 1551 |
+
The port to bind the server to, or `0` to let the OS pick a free port.
|
| 1552 |
+
datasets:
|
| 1553 |
+
Optional dictionary mapping dataset names to lists of RRD file paths.
|
| 1554 |
+
dataset_prefixes:
|
| 1555 |
+
Optional dictionary mapping dataset names to directories containing RRDs.
|
| 1556 |
+
tables:
|
| 1557 |
+
Optional dictionary mapping table names to lance file paths,
|
| 1558 |
+
which will be loaded and made available when the server starts.
|
| 1559 |
+
|
| 1560 |
+
"""
|
| 1561 |
+
|
| 1562 |
+
def url(self) -> str: ...
|
| 1563 |
+
def host(self) -> str: ...
|
| 1564 |
+
def shutdown(self) -> None: ...
|
| 1565 |
+
def is_running(self) -> bool: ...
|
| 1566 |
+
def inject_error(self, method: str) -> None: ...
|
| 1567 |
+
def clear_injected_error(self, method: str) -> None: ...
|
| 1568 |
+
|
| 1569 |
+
#####################################################################################################################
|
| 1570 |
+
## AUTH ##
|
| 1571 |
+
#####################################################################################################################
|
| 1572 |
+
|
| 1573 |
+
class DeviceCodeFlow:
|
| 1574 |
+
"""
|
| 1575 |
+
OAuth login flow implementation.
|
| 1576 |
+
|
| 1577 |
+
The auth flow is browser-based, and the user will be redirected to the OAuth provider.
|
| 1578 |
+
"""
|
| 1579 |
+
|
| 1580 |
+
def login_url(self) -> str:
|
| 1581 |
+
"""Get the URL for the OAuth login flow."""
|
| 1582 |
+
|
| 1583 |
+
def user_code(self) -> str:
|
| 1584 |
+
"""Get the user code."""
|
| 1585 |
+
|
| 1586 |
+
def finish_login_flow(self) -> Credentials:
|
| 1587 |
+
"""
|
| 1588 |
+
Finish the OAuth login flow.
|
| 1589 |
+
|
| 1590 |
+
Returns
|
| 1591 |
+
-------
|
| 1592 |
+
Credentials
|
| 1593 |
+
The credentials of the logged in user.
|
| 1594 |
+
|
| 1595 |
+
"""
|
| 1596 |
+
|
| 1597 |
+
def init_login_flow() -> DeviceCodeFlow | None:
|
| 1598 |
+
"""
|
| 1599 |
+
Initialize an OAuth login flow.
|
| 1600 |
+
|
| 1601 |
+
Returns
|
| 1602 |
+
-------
|
| 1603 |
+
DeviceCodeFlow | None
|
| 1604 |
+
The login flow, or `None` if the user is already logged in.
|
| 1605 |
+
|
| 1606 |
+
"""
|
| 1607 |
+
|
| 1608 |
+
class Credentials:
|
| 1609 |
+
"""The credentials for the OAuth login flow."""
|
| 1610 |
+
|
| 1611 |
+
@property
|
| 1612 |
+
def access_token(self) -> str:
|
| 1613 |
+
"""The access token."""
|
| 1614 |
+
|
| 1615 |
+
@property
|
| 1616 |
+
def user_email(self) -> str:
|
| 1617 |
+
"""The user email."""
|
| 1618 |
+
|
| 1619 |
+
def get_credentials() -> Credentials | None:
|
| 1620 |
+
"""Returns the credentials for the current user."""
|
| 1621 |
+
|
| 1622 |
+
def logout() -> str | None:
|
| 1623 |
+
"""
|
| 1624 |
+
Log out by clearing stored credentials.
|
| 1625 |
+
|
| 1626 |
+
Returns
|
| 1627 |
+
-------
|
| 1628 |
+
str | None
|
| 1629 |
+
The logout URL to end the session, or `None` if already logged out.
|
| 1630 |
+
|
| 1631 |
+
"""
|
| 1632 |
+
|
| 1633 |
+
def _get_trace_context_var() -> Any:
|
| 1634 |
+
"""
|
| 1635 |
+
Return the `ContextVar` that Python uses to pass trace headers to Rust.
|
| 1636 |
+
|
| 1637 |
+
This is the **write side** of the bridge — Python's `with_tracing` decorator
|
| 1638 |
+
calls this to get the `ContextVar`, then writes W3C trace headers into it.
|
| 1639 |
+
Rust later reads them back via [`read_trace_context_from_python`].
|
| 1640 |
+
|
| 1641 |
+
Returns `None` when `perf_telemetry` is disabled.
|
| 1642 |
+
"""
|
| 1643 |
+
|
| 1644 |
+
def _get_tracing_session_var() -> Any:
|
| 1645 |
+
"""
|
| 1646 |
+
Return the `ContextVar` carrying the active rerun session id.
|
| 1647 |
+
|
| 1648 |
+
Set by the `tracing_session()` context manager and read on every outbound
|
| 1649 |
+
gRPC call to merge `rerun_session_id=<id>` into the W3C `tracestate` header.
|
| 1650 |
+
|
| 1651 |
+
Returns `None` when `perf_telemetry` is disabled.
|
| 1652 |
+
"""
|
| 1653 |
+
|
| 1654 |
+
def _is_telemetry_active() -> bool:
|
| 1655 |
+
"""
|
| 1656 |
+
Return `True` if the rerun telemetry stack initialized successfully.
|
| 1657 |
+
|
| 1658 |
+
`tracing_session()` requires this to be true; otherwise the W3C propagator
|
| 1659 |
+
is not registered and the session id has no transport.
|
| 1660 |
+
"""
|
| 1661 |
+
|
| 1662 |
+
def _inc_active_tracing_sessions() -> None:
|
| 1663 |
+
"""Increment the process-wide active-tracing-session gate. Called by `tracing_session().__enter__`."""
|
| 1664 |
+
|
| 1665 |
+
def _dec_active_tracing_sessions() -> None:
|
| 1666 |
+
"""Decrement the process-wide active-tracing-session gate. Called by `tracing_session().__exit__`."""
|
| 1667 |
+
|
| 1668 |
+
def _log_tracing_session_started(rerun_session_id: str) -> None:
|
| 1669 |
+
"""Emit `rerun tracing session started: <rerun_session_id>` through the Rust `tracing` stack at INFO level."""
|
| 1670 |
+
|
| 1671 |
+
def _log_tracing_session_finished(
|
| 1672 |
+
rerun_session_id: str,
|
| 1673 |
+
elapsed_s: float,
|
| 1674 |
+
cpu_user_s: float | None,
|
| 1675 |
+
cpu_system_s: float | None,
|
| 1676 |
+
cpu_iowait_s: float | None,
|
| 1677 |
+
net_rx_mb: float | None,
|
| 1678 |
+
) -> None:
|
| 1679 |
+
"""
|
| 1680 |
+
Emit a single structured INFO event summarizing the tracing session at scope exit.
|
| 1681 |
+
|
| 1682 |
+
`Option<f64>` fields are `None` when the host platform or runtime can't supply
|
| 1683 |
+
the metric (psutil missing, or `iowait` unavailable on macOS/Windows). Routed
|
| 1684 |
+
through the Rust `tracing` stack so it follows `RUST_LOG` and the fmt-layer
|
| 1685 |
+
pipeline like `_log_tracing_session_started`.
|
| 1686 |
+
"""
|
| 1687 |
+
|
| 1688 |
+
#####################################################################################################################
|
| 1689 |
+
## PIPELINE APIS ##
|
| 1690 |
+
#####################################################################################################################
|
| 1691 |
+
|
| 1692 |
+
class ChunkStoreInternal:
|
| 1693 |
+
"""Internal implementation. Use ChunkStore from rerun.chunk instead."""
|
| 1694 |
+
|
| 1695 |
+
@staticmethod
|
| 1696 |
+
def from_chunks(chunks: list[ChunkInternal]) -> ChunkStoreInternal: ...
|
| 1697 |
+
def schema(self) -> SchemaInternal: ...
|
| 1698 |
+
def num_chunks(self) -> int: ...
|
| 1699 |
+
def summary(self) -> str: ...
|
| 1700 |
+
def stream(self) -> LazyChunkStreamInternal: ...
|
| 1701 |
+
def _chunk_index(self) -> tuple[str, pa.RecordBatch]: ...
|
| 1702 |
+
def _optimized_stream(
|
| 1703 |
+
self,
|
| 1704 |
+
*,
|
| 1705 |
+
chunk_max_bytes: int | None = None,
|
| 1706 |
+
chunk_max_rows: int | None = None,
|
| 1707 |
+
chunk_max_rows_if_unsorted: int | None = None,
|
| 1708 |
+
target_timeline: str | None = None,
|
| 1709 |
+
own_chunk: Sequence[OwnChunkRuleDict] | None = None,
|
| 1710 |
+
gop_batching: Sequence[GopBatchingRuleDict] | None = None,
|
| 1711 |
+
) -> LazyChunkStreamInternal: ...
|
| 1712 |
+
def reader(
|
| 1713 |
+
self,
|
| 1714 |
+
*,
|
| 1715 |
+
index: str | None,
|
| 1716 |
+
contents: list[str] | None,
|
| 1717 |
+
include_semantically_empty_columns: bool,
|
| 1718 |
+
include_tombstone_columns: bool,
|
| 1719 |
+
fill_latest_at: bool,
|
| 1720 |
+
using_index_values: IndexValuesLike | None,
|
| 1721 |
+
) -> TableProviderAdapterInternal: ...
|
| 1722 |
+
|
| 1723 |
+
class LazyStoreInternal:
|
| 1724 |
+
"""Internal implementation. Use LazyStore from rerun.chunk instead."""
|
| 1725 |
+
|
| 1726 |
+
def schema(self) -> SchemaInternal: ...
|
| 1727 |
+
def num_chunks(self) -> int: ...
|
| 1728 |
+
def summary(self) -> str: ...
|
| 1729 |
+
def stream(self) -> LazyChunkStreamInternal: ...
|
| 1730 |
+
def _chunk_index(self) -> tuple[str, pa.RecordBatch]: ...
|
| 1731 |
+
def _optimized_stream(
|
| 1732 |
+
self,
|
| 1733 |
+
*,
|
| 1734 |
+
chunk_max_bytes: int | None = None,
|
| 1735 |
+
chunk_max_rows: int | None = None,
|
| 1736 |
+
chunk_max_rows_if_unsorted: int | None = None,
|
| 1737 |
+
target_timeline: str | None = None,
|
| 1738 |
+
own_chunk: Sequence[OwnChunkRuleDict] | None = None,
|
| 1739 |
+
gop_batching: Sequence[GopBatchingRuleDict] | None = None,
|
| 1740 |
+
) -> LazyChunkStreamInternal: ...
|
| 1741 |
+
@property
|
| 1742 |
+
def _chunks_loaded(self) -> int: ...
|
| 1743 |
+
|
| 1744 |
+
class StoreEntryInternal:
|
| 1745 |
+
"""Internal implementation. Use StoreEntry from rerun.chunk instead."""
|
| 1746 |
+
|
| 1747 |
+
@property
|
| 1748 |
+
def kind(self) -> Literal["recording", "blueprint"]: ...
|
| 1749 |
+
@property
|
| 1750 |
+
def application_id(self) -> str: ...
|
| 1751 |
+
@property
|
| 1752 |
+
def recording_id(self) -> str: ...
|
| 1753 |
+
|
| 1754 |
+
class RrdReaderInternal:
|
| 1755 |
+
"""Internal implementation. Use RrdReader from rerun.chunk instead."""
|
| 1756 |
+
|
| 1757 |
+
def __init__(self, path: str) -> None: ...
|
| 1758 |
+
def store_entries(self) -> list[StoreEntryInternal]: ...
|
| 1759 |
+
def stream(self, store: StoreEntryInternal | None = None) -> LazyChunkStreamInternal: ...
|
| 1760 |
+
def store(self, store: StoreEntryInternal | None = None) -> LazyStoreInternal: ...
|
| 1761 |
+
@property
|
| 1762 |
+
def path(self) -> Path: ...
|
| 1763 |
+
|
| 1764 |
+
class _McapSchemaInfoInternal:
|
| 1765 |
+
"""Schema metadata returned by `McapReader.info()`, excluding the schema payload."""
|
| 1766 |
+
|
| 1767 |
+
@property
|
| 1768 |
+
def id(self) -> int: ...
|
| 1769 |
+
@property
|
| 1770 |
+
def name(self) -> str: ...
|
| 1771 |
+
@property
|
| 1772 |
+
def encoding(self) -> str: ...
|
| 1773 |
+
@property
|
| 1774 |
+
def data_size_bytes(self) -> int: ...
|
| 1775 |
+
|
| 1776 |
+
class _McapChannelInfoInternal:
|
| 1777 |
+
"""Channel metadata and message statistics returned by `McapReader.info()`."""
|
| 1778 |
+
|
| 1779 |
+
@property
|
| 1780 |
+
def id(self) -> int: ...
|
| 1781 |
+
@property
|
| 1782 |
+
def topic(self) -> str: ...
|
| 1783 |
+
@property
|
| 1784 |
+
def message_encoding(self) -> str: ...
|
| 1785 |
+
@property
|
| 1786 |
+
def metadata(self) -> dict[str, str]: ...
|
| 1787 |
+
@property
|
| 1788 |
+
def schema(self) -> _McapSchemaInfoInternal | None: ...
|
| 1789 |
+
@property
|
| 1790 |
+
def message_count(self) -> int | None: ...
|
| 1791 |
+
@property
|
| 1792 |
+
def frequency_hz(self) -> tuple[float, float] | None: ...
|
| 1793 |
+
|
| 1794 |
+
class _McapCompressionInfoInternal:
|
| 1795 |
+
"""Aggregate chunk sizes for one MCAP compression codec."""
|
| 1796 |
+
|
| 1797 |
+
@property
|
| 1798 |
+
def codec(self) -> str: ...
|
| 1799 |
+
@property
|
| 1800 |
+
def chunk_count(self) -> int: ...
|
| 1801 |
+
@property
|
| 1802 |
+
def compressed_size_bytes(self) -> int: ...
|
| 1803 |
+
@property
|
| 1804 |
+
def uncompressed_size_bytes(self) -> int: ...
|
| 1805 |
+
|
| 1806 |
+
class _McapChunkInfoInternal:
|
| 1807 |
+
"""Aggregate information about the indexed chunks in an MCAP file."""
|
| 1808 |
+
|
| 1809 |
+
@property
|
| 1810 |
+
def count(self) -> int: ...
|
| 1811 |
+
@property
|
| 1812 |
+
def max_uncompressed_size_bytes(self) -> int | None: ...
|
| 1813 |
+
@property
|
| 1814 |
+
def max_compressed_size_bytes(self) -> int | None: ...
|
| 1815 |
+
@property
|
| 1816 |
+
def has_overlapping_time_ranges(self) -> bool: ...
|
| 1817 |
+
|
| 1818 |
+
class _McapInfoInternal:
|
| 1819 |
+
"""Header and summary information returned by `McapReader.info()`."""
|
| 1820 |
+
|
| 1821 |
+
@property
|
| 1822 |
+
def profile(self) -> str: ...
|
| 1823 |
+
@property
|
| 1824 |
+
def library(self) -> str: ...
|
| 1825 |
+
@property
|
| 1826 |
+
def message_count(self) -> int | None: ...
|
| 1827 |
+
@property
|
| 1828 |
+
def message_start_time_ns(self) -> int | None: ...
|
| 1829 |
+
@property
|
| 1830 |
+
def message_end_time_ns(self) -> int | None: ...
|
| 1831 |
+
@property
|
| 1832 |
+
def duration_ns(self) -> int | None: ...
|
| 1833 |
+
@property
|
| 1834 |
+
def schema_count(self) -> int: ...
|
| 1835 |
+
@property
|
| 1836 |
+
def channel_count(self) -> int: ...
|
| 1837 |
+
@property
|
| 1838 |
+
def attachment_count(self) -> int: ...
|
| 1839 |
+
@property
|
| 1840 |
+
def metadata_count(self) -> int: ...
|
| 1841 |
+
@property
|
| 1842 |
+
def statistics_present(self) -> bool: ...
|
| 1843 |
+
@property
|
| 1844 |
+
def summary_source(self) -> Literal["embedded", "reconstructed"]: ...
|
| 1845 |
+
@property
|
| 1846 |
+
def chunks(self) -> _McapChunkInfoInternal: ...
|
| 1847 |
+
@property
|
| 1848 |
+
def compression(self) -> list[_McapCompressionInfoInternal]: ...
|
| 1849 |
+
@property
|
| 1850 |
+
def channels(self) -> list[_McapChannelInfoInternal]: ...
|
| 1851 |
+
|
| 1852 |
+
class McapReaderInternal:
|
| 1853 |
+
"""Internal implementation. Use McapReader from rerun.chunk instead."""
|
| 1854 |
+
|
| 1855 |
+
def __init__(
|
| 1856 |
+
self,
|
| 1857 |
+
path: str,
|
| 1858 |
+
timeline_type: TemporalTimelineType,
|
| 1859 |
+
timestamp_offset_ns: int | None,
|
| 1860 |
+
decoders: list[str] | None,
|
| 1861 |
+
include_topic_regex: list[str] | None,
|
| 1862 |
+
exclude_topic_regex: list[str] | None,
|
| 1863 |
+
start_time_ns: int | None,
|
| 1864 |
+
end_time_ns: int | None,
|
| 1865 |
+
recover: bool,
|
| 1866 |
+
) -> None: ...
|
| 1867 |
+
def stream(
|
| 1868 |
+
self,
|
| 1869 |
+
*,
|
| 1870 |
+
start_time_ns: int | None = None,
|
| 1871 |
+
end_time_ns: int | None = None,
|
| 1872 |
+
) -> LazyChunkStreamInternal: ...
|
| 1873 |
+
def time_bounds(self) -> tuple[int, int]: ...
|
| 1874 |
+
def info(self) -> _McapInfoInternal: ...
|
| 1875 |
+
@property
|
| 1876 |
+
def path(self) -> Path: ...
|
| 1877 |
+
@staticmethod
|
| 1878 |
+
def available_decoders() -> list[str]: ...
|
| 1879 |
+
|
| 1880 |
+
class Mp4TranscodeOptionsInternal:
|
| 1881 |
+
"""Internal implementation. Use Mp4TranscodeOptions from rerun.experimental instead."""
|
| 1882 |
+
|
| 1883 |
+
def __init__(
|
| 1884 |
+
self,
|
| 1885 |
+
gop_size: int | None = None,
|
| 1886 |
+
output_codec: int | None = None,
|
| 1887 |
+
try_gpu: bool = False,
|
| 1888 |
+
ffmpeg_override: Path | None = None,
|
| 1889 |
+
) -> None: ...
|
| 1890 |
+
|
| 1891 |
+
class Mp4ReaderInternal:
|
| 1892 |
+
"""Internal implementation. Use Mp4Reader from rerun.experimental instead."""
|
| 1893 |
+
|
| 1894 |
+
def __init__(
|
| 1895 |
+
self,
|
| 1896 |
+
path: Path,
|
| 1897 |
+
mode: Literal["asset", "stream"] = "stream",
|
| 1898 |
+
chunk_by_gop: bool = True,
|
| 1899 |
+
timeline_name: str = "video",
|
| 1900 |
+
timeline_type: TemporalTimelineType = "duration_ns",
|
| 1901 |
+
transcode: Mp4TranscodeOptionsInternal | None = None,
|
| 1902 |
+
entity_path: str | None = None,
|
| 1903 |
+
) -> None: ...
|
| 1904 |
+
def stream(self) -> LazyChunkStreamInternal: ...
|
| 1905 |
+
@property
|
| 1906 |
+
def path(self) -> Path: ...
|
| 1907 |
+
@property
|
| 1908 |
+
def entity_path(self) -> str: ...
|
| 1909 |
+
|
| 1910 |
+
class Hdf5ReaderInternal:
|
| 1911 |
+
"""Internal implementation. Use Hdf5Reader from rerun.experimental instead."""
|
| 1912 |
+
|
| 1913 |
+
def __init__(self, path: str) -> None: ...
|
| 1914 |
+
def stream(
|
| 1915 |
+
self,
|
| 1916 |
+
root_group: str | None = None,
|
| 1917 |
+
entity_path_prefix: str | None = None,
|
| 1918 |
+
index_column: tuple[str, str, str | None] | None = None,
|
| 1919 |
+
ignore_datasets: list[str] | None = None,
|
| 1920 |
+
use_structs: bool = True,
|
| 1921 |
+
) -> LazyChunkStreamInternal: ...
|
| 1922 |
+
def groups(self, path: str = "/") -> list[str]: ...
|
| 1923 |
+
def datasets(self, path: str = "/") -> list[tuple[str, list[int], str]]: ...
|
| 1924 |
+
def attributes(self, path: str = "/") -> dict[str, int | float | str | bytes | list[int | float | str]]: ...
|
| 1925 |
+
@property
|
| 1926 |
+
def path(self) -> Path: ...
|
| 1927 |
+
|
| 1928 |
+
class LeRobotReaderInternal:
|
| 1929 |
+
"""Internal implementation. Use LeRobotReader from rerun.experimental instead."""
|
| 1930 |
+
|
| 1931 |
+
def __init__(self, path: str) -> None: ...
|
| 1932 |
+
def episodes(self) -> list[int]: ...
|
| 1933 |
+
def metadata(self, entity_path_prefix: str | None) -> ChunkInternal: ...
|
| 1934 |
+
def stream(
|
| 1935 |
+
self,
|
| 1936 |
+
episode: int,
|
| 1937 |
+
entity_path_prefix: str | None,
|
| 1938 |
+
timeline: str | None,
|
| 1939 |
+
video_mode: str,
|
| 1940 |
+
) -> LazyChunkStreamInternal: ...
|
| 1941 |
+
@property
|
| 1942 |
+
def version(self) -> Literal["v2", "v3"]: ...
|
| 1943 |
+
@property
|
| 1944 |
+
def path(self) -> Path: ...
|
| 1945 |
+
|
| 1946 |
+
class ParquetReaderInternal:
|
| 1947 |
+
"""Internal implementation. Use ParquetReader from rerun.experimental instead."""
|
| 1948 |
+
|
| 1949 |
+
def __init__(self, path: str) -> None: ...
|
| 1950 |
+
def stream(
|
| 1951 |
+
self,
|
| 1952 |
+
entity_path_prefix: str | None = None,
|
| 1953 |
+
column_grouping: str = "prefix",
|
| 1954 |
+
delimiter: str = "_",
|
| 1955 |
+
prefixes: list[str] | None = None,
|
| 1956 |
+
use_structs: bool = True,
|
| 1957 |
+
static_columns: list[str] | None = None,
|
| 1958 |
+
index_columns: list[tuple[str, str, str | None]] | None = None,
|
| 1959 |
+
) -> LazyChunkStreamInternal: ...
|
| 1960 |
+
@property
|
| 1961 |
+
def path(self) -> Path: ...
|
| 1962 |
+
|
| 1963 |
+
class LazyChunkStreamInternal:
|
| 1964 |
+
"""Internal implementation. Use LazyChunkStream from rerun.chunk instead."""
|
| 1965 |
+
|
| 1966 |
+
def filter(
|
| 1967 |
+
self,
|
| 1968 |
+
*,
|
| 1969 |
+
content: list[str] | None = None,
|
| 1970 |
+
has_timeline: str | None = None,
|
| 1971 |
+
is_static: bool | None = None,
|
| 1972 |
+
components: list[str] | None = None,
|
| 1973 |
+
) -> LazyChunkStreamInternal: ...
|
| 1974 |
+
def drop_matching(
|
| 1975 |
+
self,
|
| 1976 |
+
*,
|
| 1977 |
+
content: list[str] | None = None,
|
| 1978 |
+
has_timeline: str | None = None,
|
| 1979 |
+
is_static: bool | None = None,
|
| 1980 |
+
components: list[str] | None = None,
|
| 1981 |
+
) -> LazyChunkStreamInternal: ...
|
| 1982 |
+
def split(
|
| 1983 |
+
self,
|
| 1984 |
+
*,
|
| 1985 |
+
content: list[str] | None = None,
|
| 1986 |
+
has_timeline: str | None = None,
|
| 1987 |
+
is_static: bool | None = None,
|
| 1988 |
+
components: list[str] | None = None,
|
| 1989 |
+
) -> tuple[LazyChunkStreamInternal, LazyChunkStreamInternal]: ...
|
| 1990 |
+
def lenses(
|
| 1991 |
+
self,
|
| 1992 |
+
lenses: list[LensInternal],
|
| 1993 |
+
output_mode: str,
|
| 1994 |
+
content: list[str] | None,
|
| 1995 |
+
) -> LazyChunkStreamInternal: ...
|
| 1996 |
+
def map(self, callable: Callable[[ChunkInternal], ChunkInternal]) -> LazyChunkStreamInternal: ...
|
| 1997 |
+
def flat_map(self, callable: Callable[[ChunkInternal], list[ChunkInternal]]) -> LazyChunkStreamInternal: ...
|
| 1998 |
+
@staticmethod
|
| 1999 |
+
def merge(streams: list[LazyChunkStreamInternal]) -> LazyChunkStreamInternal: ...
|
| 2000 |
+
def write_rrd(self, path: str, application_id: str, recording_id: str) -> None: ...
|
| 2001 |
+
def collect(
|
| 2002 |
+
self,
|
| 2003 |
+
*,
|
| 2004 |
+
max_bytes: int | None = None,
|
| 2005 |
+
max_rows: int | None = None,
|
| 2006 |
+
max_rows_if_unsorted: int | None = None,
|
| 2007 |
+
extra_passes: int = 0,
|
| 2008 |
+
gop_batching: bool = False,
|
| 2009 |
+
split_size_ratio: float | None = None,
|
| 2010 |
+
fix_keyframe: bool = False,
|
| 2011 |
+
) -> ChunkStoreInternal:
|
| 2012 |
+
"""
|
| 2013 |
+
Run the pipeline and materialize all chunks into a ChunkStore.
|
| 2014 |
+
|
| 2015 |
+
The defaults (`extra_passes=0`, `gop_batching=False`) produce a store that
|
| 2016 |
+
has only received the single-pass compaction that happens naturally during
|
| 2017 |
+
chunk insertion. The Python wrapper `LazyChunkStream.collect(optimize=...)`
|
| 2018 |
+
is the intended entry point.
|
| 2019 |
+
"""
|
| 2020 |
+
|
| 2021 |
+
def to_chunks(self) -> list[ChunkInternal]: ...
|
| 2022 |
+
def __iter__(self) -> LazyChunkStreamIterator: ...
|
| 2023 |
+
@staticmethod
|
| 2024 |
+
def from_iter(iterable: Any) -> LazyChunkStreamInternal: ...
|
| 2025 |
+
def send_to_recording(self, recording: PyRecordingStream | None = None) -> None:
|
| 2026 |
+
"""
|
| 2027 |
+
Drain this stream into a recording stream.
|
| 2028 |
+
|
| 2029 |
+
If `recording` is `None`, the active recording is used. Blocks until every
|
| 2030 |
+
chunk has been pushed to the recording's batcher. A silent no-op when
|
| 2031 |
+
there is no active recording.
|
| 2032 |
+
"""
|
| 2033 |
+
|
| 2034 |
+
class LazyChunkStreamIterator:
|
| 2035 |
+
"""Iterator over chunks from a compiled stream."""
|
| 2036 |
+
|
| 2037 |
+
def __iter__(self) -> LazyChunkStreamIterator:
|
| 2038 |
+
"""Implement iter(self)."""
|
| 2039 |
+
|
| 2040 |
+
def __next__(self) -> ChunkInternal:
|
| 2041 |
+
"""Implement next(self)."""
|
| 2042 |
+
|
| 2043 |
+
#####################################################################################################################
|
| 2044 |
+
## METRICS APIS ##
|
| 2045 |
+
#####################################################################################################################
|
| 2046 |
+
|
| 2047 |
+
class _QueryMetrics:
|
| 2048 |
+
"""Frozen mirror of `re_datafusion::QuerySnapshot`. One per query."""
|
| 2049 |
+
|
| 2050 |
+
# Plan-time
|
| 2051 |
+
dataset_id: str
|
| 2052 |
+
"""The dataset being queried."""
|
| 2053 |
+
|
| 2054 |
+
query_chunks: int
|
| 2055 |
+
"""Number of unique chunks returned by `query_dataset` (subset of the dataset)."""
|
| 2056 |
+
|
| 2057 |
+
query_segments: int
|
| 2058 |
+
"""Number of distinct segments involved in the query."""
|
| 2059 |
+
|
| 2060 |
+
query_layers: int
|
| 2061 |
+
"""Number of distinct layers touched by the query."""
|
| 2062 |
+
|
| 2063 |
+
query_columns: int
|
| 2064 |
+
"""Number of columns in the query output schema."""
|
| 2065 |
+
|
| 2066 |
+
query_entities: int
|
| 2067 |
+
"""Number of entity paths in the query request."""
|
| 2068 |
+
|
| 2069 |
+
query_bytes: int
|
| 2070 |
+
"""Total size of all queried chunks in bytes (from chunk metadata)."""
|
| 2071 |
+
|
| 2072 |
+
query_chunks_per_segment_min: int
|
| 2073 |
+
"""Min number of chunks touched within any single segment in this query."""
|
| 2074 |
+
|
| 2075 |
+
query_chunks_per_segment_max: int
|
| 2076 |
+
"""Max number of chunks touched within any single segment in this query."""
|
| 2077 |
+
|
| 2078 |
+
query_chunks_per_segment_mean: float
|
| 2079 |
+
"""Mean number of chunks touched per segment in this query."""
|
| 2080 |
+
|
| 2081 |
+
query_type: str
|
| 2082 |
+
"""Query shape: one of `"static"`, `"latest_at"`, `"range"`, `"dataframe"`, or `"full_scan"`."""
|
| 2083 |
+
|
| 2084 |
+
primary_index_name: str | None
|
| 2085 |
+
"""Name of the sort/filter index (timeline) for this query, if any."""
|
| 2086 |
+
|
| 2087 |
+
time_to_first_chunk_info: timedelta | None
|
| 2088 |
+
"""Time from sending `query_dataset` until the first response message arrives (the chunk metadata, not actual chunk data)."""
|
| 2089 |
+
|
| 2090 |
+
filters_pushed_down: int
|
| 2091 |
+
"""Number of filter expressions the table provider was able to push down to the server (`Exact` or `Inexact` from `supports_filters_pushdown`)."""
|
| 2092 |
+
|
| 2093 |
+
filters_applied_client_side: int
|
| 2094 |
+
"""Number of filter expressions that could not be pushed down — applied client-side by DataFusion via a downstream `FilterExec`."""
|
| 2095 |
+
|
| 2096 |
+
entity_path_narrowing_applied: bool
|
| 2097 |
+
"""True when projection-based entity-path narrowing actually trimmed the set of entity paths sent to `query_dataset`."""
|
| 2098 |
+
|
| 2099 |
+
target_partitions: int
|
| 2100 |
+
"""DataFusion target partition count for this scan — the degree of parallelism the plan was built for. Makes `peak_inflight_fetches` interpretable."""
|
| 2101 |
+
|
| 2102 |
+
# Execution-time
|
| 2103 |
+
total_duration: timedelta
|
| 2104 |
+
"""Wall-clock time from the start of `scan()` until the query finished (cleanly or via error). Always populated."""
|
| 2105 |
+
|
| 2106 |
+
time_to_first_chunk: timedelta | None
|
| 2107 |
+
"""Time from scan start until the first chunk reached the consumer. `None` when no chunk was ever delivered (e.g. early error, empty result)."""
|
| 2108 |
+
|
| 2109 |
+
error_kind: str | None
|
| 2110 |
+
"""`None` on success. On failure, one of the stable string labels `"grpc_fetch"`, `"direct_fetch"`, `"decode"`, or `"other"`."""
|
| 2111 |
+
|
| 2112 |
+
direct_terminal_reason: str | None
|
| 2113 |
+
"""Reason a direct (HTTP Range) fetch hit a terminal failure — i.e. a non-retryable error or retries exhausted. `None` when no direct fetch terminally failed (can be `None` even when `error_kind` is set, if the failure was on the gRPC or decode path)."""
|
| 2114 |
+
|
| 2115 |
+
# Fetch counters
|
| 2116 |
+
fetch_grpc_requests: int
|
| 2117 |
+
"""Number of gRPC fetch calls the scanner issued."""
|
| 2118 |
+
|
| 2119 |
+
fetch_grpc_bytes: int
|
| 2120 |
+
"""Sum of `chunk_byte_length` (catalog metadata, compressed on-disk size) over chunks fetched via gRPC. Excludes framing overhead and bytes consumed by failed retries — a lower bound on wire traffic."""
|
| 2121 |
+
|
| 2122 |
+
fetch_direct_requests: int
|
| 2123 |
+
"""Number of direct (HTTP Range) fetches the scanner issued. Counts each merged request once, regardless of byte ranges or retry attempts."""
|
| 2124 |
+
|
| 2125 |
+
fetch_direct_bytes: int
|
| 2126 |
+
"""Sum of `chunk_byte_length` (catalog metadata, compressed on-disk size) over chunks fetched via direct HTTP. Does **not** count filler bytes that range-merging pulls between adjacent chunks, so actual wire traffic can exceed this value. Includes successful merged-range fetches even when a sibling range makes the overall batch fail."""
|
| 2127 |
+
|
| 2128 |
+
fetch_direct_retries: int
|
| 2129 |
+
"""Total number of direct-fetch retry *attempts* across all requests. A request retried 3 times contributes 3 here."""
|
| 2130 |
+
|
| 2131 |
+
fetch_direct_requests_retried: int
|
| 2132 |
+
"""Number of distinct direct-fetch requests that needed at least one retry. Always `≤ fetch_direct_retries`; the ratio between them is the average retries per retried request."""
|
| 2133 |
+
|
| 2134 |
+
fetch_direct_retry_sleep: timedelta
|
| 2135 |
+
"""Total backoff time slept across all direct-fetch retries."""
|
| 2136 |
+
|
| 2137 |
+
fetch_direct_max_attempt: int
|
| 2138 |
+
"""True maximum attempt number across all partitions."""
|
| 2139 |
+
|
| 2140 |
+
fetch_direct_original_ranges: int
|
| 2141 |
+
"""Number of byte ranges the planner *wanted* to fetch directly, before adjacent ranges were coalesced. With `fetch_direct_merged_ranges`, gives the range-merging ratio."""
|
| 2142 |
+
|
| 2143 |
+
fetch_direct_merged_ranges: int
|
| 2144 |
+
"""Number of combined HTTP Range requests produced by merging adjacent byte ranges. Normally equals `fetch_direct_requests` after a completed scan, but can differ when cancellation stops only part of the planned work from being issued."""
|
| 2145 |
+
|
| 2146 |
+
planned_fetch_batches: int
|
| 2147 |
+
"""Transport batches planned before splitting direct and gRPC work."""
|
| 2148 |
+
|
| 2149 |
+
planned_segment_waves: int
|
| 2150 |
+
"""Segment waves produced by the current admission scheduler."""
|
| 2151 |
+
|
| 2152 |
+
segment_admission_limit: int
|
| 2153 |
+
"""Maximum concurrently admitted segments configured for this query."""
|
| 2154 |
+
|
| 2155 |
+
segment_admission_candidate_limit: int
|
| 2156 |
+
"""Cap recommended by the adaptive policy, whether or not it was applied."""
|
| 2157 |
+
|
| 2158 |
+
segment_admission_source: str
|
| 2159 |
+
"""Source of the effective admission cap."""
|
| 2160 |
+
|
| 2161 |
+
segment_admission_candidate_reason: str
|
| 2162 |
+
"""Reason the adaptive candidate was or was not eligible."""
|
| 2163 |
+
|
| 2164 |
+
segment_admission_adaptive_enabled: bool
|
| 2165 |
+
"""Whether adaptive segment admission was enabled."""
|
| 2166 |
+
|
| 2167 |
+
segment_admission_profile_segment_count: int
|
| 2168 |
+
"""Number of segments evaluated by the adaptive policy."""
|
| 2169 |
+
|
| 2170 |
+
segment_admission_profile_complete: bool
|
| 2171 |
+
"""Whether every segment had complete positive uncompressed-size metadata."""
|
| 2172 |
+
|
| 2173 |
+
segment_admission_p95_segment_bytes: int
|
| 2174 |
+
"""Nearest-rank p95 queried uncompressed bytes per segment."""
|
| 2175 |
+
|
| 2176 |
+
segment_admission_max_segment_bytes: int
|
| 2177 |
+
"""Largest queried uncompressed segment size."""
|
| 2178 |
+
|
| 2179 |
+
segment_admission_largest_window_bytes: int
|
| 2180 |
+
"""Sum of the largest candidate-window segment estimates."""
|
| 2181 |
+
|
| 2182 |
+
max_segments_per_fetch_batch: int
|
| 2183 |
+
"""Largest distinct-segment count in a planned transport batch."""
|
| 2184 |
+
|
| 2185 |
+
max_segments_per_wave: int
|
| 2186 |
+
"""Largest distinct-segment count in a planned admission wave."""
|
| 2187 |
+
|
| 2188 |
+
peak_active_segments: int
|
| 2189 |
+
"""Highest observed number of active admitted segments. May exceed `segment_admission_limit` when the stall breaker admits bypass segments."""
|
| 2190 |
+
|
| 2191 |
+
pipeline_budget_bytes: int
|
| 2192 |
+
"""Total decoded-byte capacity shared across all query partitions."""
|
| 2193 |
+
|
| 2194 |
+
pipeline_peak_decoded_bytes: int
|
| 2195 |
+
"""Highest observed number of decoded bytes charged to the pipeline budget."""
|
| 2196 |
+
|
| 2197 |
+
pipeline_byte_waits: int
|
| 2198 |
+
"""Reservations that first parked because decoded-byte capacity was full."""
|
| 2199 |
+
|
| 2200 |
+
segment_admission_waits: int
|
| 2201 |
+
"""Reservations that first parked because segment admission was full."""
|
| 2202 |
+
|
| 2203 |
+
pipeline_stall_breaker_activations: int
|
| 2204 |
+
"""Number of saturated-pipeline stall-breaker activations."""
|
| 2205 |
+
|
| 2206 |
+
# Delivered payload, decode cost, observed parallelism
|
| 2207 |
+
delivered_rows: int
|
| 2208 |
+
"""Total rows delivered to the consumer, summed across partitions — post-decode, post-query, post-client-filter."""
|
| 2209 |
+
|
| 2210 |
+
delivered_bytes: int
|
| 2211 |
+
"""In-memory (decoded) size of every record batch delivered to the consumer, summed across partitions."""
|
| 2212 |
+
|
| 2213 |
+
decode_duration: timedelta
|
| 2214 |
+
"""Total CPU time spent decoding/decompressing fetched chunks (both fetch paths). Compare against `total_duration` to separate CPU-bound queries from network-bound ones."""
|
| 2215 |
+
|
| 2216 |
+
peak_inflight_fetches: int
|
| 2217 |
+
"""Highest number of fetch tasks in flight at once across the whole query (one unit per concurrent merged transport batch)."""
|
| 2218 |
+
|
| 2219 |
+
class _MetricsCollectorHandle:
|
| 2220 |
+
"""Opaque handle held by the `query_metrics()` context manager."""
|
| 2221 |
+
|
| 2222 |
+
def snapshot(self) -> list[_QueryMetrics]:
|
| 2223 |
+
"""
|
| 2224 |
+
Non-destructive copy of all snapshots received so far.
|
| 2225 |
+
|
| 2226 |
+
Suitable for use mid-scope (`collector.queries` in the Python wrapper).
|
| 2227 |
+
"""
|
| 2228 |
+
|
| 2229 |
+
def drain(self) -> list[_QueryMetrics]:
|
| 2230 |
+
"""
|
| 2231 |
+
Take and clear all snapshots.
|
| 2232 |
+
|
| 2233 |
+
Used by the context manager on `__exit__` to drain any remaining
|
| 2234 |
+
snapshots into the user-visible Python `MetricsCollector` wrapper.
|
| 2235 |
+
"""
|
| 2236 |
+
|
| 2237 |
+
def _new_metrics_collector() -> _MetricsCollectorHandle:
|
| 2238 |
+
"""
|
| 2239 |
+
Allocate a fresh [`MetricsCollector`] and wrap it in a Python handle.
|
| 2240 |
+
|
| 2241 |
+
The Python `query_metrics()` context manager pushes the returned handle
|
| 2242 |
+
onto the `_active_collectors` `ContextVar` for the duration of the
|
| 2243 |
+
`with` block; nothing is registered globally.
|
| 2244 |
+
"""
|
player/runtime/python/Lib/site-packages/rerun_bindings/types.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Literal, TypeAlias, TypedDict
|
| 4 |
+
|
| 5 |
+
import numpy as np
|
| 6 |
+
import numpy.typing as npt
|
| 7 |
+
import pyarrow as pa
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from .rerun_bindings import (
|
| 11 |
+
ComponentColumnDescriptor as ComponentColumnDescriptor,
|
| 12 |
+
ComponentColumnSelector as ComponentColumnSelector,
|
| 13 |
+
ComponentDescriptor as ComponentDescriptor,
|
| 14 |
+
IndexColumnDescriptor as IndexColumnDescriptor,
|
| 15 |
+
IndexColumnSelector as IndexColumnSelector,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
IndexValuesLike: TypeAlias = npt.NDArray[np.int_] | npt.NDArray[np.datetime64] | pa.Int64Array
|
| 19 |
+
"""
|
| 20 |
+
A type alias for index values.
|
| 21 |
+
|
| 22 |
+
This can be any numpy-compatible array of integers, or a [`pyarrow.Int64Array`][]
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
TableLike: TypeAlias = pa.Table | pa.RecordBatch | pa.RecordBatchReader
|
| 26 |
+
"""
|
| 27 |
+
A type alias for TableLike pyarrow objects.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
TemporalTimelineType: TypeAlias = Literal["duration_ns", "timestamp_ns", "duration", "timestamp"]
|
| 31 |
+
|
| 32 |
+
TimelineType: TypeAlias = TemporalTimelineType | Literal["sequence"]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class MergeSplitSettingsDict(TypedDict):
|
| 36 |
+
"""Wire form of `rerun.experimental._MergeSplitSettings`; `0` disables a row guard."""
|
| 37 |
+
|
| 38 |
+
max_bytes: int
|
| 39 |
+
max_rows: int
|
| 40 |
+
max_rows_if_unsorted: int
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class OwnChunkRuleDict(TypedDict):
|
| 44 |
+
"""
|
| 45 |
+
Wire form of `rerun.experimental._OwnChunkRule`.
|
| 46 |
+
|
| 47 |
+
Exactly one of `component_type` and `component` is set. `entity_filter` holds entity path filter
|
| 48 |
+
rules, newline-separated, or `None` for every entity.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
component_type: str | None
|
| 52 |
+
component: str | None
|
| 53 |
+
entity_filter: str | None
|
| 54 |
+
merge_split: Literal["inherit", "passthrough"] | MergeSplitSettingsDict
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class GopBatchingRuleDict(TypedDict):
|
| 58 |
+
"""
|
| 59 |
+
Wire form of `rerun.experimental._GopBatchingRule`.
|
| 60 |
+
|
| 61 |
+
`entity_filter` holds entity path filter rules, newline-separated, or `None` for every entity.
|
| 62 |
+
`keyframes` is `"inline"`, `"own_chunk"`, or an own-chunk target.
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
entity_filter: str | None
|
| 66 |
+
samples: Literal["inherit", "passthrough"] | MergeSplitSettingsDict
|
| 67 |
+
keyframes: Literal["inline", "own_chunk"] | MergeSplitSettingsDict
|
player/runtime/python/Lib/site-packages/rerun_cli/THIRD_PARTY_NOTICES.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
player/runtime/python/Lib/site-packages/rerun_cli/__init__.py
ADDED
|
File without changes
|
player/runtime/python/Lib/site-packages/rerun_cli/__main__.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""See `python3 -m rerun_cli --help`."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import os
|
| 6 |
+
import subprocess
|
| 7 |
+
import sys
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def exe_suffix() -> str:
|
| 11 |
+
if sys.platform.startswith("win"):
|
| 12 |
+
return ".exe"
|
| 13 |
+
return ""
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def add_exe_suffix(path: str) -> str:
|
| 17 |
+
if not path.endswith(exe_suffix()):
|
| 18 |
+
return path + exe_suffix()
|
| 19 |
+
return path
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def main() -> int:
|
| 23 |
+
if "RERUN_CLI_PATH" in os.environ:
|
| 24 |
+
print(f"Using overridden RERUN_CLI_PATH={os.environ['RERUN_CLI_PATH']}", file=sys.stderr)
|
| 25 |
+
target_path = os.environ["RERUN_CLI_PATH"]
|
| 26 |
+
elif sys.platform == "darwin":
|
| 27 |
+
bundled = os.path.join(os.path.dirname(__file__), "Rerun.app", "Contents", "MacOS", "Rerun")
|
| 28 |
+
bare = os.path.join(os.path.dirname(__file__), "rerun")
|
| 29 |
+
target_path = bundled if os.path.exists(bundled) else bare
|
| 30 |
+
else:
|
| 31 |
+
target_path = os.path.join(os.path.dirname(__file__), "rerun")
|
| 32 |
+
|
| 33 |
+
target_path = add_exe_suffix(target_path)
|
| 34 |
+
|
| 35 |
+
if not os.path.exists(target_path):
|
| 36 |
+
print(f"Error: Could not find rerun binary at {target_path}", file=sys.stderr)
|
| 37 |
+
return 1
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
return subprocess.call([target_path, *sys.argv[1:]])
|
| 41 |
+
except KeyboardInterrupt:
|
| 42 |
+
return 130
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
if __name__ == "__main__":
|
| 46 |
+
main()
|
player/runtime/python/Lib/site-packages/rerun_cli/rerun.exe
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:69a0c34ef7686173e35be1606ee5c5995bae16470bdd49cefc08418713fc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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: rerun-sdk
|
| 3 |
+
Version: 0.41.0
|
| 4 |
+
Classifier: Programming Language :: Rust
|
| 5 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 6 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 7 |
+
Classifier: Development Status :: 3 - Alpha
|
| 8 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
| 9 |
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
| 10 |
+
Requires-Dist: attrs>=23.1.0
|
| 11 |
+
Requires-Dist: numpy>=2
|
| 12 |
+
Requires-Dist: pillow>=8.0.0
|
| 13 |
+
Requires-Dist: psutil>=7.0
|
| 14 |
+
Requires-Dist: pyarrow>=18.0.0
|
| 15 |
+
Requires-Dist: typing-extensions>=4.5
|
| 16 |
+
Requires-Dist: datafusion==54.0.0 ; extra == 'all'
|
| 17 |
+
Requires-Dist: pandas>=2 ; extra == 'all'
|
| 18 |
+
Requires-Dist: rerun-notebook==0.41.0 ; extra == 'all'
|
| 19 |
+
Requires-Dist: datafusion==54.0.0 ; extra == 'catalog'
|
| 20 |
+
Requires-Dist: pandas>=2 ; extra == 'catalog'
|
| 21 |
+
Requires-Dist: torch>=2.5 ; extra == 'dataloader'
|
| 22 |
+
Requires-Dist: torchvision ; extra == 'dataloader'
|
| 23 |
+
Requires-Dist: av ; extra == 'dataloader'
|
| 24 |
+
Requires-Dist: pillow>=8.0.0 ; extra == 'dataloader'
|
| 25 |
+
Requires-Dist: rerun-notebook==0.41.0 ; extra == 'notebook'
|
| 26 |
+
Requires-Dist: av>=14.2.0 ; extra == 'tests'
|
| 27 |
+
Requires-Dist: inline-snapshot==0.31.1 ; extra == 'tests'
|
| 28 |
+
Requires-Dist: opencv-python>4.6 ; extra == 'tests'
|
| 29 |
+
Requires-Dist: pandas>=2 ; extra == 'tests'
|
| 30 |
+
Requires-Dist: polars==1.36.1 ; extra == 'tests'
|
| 31 |
+
Requires-Dist: pytest==9.0.3 ; extra == 'tests'
|
| 32 |
+
Requires-Dist: semver>=3.0,<3.1 ; extra == 'tests'
|
| 33 |
+
Requires-Dist: syrupy==5.0.0 ; extra == 'tests'
|
| 34 |
+
Requires-Dist: tomli==2.0.1 ; extra == 'tests'
|
| 35 |
+
Requires-Dist: torch>=2.5 ; extra == 'tests'
|
| 36 |
+
Requires-Dist: torchvision ; extra == 'tests'
|
| 37 |
+
Requires-Dist: datafusion==54.0.0 ; extra == 'tests'
|
| 38 |
+
Requires-Dist: opentelemetry-api ; extra == 'tracing'
|
| 39 |
+
Requires-Dist: opentelemetry-sdk ; extra == 'tracing'
|
| 40 |
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc ; extra == 'tracing'
|
| 41 |
+
Provides-Extra: all
|
| 42 |
+
Provides-Extra: catalog
|
| 43 |
+
Provides-Extra: dataloader
|
| 44 |
+
Provides-Extra: notebook
|
| 45 |
+
Provides-Extra: tests
|
| 46 |
+
Provides-Extra: tracing
|
| 47 |
+
License-File: LICENSE-APACHE
|
| 48 |
+
License-File: LICENSE-MIT
|
| 49 |
+
Summary: The Rerun Logging SDK
|
| 50 |
+
Keywords: computer-vision,logging,rerun
|
| 51 |
+
Author-email: "Rerun.io" <opensource@rerun.io>
|
| 52 |
+
License-Expression: MIT OR Apache-2.0
|
| 53 |
+
Requires-Python: >=3.11
|
| 54 |
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
| 55 |
+
Project-URL: documentation, https://www.rerun.io/docs
|
| 56 |
+
Project-URL: homepage, https://www.rerun.io
|
| 57 |
+
Project-URL: repository, https://github.com/rerun-io/rerun
|
| 58 |
+
|
| 59 |
+
<h3 align="center">
|
| 60 |
+
<a href="https://www.rerun.io/">
|
| 61 |
+
<img width="1000" height="200" alt="Rerun" src="https://static.rerun.io/d0f5443d4803cac65c73fcc064936c09f5e7f208_rerun_banner.png" />
|
| 62 |
+
</a>
|
| 63 |
+
</h3>
|
| 64 |
+
|
| 65 |
+
# The data layer for physical AI
|
| 66 |
+
|
| 67 |
+
The data primitives to build, understand, and improve your data loop.
|
| 68 |
+
Designed for multi-rate, multimodal data, from the first recording to massive scale.
|
| 69 |
+
|
| 70 |
+
The open source Rerun Python SDK provides a single toolchain to log, transform, query, view, and train on multi-rate, multimodal data.
|
| 71 |
+
|
| 72 |
+
## Install
|
| 73 |
+
|
| 74 |
+
```sh
|
| 75 |
+
pip install rerun-sdk
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The Python module is called `rerun`, while the package published on PyPI is `rerun-sdk`.
|
| 79 |
+
|
| 80 |
+
See [Install Rerun](https://rerun.io/docs/getting-started/install-rerun) for the Viewer and other SDK languages.
|
| 81 |
+
|
| 82 |
+
We also provide a [Jupyter widget](https://pypi.org/project/rerun-notebook/) for interactive data visualization in Jupyter notebooks:
|
| 83 |
+
```sh
|
| 84 |
+
pip install rerun-sdk[notebook]
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Example
|
| 88 |
+
|
| 89 |
+
```py
|
| 90 |
+
import numpy as np
|
| 91 |
+
import rerun as rr
|
| 92 |
+
|
| 93 |
+
rr.init("rerun_example_app", spawn=True)
|
| 94 |
+
|
| 95 |
+
positions = np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-5, 5, 10j)]]]).T
|
| 96 |
+
colors = np.vstack([rgb.ravel() for rgb in np.mgrid[3 * [slice(0, 255, 10j)]]]).astype(np.uint8).T
|
| 97 |
+
|
| 98 |
+
rr.log("points3d", rr.Points3D(positions, colors=colors))
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
<picture>
|
| 102 |
+
<img src="https://static.rerun.io/pointcloud/80cc95c74b1fbab26af9b0d3547387352f932914/full.png" alt="">
|
| 103 |
+
<source media="(max-width: 480px)" srcset="https://static.rerun.io/pointcloud/80cc95c74b1fbab26af9b0d3547387352f932914/480w.png">
|
| 104 |
+
<source media="(max-width: 768px)" srcset="https://static.rerun.io/pointcloud/80cc95c74b1fbab26af9b0d3547387352f932914/768w.png">
|
| 105 |
+
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/pointcloud/80cc95c74b1fbab26af9b0d3547387352f932914/1024w.png">
|
| 106 |
+
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/pointcloud/80cc95c74b1fbab26af9b0d3547387352f932914/1200w.png">
|
| 107 |
+
</picture>
|
| 108 |
+
|
| 109 |
+
## Resources
|
| 110 |
+
|
| 111 |
+
- [Examples](https://rerun.io/examples)
|
| 112 |
+
- [Python API reference](https://ref.rerun.io/docs/python)
|
| 113 |
+
- [Log and ingest data](https://rerun.io/docs/getting-started/data-in)
|
| 114 |
+
- [Query and transform data](https://rerun.io/docs/getting-started/data-out)
|
| 115 |
+
- [Troubleshooting](https://rerun.io/docs/getting-started/install-rerun/troubleshooting)
|
| 116 |
+
- [Discord](https://discord.com/invite/Gcm8BbTaAj)
|
| 117 |
+
|
| 118 |
+
## Logging and viewing in different processes
|
| 119 |
+
|
| 120 |
+
The Viewer and Python logger can run in separate processes.
|
| 121 |
+
Start the Viewer in one terminal:
|
| 122 |
+
|
| 123 |
+
```sh
|
| 124 |
+
python3 -m rerun
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
In a second terminal, run the example with the `--connect` option:
|
| 128 |
+
```sh
|
| 129 |
+
python3 examples/python/plots/plots.py --connect
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
Note that SDK and Viewer can run on different machines!
|
| 133 |
+
See [SDK operating modes](https://rerun.io/docs/reference/sdk/operating-modes) for connection options.
|
| 134 |
+
|
| 135 |
+
# Building Rerun from source
|
| 136 |
+
|
| 137 |
+
Rerun uses [`pixi`](https://pixi.sh/) for development tools and tasks.
|
| 138 |
+
[Install pixi](https://pixi.sh/latest/#installation), clone the repository, and run these commands from its `rerun/` directory.
|
| 139 |
+
|
| 140 |
+
Build and install a development version of the Python SDK:
|
| 141 |
+
```sh
|
| 142 |
+
pixi run py-build
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
For an optimized build, use:
|
| 146 |
+
```sh
|
| 147 |
+
pixi run py-build-release
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
Run an example in the development environment:
|
| 151 |
+
```sh
|
| 152 |
+
pixi run uvpy examples/python/minimal/minimal.py
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
Build a wheel for manual installation:
|
| 156 |
+
```sh
|
| 157 |
+
pixi run py-build-wheel
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
See [BUILD.md](../BUILD.md) for all Viewer and SDK build options.
|
| 161 |
+
|
| 162 |
+
# Installing a pre-release
|
| 163 |
+
|
| 164 |
+
Development wheels are built for every commit on the `main` branch:
|
| 165 |
+
```sh
|
| 166 |
+
uv pip install --index https://build.rerun.io/version/main/simple --reinstall-package rerun-sdk rerun-sdk # latest commit on main
|
| 167 |
+
uv pip install --index https://build.rerun.io/commit/<7-char-sha>/simple --reinstall-package rerun-sdk rerun-sdk
|
| 168 |
+
```
|
| 169 |
+
`--reinstall-package` replaces a `rerun-sdk` that is already installed, even when it has the same version.
|
| 170 |
+
The `main` branch can be unstable, so use these wheels at your own risk.
|
| 171 |
+
|
| 172 |
+
# Running Python unit tests
|
| 173 |
+
|
| 174 |
+
Run the full Python test suite:
|
| 175 |
+
|
| 176 |
+
```sh
|
| 177 |
+
pixi run py-test
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
Build the SDK and run one test file:
|
| 181 |
+
|
| 182 |
+
```sh
|
| 183 |
+
pixi run py-build && pixi run uvpy -m pytest rerun_py/tests/unit/test_tensor.py
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
# Profiling the Python SDK
|
| 187 |
+
|
| 188 |
+
Install [`puffin_viewer`](https://github.com/EmbarkStudios/puffin), then set `RERUN_PUFFIN=1` when you start a Python program:
|
| 189 |
+
|
| 190 |
+
```sh
|
| 191 |
+
cargo install puffin_viewer
|
| 192 |
+
RERUN_PUFFIN=1 pixi run uvpy your_script.py
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
Save a recording from the viewer for offline analysis (use the `investigate-puffin` skill in `.claude/skills/`).
|
| 196 |
+
|
| 197 |
+
For the Viewer side of things, and for tracking down streaming latency, see [Diagnose latency and performance](../docs/content/howto/visualization/diagnose-performance.md).
|
| 198 |
+
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,569 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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sha256=S5zyfYtITu9N7VW8vMYCHh5kKgswMbYjhlN8JLmNoNM,18876
|
| 3 |
+
rerun/__main__.py,sha256=ueEp2sXDtB9aoU3Um2qOg80kt5REwEE4ZrD-x45bpHo,658
|
| 4 |
+
rerun/_arrow.py,sha256=I3UJUGUZSbfpTBDXFlw8evXjchDEJXjz3zxp4AgPdRE,596
|
| 5 |
+
rerun/_baseclasses.py,sha256=E2Nt1XqJf9RE_EHo0W1Uo5k_oryLB0iK8DNbG85mljg,19385
|
| 6 |
+
rerun/_color_conversion.py,sha256=rgEKwCK-9HelBFkOuIqU5ZSbc2h6aq8dR9qcx_-1u0c,2814
|
| 7 |
+
rerun/_converters.py,sha256=jisuyVImRH8I7Cz6k_YnZushe45slyU_7U4SvDLtW3w,4325
|
| 8 |
+
rerun/_event.py,sha256=xtVWPC7OnsuPn-6xywtqsRMOdAs0cemps3GTmbPx1h0,6699
|
| 9 |
+
rerun/_legacy_notebook.py,sha256=m1J0zB1g-Nxgeo8JEjCuA70CXTcce1aLlIUTDNDfQp0,6520
|
| 10 |
+
rerun/_loading_widget.css,sha256=vQz0a7LYQMCItlQuGu20TnqxH0OthBQbYVsV2JocEms,665
|
| 11 |
+
rerun/_log.py,sha256=N1oYXcpJZV9WY5-NEEUwNsQivQ57jQuR93GAEICji9w,12989
|
| 12 |
+
rerun/_logging_handler.py,sha256=kGPiIgXeqvLyheFS9p1mNzcJD6YaLqsr3mwqN3cwyIU,1590
|
| 13 |
+
rerun/_memory.py,sha256=vypT1gFROCz7RzuFeJxlAV59D11SMQKjl8wmcLKY4SY,1860
|
| 14 |
+
rerun/_numpy_compatibility.py,sha256=wnMcvODKrA6pJsYHtOdjfXSgOM9OJhRjKAgRnRqf57k,856
|
| 15 |
+
rerun/_properties.py,sha256=Hb3S1Y7H4ssyvpjmXAbmEb6hlZNYc7BjCU8DvOhqi74,3763
|
| 16 |
+
rerun/_script_helpers.py,sha256=50Ygjk78beSk21LYIp3kyNLzFHZlz2zK1JM-PVrg4N8,4440
|
| 17 |
+
rerun/_send_chunks.py,sha256=b6NLDxB9YzZxSJ9rBbnLhH7ca0W6QW5nd7DrE495gRs,2499
|
| 18 |
+
rerun/_send_columns.py,sha256=jsI44fzhHKydqpdSkUryTWDOgag0Nd-7fTpeNyTzcwk,9444
|
| 19 |
+
rerun/_send_dataframe.py,sha256=-5Lskk6AlcxpTxtXo_95CrSF4xyULaBb5RQGDbaFlVM,4470
|
| 20 |
+
rerun/_spawn.py,sha256=r-Zw0XPzrvNr4BAFt3Gg-0RcLiZ80HqNNFEa6Kingg0,2790
|
| 21 |
+
rerun/_tracing.py,sha256=v53t9y1B9cdnkJ8z2Pv66cUk5NuV0JiLfVGtNEj0MvY,7573
|
| 22 |
+
rerun/_tracing_session.py,sha256=Wq1CxFP6MgKNOaX35E0yZUyPHoOt15PF3Tm_DUZwcx4,8235
|
| 23 |
+
rerun/_unions.py,sha256=eVp72cfXRtdP0vdsMFWRAQqY5EOrTqrPlI3swlhTGlg,1321
|
| 24 |
+
rerun/_validators.py,sha256=tN96xmQUori-da29kgRzXGy1OraKsd_Qb3FUES65N-0,4595
|
| 25 |
+
rerun/any_batch_value.py,sha256=H0UtBI8vCwCddyKP8cr817TrnI9k6OXlAtimqoWVaa4,14153
|
| 26 |
+
rerun/any_value.py,sha256=HaE9UJ4CDypaD048AwEG8l9OkBcQj1pPMBAhW3j7bkc,6894
|
| 27 |
+
rerun/archetypes/.gitattributes,sha256=FwIj0JXK_PhkITlVOawsCAi-5lr1Jeo0sHory_xjr5E,2294
|
| 28 |
+
rerun/archetypes/__init__.py,sha256=8sNTB4vzcYCF5hvCWKBZOfC9MrlrfB8Vr58OdS2pP1Y,3193
|
| 29 |
+
rerun/archetypes/annotation_context.py,sha256=arwWFwYudNUlHvCPXeemlx2ZtkHybNjtOgIqcSK0w_I,8675
|
| 30 |
+
rerun/archetypes/arrows2d.py,sha256=0RgZgO1bWpLggE2z-3BbVQcrIKRUOuDNnp3fi7REKtk,17224
|
| 31 |
+
rerun/archetypes/arrows2d_ext.py,sha256=N1yo19OyaDko5707lNViUznD-eorRtZaEHVyHvMCDdA,2510
|
| 32 |
+
rerun/archetypes/arrows3d.py,sha256=mv2tLqqRzNlwPXRvp_lKFwDWw3STXh7LchLNRGMSzpo,16055
|
| 33 |
+
rerun/archetypes/arrows3d_ext.py,sha256=Yf0PotZp5u-2UtkgzOwIVE-CYRVN8-7pB7qiU_f7hHw,2213
|
| 34 |
+
rerun/archetypes/asset3d.py,sha256=se5EpfDDb-DvkZFh_G3XRYdr641PMdssUy67y84rlKM,12036
|
| 35 |
+
rerun/archetypes/asset3d_ext.py,sha256=qppRuVFl5CW7nSiiHM4E-K5_yJw7ZO8EOXKsyuQ-uOI,2112
|
| 36 |
+
rerun/archetypes/asset_audio.py,sha256=o5nB6gClA33LuKMPqUYdpGKxo96qr5YaOvucuFaeGDQ,9735
|
| 37 |
+
rerun/archetypes/asset_audio_ext.py,sha256=15ZXZqFgT758H1m3FXPKQqk925MkXkjvlOYWXfaWEGA,1912
|
| 38 |
+
rerun/archetypes/asset_video.py,sha256=Q-cMZ_RQ2j9beRjBJAJffuGCEIsjePDV7kLnz_Dn0oU,11070
|
| 39 |
+
rerun/archetypes/asset_video_ext.py,sha256=VdScObotzHS7o4prgngfk1-LnUy-84lt77OV_OIMrOE,2604
|
| 40 |
+
rerun/archetypes/bar_chart.py,sha256=hbXvV824vqMaRbhfCYaY959bvB7mpt9ztJWZhXR7Fa8,12662
|
| 41 |
+
rerun/archetypes/bar_chart_ext.py,sha256=tZvdJXlFsE6YDkX7gqKCwcNS_xE1LTi_e0EKcj2MDd4,1255
|
| 42 |
+
rerun/archetypes/boxes2d.py,sha256=6t556KG8Wwz8unnRU_1SohVGiqbmFdSu2XEQhc3qMgs,16442
|
| 43 |
+
rerun/archetypes/boxes2d_ext.py,sha256=Z5rnR4FpYq0hEGnvdJOVto4VQonb16WTZtdhylnhwxI,6854
|
| 44 |
+
rerun/archetypes/boxes3d.py,sha256=6AQ1YqXppXkT-Fu_iSCwij2fAu-PB6hv4ylRvbsEHwE,20220
|
| 45 |
+
rerun/archetypes/boxes3d_ext.py,sha256=qhjL_6jwYhkO-UoqnW8__mogwBQIJpBM249yKiQKm6c,5808
|
| 46 |
+
rerun/archetypes/capsules3d.py,sha256=eEGZ8Tcd7QRUBC0G8Qn2qFjSbJXQD65V2N-st1Cq_M8,21524
|
| 47 |
+
rerun/archetypes/capsules3d_ext.py,sha256=Y6c_R-9OQrLDSDP_pXrWkadRsGMX4cqEyU2desfsZeg,2938
|
| 48 |
+
rerun/archetypes/clear.py,sha256=5VhG-JRBPiowYLFy-Qyf-ObCraLwZ_jLCWnbbXTgqzs,7522
|
| 49 |
+
rerun/archetypes/clear_ext.py,sha256=KouSwTIlZrccm3fnpgBlhpKzluwLwk-mBmxUrYOhk8A,1272
|
| 50 |
+
rerun/archetypes/coordinate_frame.py,sha256=ubdZhBfiKVpec2WgdzGa05zfAbtqqMF0FYOYfI3KChY,9004
|
| 51 |
+
rerun/archetypes/cylinders3d.py,sha256=chQmen1xVAEeSQ17AqQnwdZLa18QC73odzoO3z376tY,21373
|
| 52 |
+
rerun/archetypes/cylinders3d_ext.py,sha256=KGtz3WH-7UCpRFXBEKe_Y56YClSzVa1O0bZnVHH72o8,2901
|
| 53 |
+
rerun/archetypes/depth_image.py,sha256=FSW9R0aRJ4IVGeLB6670O96fQwhnpeBPhlB1a0ldVyU,21985
|
| 54 |
+
rerun/archetypes/depth_image_ext.py,sha256=VC1G3cSJZF6Dr5ubSekZUJvQC0I3hcVCZdLprCVu_O4,8610
|
| 55 |
+
rerun/archetypes/ellipses2d.py,sha256=Z8WDpwGVFJuDiXTaBujLi34gDEhe0M1qtJQjd-xSCZY,16682
|
| 56 |
+
rerun/archetypes/ellipses2d_ext.py,sha256=cGXvKxTQv_jFJvevj17C35yoZar6IHbd42rpa8VPFWE,2258
|
| 57 |
+
rerun/archetypes/ellipsoids3d.py,sha256=waj-aYZ_pqYbDyP8MOZxl-3j6SZdddlTKXfq-mcNeEQ,20438
|
| 58 |
+
rerun/archetypes/ellipsoids3d_ext.py,sha256=Eh8PSrvBXGmTeZb86gZBLgUUVa3yrPgFxk6tkiyvQMM,3426
|
| 59 |
+
rerun/archetypes/encoded_depth_image.py,sha256=53K-vKzY2RwN_oxLbS5LOB3qCp2N6Ttjf0zmMChikRE,20722
|
| 60 |
+
rerun/archetypes/encoded_image.py,sha256=S3gOGjbgdYW9nR3mNRu452qssVMgtiFrLTs1kDZ7QKU,13695
|
| 61 |
+
rerun/archetypes/encoded_image_ext.py,sha256=ghr59EIxn6ro97SnM6OckmlUuiRPNkSwZ07FbtrFboA,3353
|
| 62 |
+
rerun/archetypes/gaussian_splats3d.py,sha256=eb1fXpgn87NK66LdCYY0jMctnJVmj0ZCuHCKzp1oBuo,17567
|
| 63 |
+
rerun/archetypes/geo_line_strings.py,sha256=oirV4LK5xernI_dywGaIb5IJNAefq9W6J4bXp-ve2QY,12088
|
| 64 |
+
rerun/archetypes/geo_line_strings_ext.py,sha256=1EVrQyvSj7sd4hPXf6IxRmPwCWyrKg3G-rHuF-ZFlp4,1670
|
| 65 |
+
rerun/archetypes/geo_points.py,sha256=J_elcjDxzYDbRY5O0doL-mGb282M7sHytaJN6G9R45o,12015
|
| 66 |
+
rerun/archetypes/geo_points_ext.py,sha256=KUpi6vf5idEDKrhuyLx7DPlNKHzBdLy8SqQB67Nmyi0,1817
|
| 67 |
+
rerun/archetypes/graph_edges.py,sha256=NKyZqUrDYerok5uICYlqBjk-wlzujeZV6JkiDaM6lzk,9977
|
| 68 |
+
rerun/archetypes/graph_nodes.py,sha256=WYp5zPEzLWe3sA1Alm7d9wdt8ul7XuJVThny7T564Do,14723
|
| 69 |
+
rerun/archetypes/grid_map.py,sha256=USGeyay8XKSqCLQz-Sug1vdYs8KND5adEv75E_nk2F8,25879
|
| 70 |
+
rerun/archetypes/image.py,sha256=gZxMeBDTWLGK_yvicTO_7tvwPqPpBrIUvcUTvqQvZEs,15274
|
| 71 |
+
rerun/archetypes/image_ext.py,sha256=vk2WweJMQf3i7QMmAQQMbzdcAb9s_v9HYcz_22fr8Sw,13615
|
| 72 |
+
rerun/archetypes/instance_poses3d.py,sha256=7kfn8pss5mURH9pExpFNGKrAgbXCvoeuTByLLomBfQU,14576
|
| 73 |
+
rerun/archetypes/line_strips2d.py,sha256=zAXx3AV3iVFAJqRzhY5RcuZ1U_T46FCkEu_Uab7K648,19620
|
| 74 |
+
rerun/archetypes/line_strips3d.py,sha256=k3Quls8oNZV5G_5TYV2aAINf1gJQa_qJhvgfNG371A0,20671
|
| 75 |
+
rerun/archetypes/mcap_channel.py,sha256=mGFBhcYn0SSClhenvln4ai9VNHL8pWCHJCa-spmOlGY,14088
|
| 76 |
+
rerun/archetypes/mcap_message.py,sha256=ferqH54d4SJNwO0PL_ff9IX5E98a3mRUuHEaXkjgZlU,8351
|
| 77 |
+
rerun/archetypes/mcap_schema.py,sha256=mwcVAMPJN_nrT8YtcNcizyRxd540z4BQwC_kDmIjROg,15315
|
| 78 |
+
rerun/archetypes/mcap_statistics.py,sha256=hbsZq91wqi9G2Ln-hVDWMQgYCTLclsFl8YUFJooUPtk,21705
|
| 79 |
+
rerun/archetypes/measurements.py,sha256=wXjbJK88h1cNj-NKfrnNVQawtC9cfyEtVFXs1UN7ZPk,24115
|
| 80 |
+
rerun/archetypes/mesh3d.py,sha256=-pGINHfGFlBw31P9fLp0yuX6LxEKjS9GNDM1KqdS6sw,24296
|
| 81 |
+
rerun/archetypes/mesh3d_ext.py,sha256=zctnY_kIPNgU4Tfuay_xf8iFbWN-KlIxxko5hmn8WWQ,5310
|
| 82 |
+
rerun/archetypes/pinhole.py,sha256=docfUBVqLfufOQf5SgrU9tI0mCkcu8YuVRtci4d0GIU,27504
|
| 83 |
+
rerun/archetypes/pinhole_ext.py,sha256=-Cka4HYhkCY32VkJpbkUKCKEcR4-5hxZexA4L3CvbqI,9691
|
| 84 |
+
rerun/archetypes/points2d.py,sha256=k7R1BPqYYvDBhEvd-3DO8WAWcZ4B_T21lNNyLcMIFJk,20811
|
| 85 |
+
rerun/archetypes/points2d_ext.py,sha256=h3GGOcuv6BGNdIO2vkHOwrS4HYZwD8poAMqaOcapvbg,2848
|
| 86 |
+
rerun/archetypes/points3d.py,sha256=vD3FAuRMXWFkesdaimg8v0NmOTFXmYWFTUvqyc1JOoE,24832
|
| 87 |
+
rerun/archetypes/points3d_ext.py,sha256=QYz5KtyCCVo3DNUrRkCIDTLGoFvhd8HwXYkezq_LX0g,2782
|
| 88 |
+
rerun/archetypes/recording_info.py,sha256=Of8u0289QHz32DjB-4t1yQDaGIYvKxlHX28DsTAZDYE,7659
|
| 89 |
+
rerun/archetypes/scalars.py,sha256=BPT82M5EZ5BSa5vSc1_mIMM0u0d5ITpIBkpYuEhS-Mw,9429
|
| 90 |
+
rerun/archetypes/segmentation_image.py,sha256=bQ69LsFmHq_sGy9R98QyDoR0Orvr3NfsJ42lDGGJmJA,12428
|
| 91 |
+
rerun/archetypes/segmentation_image_ext.py,sha256=P6u2kTF_qtEzE8b0CHIv4rR9FB7Kym5iyReI8ZTwi18,2175
|
| 92 |
+
rerun/archetypes/series_lines.py,sha256=Bb9pw1pjPMJRbe309qePMjjsuczFMszbkMQSsiaM37g,19678
|
| 93 |
+
rerun/archetypes/series_points.py,sha256=dE5Mif-HfMSEN3CdUTjruRIOZbHB49CYS_8x_IQypOE,14471
|
| 94 |
+
rerun/archetypes/series_points_ext.py,sha256=i67tao5Lg_pA1E09FcDhHRvkAR9Gnc_iU7__IUX6XEU,2610
|
| 95 |
+
rerun/archetypes/state_change.py,sha256=kcGxBn6WNS3zZzp_yznuO3FxW-kehMa7dx4p6Y4cmN0,10100
|
| 96 |
+
rerun/archetypes/state_configuration.py,sha256=vleIJyJXUMY1SX8U7xeYBgRqDPfsn5qkxdDwGB442Q8,14885
|
| 97 |
+
rerun/archetypes/tensor.py,sha256=OCnD7IiobuWjr5F_2jzaiCGEqkAFwv8Yh_57GgQeJTc,10899
|
| 98 |
+
rerun/archetypes/tensor_ext.py,sha256=zC5bfG7bWf0RIg6I2d-6do3iBHZ9fGjmRNPcrLxQgls,2015
|
| 99 |
+
rerun/archetypes/text_document.py,sha256=Lh-S7ImOrsVt5ttuHiWalJcWRbbJX00HEBcXDlzrVM0,10921
|
| 100 |
+
rerun/archetypes/text_log.py,sha256=J4SOMhSXzu8_6lOsR7REynGsy2rlLJSxwjofhEkZVi8,10791
|
| 101 |
+
rerun/archetypes/transform3d.py,sha256=ExFA_JQIVl1dTaEkMKMIyJU9trwlKqtdmcYfpeGjUmI,28945
|
| 102 |
+
rerun/archetypes/transform3d_ext.py,sha256=xAoJb-1GrSJoco06EBrAp1kdjY-41l6g5_bc3Klxqbg,7279
|
| 103 |
+
rerun/archetypes/transform_axes3d.py,sha256=zQiO64neqQvfKtsd8BSpg39SLF2Yxpb-PG8cLRCdUVA,10895
|
| 104 |
+
rerun/archetypes/video_frame_reference.py,sha256=eCLonQd8M_KZ_P_io1inSrK3NTpR9qlJuJKUake2BcE,18195
|
| 105 |
+
rerun/archetypes/video_frame_reference_ext.py,sha256=t8DPEq4_4osLouZxZGhBVNxaxHkvleO1R3rVWofhAdY,5061
|
| 106 |
+
rerun/archetypes/video_stream.py,sha256=gpWRZaoaP-h2Xd8YIelLZyTvOJMCs03p4A5YTxIgrxQ,26140
|
| 107 |
+
rerun/archetypes/view_coordinates.py,sha256=VxDctFnT5v7MTuZRnTFPwTYg6xMkHWHQJZEYryas6GE,8498
|
| 108 |
+
rerun/archetypes/view_coordinates_ext.py,sha256=PHpfAqnlxIQuUY_e47ogdYzMYs4QXuFHzFZsBdQnsRE,5263
|
| 109 |
+
rerun/archetypes/volume3d.py,sha256=AIs52cHI3odXU8mGAgvJsXdfO7n8AhhUge31VuN6weE,25012
|
| 110 |
+
rerun/archetypes/voxel_grid_map.py,sha256=QrhLYeINcax7EVfdA19IVwkvPabjoAYP5t61QnllxuE,25749
|
| 111 |
+
rerun/auth.py,sha256=R-BTRRGLhIdH_wX0qTSzX539WYxMGr5aZpFWN5dE878,1325
|
| 112 |
+
rerun/blueprint/.gitattributes,sha256=2BIHGgzLcliAx-n8nJHu0S7cp6kqd2lAy9qFJwyIC2c,161
|
| 113 |
+
rerun/blueprint/__init__.py,sha256=NZHhkMbvIHTW7B1nKvAxm86-MmDIlAZLJmHpQ-U8rNU,2545
|
| 114 |
+
rerun/blueprint/_table_cells.py,sha256=3H1WdpxCjp6fEYGZWqBp-6snN1j2S4wY6NlTaXHOMEM,800
|
| 115 |
+
rerun/blueprint/_table_filters.py,sha256=6h_UZ-fOG6Vtz4ymcYKiOsQGJcD8vhlFi5yRgTcO52Y,17603
|
| 116 |
+
rerun/blueprint/api.py,sha256=RbkFQ-QZ1l-HU7Z5muIDdMIR5djQS0DJ8yPNpJndpn0,32154
|
| 117 |
+
rerun/blueprint/archetypes/.gitattributes,sha256=x2MJR4yhOKK3GSYmKO3yDuCn4wFuFgnZr10FR-ujJDg,2056
|
| 118 |
+
rerun/blueprint/archetypes/__init__.py,sha256=3UVr8lhaRnQqn8PBYygtEfxo5iZYHAg4Elh4DLpCUjo,3053
|
| 119 |
+
rerun/blueprint/archetypes/active_visualizers.py,sha256=4HDpzrdp7oXvn8d9r4Q2NdVz47vxjN1Dp4YqQTryUqY,4291
|
| 120 |
+
rerun/blueprint/archetypes/audio_playback.py,sha256=8j5_7OKzh4smJH0DK5Sb3rLurePosN7cuXEBpbjyuhw,3837
|
| 121 |
+
rerun/blueprint/archetypes/background.py,sha256=6Dx2leNVWFyLUsHPtgqngNMcZ0nPazSHxCIdNpsa15o,3965
|
| 122 |
+
rerun/blueprint/archetypes/background_ext.py,sha256=qKvl_ABxFza_ou3xP9GYmMap49i95ZDeV69qPT5KmsM,1980
|
| 123 |
+
rerun/blueprint/archetypes/card_layout.py,sha256=dj1LA3QkAlGAEeH3T5QCctl7UwlHgsB4m5KMKe4G1lM,7518
|
| 124 |
+
rerun/blueprint/archetypes/container_blueprint.py,sha256=ILLW7IlGAGnU75oClZK9DNPAzbyjqw_YEtjtATRX9Co,14000
|
| 125 |
+
rerun/blueprint/archetypes/dataframe_query.py,sha256=-vwoguu8d67a-W7VpaBwIRY14GcgbCzVeeF1aV72sC8,10321
|
| 126 |
+
rerun/blueprint/archetypes/dataframe_query_ext.py,sha256=C8X3ikWG07KNKTWs6ioiZIoPzpzciQ8PUjE_XuPx94Q,2825
|
| 127 |
+
rerun/blueprint/archetypes/entity_behavior.py,sha256=LybWBhHAoznblrWoTiIx9aSVdGZsIJ350P6ChIQi4Wk,8131
|
| 128 |
+
rerun/blueprint/archetypes/eye_controls3d.py,sha256=QLZuzmbGUCK_ukKFJNf-ziPiTVnonhrrDVrST0sA3iQ,12220
|
| 129 |
+
rerun/blueprint/archetypes/force_center.py,sha256=gcPHoRpuNqDCVP-1CJI-vujif2cHvPtLV5kaBXY2Df4,4935
|
| 130 |
+
rerun/blueprint/archetypes/force_collision_radius.py,sha256=omLg1Hk-1dB6QNIR6j-Br0glwce0QX5e5lOscoWCqw4,6653
|
| 131 |
+
rerun/blueprint/archetypes/force_link.py,sha256=pU9P2IdDUz0-r6mtKW_08PfB69vjO94yk1qq-whCDPM,6438
|
| 132 |
+
rerun/blueprint/archetypes/force_many_body.py,sha256=iQu-Urz1Y6U4ftTVWSxGh2qVb8aa7eAgR_GQlw1eNnA,5851
|
| 133 |
+
rerun/blueprint/archetypes/force_position.py,sha256=XDlE8Qs-xjZDgGiNmIHyeu1XmoOMIwm_ZMliLpOt8bE,5959
|
| 134 |
+
rerun/blueprint/archetypes/graph_background.py,sha256=arxO_hwQ8NgPtjs_V6ggo7BrN4f9QdSil9RgxmvTrdY,3596
|
| 135 |
+
rerun/blueprint/archetypes/line_grid3d.py,sha256=HuPjhB_tpyh3Y72smmm0yzVAzLLWmM6e3xbQPS2lg0U,7287
|
| 136 |
+
rerun/blueprint/archetypes/line_grid3d_ext.py,sha256=ddp0zk_1P8bDsIx9iJfa2s3VMir6H6G98JVTuRIUzIQ,1914
|
| 137 |
+
rerun/blueprint/archetypes/map_background.py,sha256=TGHCb_iE-LwrmejGESVSVGWJmj6ubQlvnjWXPAtTS8g,4013
|
| 138 |
+
rerun/blueprint/archetypes/map_zoom.py,sha256=1wad8DfVFbmRDlPi0_5tuSQ9pAO38u-Gxp9c7_fdcgY,3882
|
| 139 |
+
rerun/blueprint/archetypes/near_clip_plane.py,sha256=6AeBFNr_7Uno3Qb9MzGlKD_yt-cyRAM-Mt3rEEuSKBA,4135
|
| 140 |
+
rerun/blueprint/archetypes/panel_blueprint.py,sha256=8irUaNQ4JRFIXiP79s8arsC9M0zfDouH9-N83FRgv0Y,3669
|
| 141 |
+
rerun/blueprint/archetypes/plot_background.py,sha256=zNw8EvT_Zy7Y4LWATrRFUTipOquBstCEjHUHDI-JQs4,4570
|
| 142 |
+
rerun/blueprint/archetypes/plot_interaction.py,sha256=dSYTsKaKNJSh5hLv9bZ4PBtIJvBJbFwWvKAQ520Q_jI,5012
|
| 143 |
+
rerun/blueprint/archetypes/plot_legend.py,sha256=gOaCJSYAuzQNdMik9rLIfKyWUXHSTiNVqARvuKJQyGk,4135
|
| 144 |
+
rerun/blueprint/archetypes/plot_legend_ext.py,sha256=rRQ3pV87Gxv5WlS4Jt7LGLPSIYH-sDb71e6eyMnlXrI,1048
|
| 145 |
+
rerun/blueprint/archetypes/previews_config.py,sha256=wlLFnBJEt8r38ChiekImzu9jaYzYjrBWkoWVw4VGtyY,8187
|
| 146 |
+
rerun/blueprint/archetypes/scalar_axis.py,sha256=0g0hA5Mt7N-oBJCHpJKEkaqE3EuiRm4lgmiWdzTs58M,4977
|
| 147 |
+
rerun/blueprint/archetypes/spatial_information.py,sha256=bh9p1pjrje5zP8HtVOS6Kt1VZU1Qlz3x1mDPG-g_W7Y,9923
|
| 148 |
+
rerun/blueprint/archetypes/table_blueprint.py,sha256=9Q0mWHk4HD65kaFitftWOzJ7CjaG1MaJ_A8Z3NnioxI,15105
|
| 149 |
+
rerun/blueprint/archetypes/table_column.py,sha256=GjI7m4ifDqrW3pD_EH0mss0i-4wy14zakJ5OTQXYVcY,9368
|
| 150 |
+
rerun/blueprint/archetypes/table_column_preview.py,sha256=qi6ov86BNoQLh3ea8UZ-Yc9yElH4ob6pFwCl2X6Vrgs,5348
|
| 151 |
+
rerun/blueprint/archetypes/table_layout.py,sha256=qn5_KFU4q90nHzoPlXqQooHbr23PnQbjvgekt85H5M0,4411
|
| 152 |
+
rerun/blueprint/archetypes/tensor_scalar_mapping.py,sha256=ajnOV4Ir4HW6u5HsHNsUzNXDRDIg6NezWRiHlE4alEs,7095
|
| 153 |
+
rerun/blueprint/archetypes/tensor_slice_selection.py,sha256=0jdMvKe7Re8H4CIwN_1z0k2XJVmr5JdF6JLH75blxQA,8886
|
| 154 |
+
rerun/blueprint/archetypes/tensor_view_fit.py,sha256=T9tEku_fJe3GmZjjTkckEjhOwT9Xs6dZ4K2gG1njJzo,3266
|
| 155 |
+
rerun/blueprint/archetypes/tensor_view_fit_ext.py,sha256=tKAO8ZbOjnNOKmbAz0TjAP5rPvKO3IFQSHL6G_S4T9U,772
|
| 156 |
+
rerun/blueprint/archetypes/text_document_format.py,sha256=Z31sDQrnVRq_XsyDVH6JHyDbLLXhlL8noZwUi2Ub_lU,5203
|
| 157 |
+
rerun/blueprint/archetypes/text_log_columns.py,sha256=ANwo0iArcTk4X6Y26QrHYjGmKh4YkvB5PwUWS7vARYk,5425
|
| 158 |
+
rerun/blueprint/archetypes/text_log_format.py,sha256=BnS3_9RX5geeJ5V81TLqyxOiq2leeRbxOke48Y1S6kk,3998
|
| 159 |
+
rerun/blueprint/archetypes/text_log_rows.py,sha256=DkX0fd_UezErqopHhc3MciP1n_ka8bwyAXX_QFl5fHI,3852
|
| 160 |
+
rerun/blueprint/archetypes/time_axis.py,sha256=r72jR7GqeUu9nBfcTaXfCuCJKHAYROKvoh948kATy8s,6242
|
| 161 |
+
rerun/blueprint/archetypes/time_panel_blueprint.py,sha256=prDW73kYQDq8HOVPPOSOll9vKkG2GNGQLP_bVDm5YEc,10582
|
| 162 |
+
rerun/blueprint/archetypes/view_blueprint.py,sha256=Hr2IryOKC6xGBM_qmXg_rV2KJXM8JlzstGx9tVIrAjQ,9686
|
| 163 |
+
rerun/blueprint/archetypes/view_contents.py,sha256=8xZ-hr5g44mBAGYsWaD0TrFjXcFZTIH9k22W-l8rc6E,5450
|
| 164 |
+
rerun/blueprint/archetypes/viewport_blueprint.py,sha256=gR6gA1uri5867CA9MUjRehsLNJxkaFfqMDHBYnXC2hM,10808
|
| 165 |
+
rerun/blueprint/archetypes/visible_time_ranges.py,sha256=Yek9MdBXi9LrRTPKV3tX8c0ji6rCZ0LUEhvZ2bEzmxA,4174
|
| 166 |
+
rerun/blueprint/archetypes/visible_time_ranges_ext.py,sha256=YbpnY6FSS4JPYmpPZw1kvyJzMiUhwBH3LtrP_LNuMCA,3287
|
| 167 |
+
rerun/blueprint/archetypes/visual_bounds2d.py,sha256=MJeYMsLyJjBsHM6aajsUDYqSTsMzNutN84tm1r04EEE,3741
|
| 168 |
+
rerun/blueprint/archetypes/visual_bounds2d_ext.py,sha256=SKZpw4yF3P2nx6R6MvmfzaKN7dEWfdB5ChM0rt1-Lpo,1359
|
| 169 |
+
rerun/blueprint/archetypes/visualizer_instruction.py,sha256=l04MHODuPZkTbVkthJ81CtXcotYwurgKcoC9GgSLabs,5125
|
| 170 |
+
rerun/blueprint/components/.gitattributes,sha256=bmzXZj7urzbKf79ZIQWRmN22HUS0z_ru8a2b6y_74H8,2832
|
| 171 |
+
rerun/blueprint/components/__init__.py,sha256=A9zevVdoOBeWAQ7eLwlYucc_sU66JnuTwaIEByuixLA,8372
|
| 172 |
+
rerun/blueprint/components/absolute_time_range.py,sha256=fdFqvx2cNdusT-8FOtUW4JktpooYKUS--D3K63KnHvI,1317
|
| 173 |
+
rerun/blueprint/components/active_tab.py,sha256=zhrrSDc33CyiqhI_RIG5XRn2YPJkPIO2Xfbrtpy4F0Y,1195
|
| 174 |
+
rerun/blueprint/components/angular_speed.py,sha256=TLdtxD35WBGvsfSUQxBuCHYaFf4qgYrf96vtVBdqWbI,1239
|
| 175 |
+
rerun/blueprint/components/apply_latest_at.py,sha256=DLEbUVOw4cZDh8ALlbO8ADaNi96n_Lk5fkt5-5ynyV0,1270
|
| 176 |
+
rerun/blueprint/components/auto_layout.py,sha256=m2UFPnC1sUfr9EP7U4hOxezFz4JrOK0Fnjvq8u1-uUw,1209
|
| 177 |
+
rerun/blueprint/components/auto_scroll.py,sha256=FUR78qK9-VKNdjUrj8-DmQGCC6bvC9z3r2kLxT8qNsc,1215
|
| 178 |
+
rerun/blueprint/components/auto_views.py,sha256=gJzVfr7Cpw0uiHx6LQb_hXhQvuuw5Kq3h_VyjTjW_Y0,1193
|
| 179 |
+
rerun/blueprint/components/background_kind.py,sha256=z4ocHbAO6Fulmt5WSyfuauH0FJXz7u1X0Q7C-9fOV8k,2791
|
| 180 |
+
rerun/blueprint/components/column_display_mode.py,sha256=OdtyuNofSpZheeAuxrAuNlbiSyc_OGrPrWdJFXQEg8w,3268
|
| 181 |
+
rerun/blueprint/components/column_name.py,sha256=G2Lx_5BWn5DPaP89y2QuzVWgYzGw_3uBpYiFyn7PdN0,1359
|
| 182 |
+
rerun/blueprint/components/column_order.py,sha256=49ClHKuDmTu25u5XARzuENi3Q8ka86XKKzdbFoAk_ZM,2600
|
| 183 |
+
rerun/blueprint/components/column_order_ext.py,sha256=CGTviWN177iv_TLvSkOThnxp9Ez9QYrFX_gJnEm3VzI,1075
|
| 184 |
+
rerun/blueprint/components/column_share.py,sha256=HGUnpkNQr7Vxe0qCBdUgYG00mV8d5MW97FbMcVv0QkA,1221
|
| 185 |
+
rerun/blueprint/components/column_type.py,sha256=aAyKXLStmJVKiw6cMXCGf4f0VGTLDUyP8O0Rnak2Q2w,1284
|
| 186 |
+
rerun/blueprint/components/component_column_selector.py,sha256=nbpIgWt_QEsxNHQMeKRsHUKXvnTCylhFrof7kSYOwK8,1499
|
| 187 |
+
rerun/blueprint/components/container_kind.py,sha256=S741hAdyQRnaHE0ikJ5ZWWuLAl7gpYwl6lebBFwHv6w,2676
|
| 188 |
+
rerun/blueprint/components/corner2d.py,sha256=CmiiPEj5HQpBAD4S7oyEfKfD5B-0vkw6x5lKvCnLdoc,2556
|
| 189 |
+
rerun/blueprint/components/editable.py,sha256=kuJQfR8pZlhRK9CPGEZEIDHvU4BO46b8CGa-mbB8yPg,1170
|
| 190 |
+
rerun/blueprint/components/enabled.py,sha256=mute84uM7Adhzm72NBHlca1b3vPIuZ29DWZhEP-BSoQ,1142
|
| 191 |
+
rerun/blueprint/components/eye3d_kind.py,sha256=JvnNi1CDwl585DAREVhg4LL2Ep4V4_JK0MwD2Hgfi2w,3018
|
| 192 |
+
rerun/blueprint/components/filter_by_range.py,sha256=5ocWUAae2z8_f5acryhH--yIdPDJ6j8mYKl5ahSElsA,1340
|
| 193 |
+
rerun/blueprint/components/filter_is_not_null.py,sha256=YTWkHQkp_Nu6m-jflhg_9nRSwElTgi4ou0XLtlLNd8o,1380
|
| 194 |
+
rerun/blueprint/components/force_distance.py,sha256=ScbvrISbWrpcsJ9ufdn9eDWo3CZXLymcOwihE9RQTNU,1322
|
| 195 |
+
rerun/blueprint/components/force_iterations.py,sha256=miHyHbaQGyS2GN0BDMVvhXTdEcB0GQstFjq_28Vv1CY,1385
|
| 196 |
+
rerun/blueprint/components/force_strength.py,sha256=hMzvSuKMpbX3xvifEQ9p7_HNoVw3uv4U6eXUxor8n-M,1330
|
| 197 |
+
rerun/blueprint/components/fps.py,sha256=XQVXQL3lsw8jf0fWd-b74fdAFcMNR82J0zb2asS7svE,1110
|
| 198 |
+
rerun/blueprint/components/grid_columns.py,sha256=B919t2TLlIy2eggULv7Oz1zJjInhGP1-DaqfKud_fnM,1218
|
| 199 |
+
rerun/blueprint/components/grid_spacing.py,sha256=BOgLDjpnG9KPB8Efa0PfPYfaFrKEP59tY7BRzrHt-vw,1239
|
| 200 |
+
rerun/blueprint/components/included_content.py,sha256=hpsS6BimrXhAadVogiY-DeU73uyhF-mgPpkr8OibjVE,1270
|
| 201 |
+
rerun/blueprint/components/link_axis.py,sha256=g1VBhphnZujZ0FdXZFzVA4syov6836PqGfVNxdytL9Y,2455
|
| 202 |
+
rerun/blueprint/components/lock_range_during_zoom.py,sha256=Sl2g-V3-NuquMaxO7tTIT_zRXwVQ6_-PHcVvQIRlJ7s,1417
|
| 203 |
+
rerun/blueprint/components/loop_mode.py,sha256=8-5Zkj6wvDnPG1bpBrHa2-yQU2Cui-lTC_Kyo6_umMw,2464
|
| 204 |
+
rerun/blueprint/components/map_provider.py,sha256=pnCFIshRq5QuC3qrvAkA1GiC2xCUZOH16eUPBtAXGPw,3156
|
| 205 |
+
rerun/blueprint/components/near_clip_plane.py,sha256=sRi6FmaCywKYKxXZqDvfkgpIZ5wQc60BFH9XUA91lNY,1261
|
| 206 |
+
rerun/blueprint/components/panel_state.py,sha256=PI_Kf8VdqzxUKMHA8cK6E-P5d9dUVgqxZXV0FqfAJgA,2478
|
| 207 |
+
rerun/blueprint/components/play_state.py,sha256=Z1_6qfDQrrTQuFIrh4pc3vhj25TB7AL3uDk88Cw94eA,2425
|
| 208 |
+
rerun/blueprint/components/playback_speed.py,sha256=sFvCyTTYFhGQNETvbYHpevMiogfTLmoC7xq6TLpGsZ4,1260
|
| 209 |
+
rerun/blueprint/components/points_display.py,sha256=7AimXUQP75wC93ShaoWGnIyJRCO9Z8xi7vHKyraDz3o,2647
|
| 210 |
+
rerun/blueprint/components/query_expression.py,sha256=esnWrKTX76qEAmrVeJW3frCgAR2POovK5DLZqAdVggA,1806
|
| 211 |
+
rerun/blueprint/components/root_container.py,sha256=6a5QSJ3bcj4DTP1B_OIGiJE3MAdvGx2gpPDEOeds09Y,1242
|
| 212 |
+
rerun/blueprint/components/row_share.py,sha256=ETJWgmlOXHzHVCZ98RZmJuZ7opKdhdn3VHITtkTykJ0,1179
|
| 213 |
+
rerun/blueprint/components/selected_columns.py,sha256=fdm2LGuwPz6yUAvTKzu7ZbOIPSGT-V9ztXw08KEfZ30,1368
|
| 214 |
+
rerun/blueprint/components/sort_by.py,sha256=SiovkiEZebj0h-rb1pAA-_y5cf4kArLQ_Qo65E5upWY,1213
|
| 215 |
+
rerun/blueprint/components/sql_filter_expression.py,sha256=fdR3h7GtBP7v-R3sR8-cJSo4B0Jwn5ZbedHG-wo8q48,1546
|
| 216 |
+
rerun/blueprint/components/table_layout_kind.py,sha256=bKq_bNvr4UxzYLrxfn8fHS8yq2HdzQuSWIwwpLd2SUM,2716
|
| 217 |
+
rerun/blueprint/components/tensor_dimension_index_slider.py,sha256=Q1Bt3Z84olEBSzxs-ixpfhr5RVyfFff1yj16OkpIoSk,1543
|
| 218 |
+
rerun/blueprint/components/text_log_column.py,sha256=V0qNBfX33rqu2I0OUBc-6FVnncqWyCDPVfe9uPoHymA,1292
|
| 219 |
+
rerun/blueprint/components/time_int.py,sha256=Pq2Kv0mZg7c1ml3Ja7GWxtm4dzU6h3-m4v80qGNfMIs,1145
|
| 220 |
+
rerun/blueprint/components/time_range.py,sha256=OxM9StGo9qyolSZ794_Ntpk8jbggEv_9z8IVLfuq1Eo,1240
|
| 221 |
+
rerun/blueprint/components/timeline_column.py,sha256=MuQ_SlmkxBdbfixHR6WKHz2Al87zNTkjLiZ84AJwaxk,1325
|
| 222 |
+
rerun/blueprint/components/timeline_fraction.py,sha256=4my-zHubg-3ccup2iyHWqXHPH-NhSCwo_33ZUumMZUU,1337
|
| 223 |
+
rerun/blueprint/components/timeline_name.py,sha256=GDkH-JL9dTTz5vDGMgvgxwaeSlHdD77vlyjWkCxladI,1350
|
| 224 |
+
rerun/blueprint/components/tooltip_mode.py,sha256=6EcCNiLpOczUkvHBsTW3GcrVZh_oRgsrFE66ADvWeMs,2561
|
| 225 |
+
rerun/blueprint/components/view_class.py,sha256=DadSv09x-vCFgAOFl8Be4GvSKCPfjUPFt7tyeEQ8e68,1200
|
| 226 |
+
rerun/blueprint/components/view_fit.py,sha256=XArqpTWHi7CPmsTZhjOthQYvcCFjDyFyh96KLvjFjF8,2665
|
| 227 |
+
rerun/blueprint/components/view_maximized.py,sha256=VOBljBcn9wuMj3s4oDTaPfGeHqUBO9qKRZAdn0ozw8Q,1220
|
| 228 |
+
rerun/blueprint/components/view_origin.py,sha256=1wMgv6qgWznbyBVT8tWb_RYgFCrUqqcvAwHpqz8I4nE,1192
|
| 229 |
+
rerun/blueprint/components/viewer_recommendation_hash.py,sha256=5UKxitDkmDjgqh6dQE2eauebzRvjonn_OAd7AfcUmgI,1471
|
| 230 |
+
rerun/blueprint/components/visible_time_range.py,sha256=wXsQ2J_wZ0nNCS_vUiJVLyUEFbTxjIHFHeH8meDA4K4,1416
|
| 231 |
+
rerun/blueprint/components/visual_bounds2d.py,sha256=j6YYy9oHHoj-cJEPydgwJuNPIOFlqph6alAXYqYjowQ,1282
|
| 232 |
+
rerun/blueprint/components/visual_bounds2d_ext.py,sha256=chepQb9segv9xkWZl8NbEh9gFuSi8gAII8p7js6W1uw,764
|
| 233 |
+
rerun/blueprint/components/visualizer_component_mapping.py,sha256=8OoVBKF3plerg7IiHNDFhl7TVPiS-cXJ4n1rJbtYo5w,1547
|
| 234 |
+
rerun/blueprint/components/visualizer_instruction_id.py,sha256=_AQUFBHmJmkQCYwUBciCn8VgyVGVd1dUt9g0w-RhLr4,1523
|
| 235 |
+
rerun/blueprint/components/visualizer_type.py,sha256=lZbe0w8dt2wWh6xj-FroRpZkukcYtzW33PWCTuL5_xA,1232
|
| 236 |
+
rerun/blueprint/components/volume.py,sha256=49AfeWwHDuQzbU7a0SQbF3TxChY4fKDBhhRo4MAhLHk,1291
|
| 237 |
+
rerun/blueprint/components/zoom_level.py,sha256=xI3QlZs4BdAUYa31JFMKhv15o71sSutkZQ5ox_fcCwQ,1215
|
| 238 |
+
rerun/blueprint/containers.py,sha256=asANimnrLbWL7l2On5hEsFWyI-xk-_Y5tzAAcJWY4S4,6129
|
| 239 |
+
rerun/blueprint/datatypes/__init__.py,sha256=9p0Hc5KNQ-1pZpLe36qTkieFe5Bki9AyF8ume5_ToqY,606
|
| 240 |
+
rerun/blueprint/encodings/.gitattributes,sha256=XAGfbt3dt996TUI2xca_4bwzekwooFSaX1nQFvaoPGc,756
|
| 241 |
+
rerun/blueprint/encodings/__init__.py,sha256=riE4l7F547HHcvFjtccx4tUkhw8QigT_dBCYCC6Nhj8,3331
|
| 242 |
+
rerun/blueprint/encodings/column_type.py,sha256=Om_onPJrGfpx7NVO5whd411oebMszarKH3c3IE1wA3I,3533
|
| 243 |
+
rerun/blueprint/encodings/component_column_selector.py,sha256=_ivJXqYBbJiWbJlYRo4pnCcP3GzTr9dFfSCr4Ew37gs,3211
|
| 244 |
+
rerun/blueprint/encodings/component_column_selector_ext.py,sha256=m9Y7HjUn8HFoqBqzSS6d9ZA675FPWaDJnDt4xuNVJcc,3103
|
| 245 |
+
rerun/blueprint/encodings/component_source_kind.py,sha256=US4GTeis3118yvQQhtmGyZEcY5ry3oHap3A8ippvYj4,3953
|
| 246 |
+
rerun/blueprint/encodings/filter_by_range.py,sha256=R8XgBw6XsZ1-2ClFLFqJM7JWAfc2ZZxLhtkfzCJqEKM,3128
|
| 247 |
+
rerun/blueprint/encodings/filter_by_range_ext.py,sha256=eLHcGqWB_dmL6APyJqKf4zLRjhXzAGOJmgLYQ2wNys0,785
|
| 248 |
+
rerun/blueprint/encodings/filter_is_not_null.py,sha256=HS2kfIDwFVpekN-iMazDdQNvnbxhxTmLgZTr2njhoVE,3354
|
| 249 |
+
rerun/blueprint/encodings/filter_is_not_null_ext.py,sha256=kLUJoNJHpnZHg27A5Ax7N4uIp_7NMjG8NVxXDJsyl80,1951
|
| 250 |
+
rerun/blueprint/encodings/selected_columns.py,sha256=PzgmfBFv7X2eLqIJsFQoJE_qac825-rrogzXu2ew1EQ,2873
|
| 251 |
+
rerun/blueprint/encodings/selected_columns_ext.py,sha256=-Nz5rP5HBwMcCPmGA8QkC1cFs6Sx5vbGmZiGnrVlImE,3909
|
| 252 |
+
rerun/blueprint/encodings/sort_by.py,sha256=IxtZhePI-WJH5OI9Qf4Dhf3_0WzY4OboSBrWG64HcSU,3537
|
| 253 |
+
rerun/blueprint/encodings/sort_direction.py,sha256=HmfRXiwxu5W1FYgaIaRhuLcqkTG96NFoNMepga_e0UA,2448
|
| 254 |
+
rerun/blueprint/encodings/tensor_dimension_index_slider.py,sha256=V-RUwIJmpdrz5iIEalOfGLsqaStoGgX0Oj1-rFMg5ZU,3032
|
| 255 |
+
rerun/blueprint/encodings/tensor_dimension_index_slider_ext.py,sha256=qRdN_d_Katfh8VxmRfMN-yomp4xad0KxyDAmTDoTW8Q,1141
|
| 256 |
+
rerun/blueprint/encodings/text_log_column.py,sha256=zJtQXF3uw7hWm9Ep218FwVo3qMyb4UqkPMyjvNQAMWQ,3051
|
| 257 |
+
rerun/blueprint/encodings/text_log_column_ext.py,sha256=ksAiPjHl3P9FBl8kKD9kFknvA_xbKNfuzc2q_O6p9W4,688
|
| 258 |
+
rerun/blueprint/encodings/text_log_column_kind.py,sha256=UjmVZEAz8sUYqtMm0G1DSgmWN5HSb3g5K-fhoxGjrcA,2567
|
| 259 |
+
rerun/blueprint/encodings/timeline_column.py,sha256=J6AADRde1ni7ipE-W9RmwvIFj_jkaSCu4S4fmzm7iSM,3188
|
| 260 |
+
rerun/blueprint/encodings/timeline_column_ext.py,sha256=Ijsq3jQWI1ecP5FdcPd17KbG4YnU95VY2mINjM_-2yA,638
|
| 261 |
+
rerun/blueprint/encodings/visualizer_component_mapping.py,sha256=RtKawu82j7jtIpcNmHPIZdk9D6y0ZHj7lQuVc7ya4f0,5569
|
| 262 |
+
rerun/blueprint/experimental.py,sha256=L4p9ZTUo1OKzLdg-qLgFkVYoTo-tLwpHGQlqhMVeSDk,351
|
| 263 |
+
rerun/blueprint/table.py,sha256=3liewUU4r0b4fhB8qDBqCHH0zxZ4ULgURAupSaiI1Aw,15586
|
| 264 |
+
rerun/blueprint/views/.gitattributes,sha256=BpPCRtN85ABRvZZvDnKYMKEZzNGXyBp_49ospggvz2Y,655
|
| 265 |
+
rerun/blueprint/views/__init__.py,sha256=9fXKazgTZnCur3ztEXRea8rC3L0voI0pPVww0ZPtnv0,880
|
| 266 |
+
rerun/blueprint/views/audio_view.py,sha256=GHCThYAVJTqU5hSQFuC74h3AXwdAP5Ytm9YUSON8e4I,5140
|
| 267 |
+
rerun/blueprint/views/bar_chart_view.py,sha256=hQnmVOoCBiduG1Db3skDgRvdl9T8dnDSrhid9Zjp-nY,6133
|
| 268 |
+
rerun/blueprint/views/dataframe_view.py,sha256=CGnxJXVc6KGpF1GDDPk_G5k7NpFr93h0ICZWhS5gz7s,6555
|
| 269 |
+
rerun/blueprint/views/graph_view.py,sha256=nNIvNf85Fsh-s31GBVm6YH4UiBAWvPMaFEsdSXr2ZEs,8746
|
| 270 |
+
rerun/blueprint/views/map_view.py,sha256=-vCsQ6g97lzTy1KBPGSHKYE8jaCTuHJlygXTbKY19zU,6135
|
| 271 |
+
rerun/blueprint/views/spatial2d_view.py,sha256=u6RZzvFNIuS2Dcxtma2lPcAWWeqvqSda5YSwAdLMDao,8281
|
| 272 |
+
rerun/blueprint/views/spatial3d_view.py,sha256=my58n-XLXyHEbZINxtTXBBKBsA_IwiJfqblLbHrGwxM,9324
|
| 273 |
+
rerun/blueprint/views/state_timeline_view.py,sha256=QXieb1WXrTZsvQHxHTyrufXpkIRA6GsfJ5Ul4N8bKUg,6761
|
| 274 |
+
rerun/blueprint/views/tensor_view.py,sha256=nCvWGvevN0y59--AhOufbxxYoPu1tr_6V2uxLR5Px8U,7678
|
| 275 |
+
rerun/blueprint/views/text_document_view.py,sha256=93MFxWOMRbJlyned78PNIcE8W0-jtSB6AstuCk2ZSmg,6807
|
| 276 |
+
rerun/blueprint/views/text_log_view.py,sha256=Iv7vtT9kekcx0RiRkU9PJyomCsQJs1w0_Bk6INzfxys,7043
|
| 277 |
+
rerun/blueprint/views/time_series_view.py,sha256=fS9mQ8-xAuaDNn5Fwb8_9Uf4fuzuGHS317o1Av7MnXg,10932
|
| 278 |
+
rerun/blueprint/visualizers/__init__.py,sha256=gwb4FN8rOIJzZTrUdVmRhkBQccRRj63azfZgbcCZNO0,89
|
| 279 |
+
rerun/blueprint/visualizers/_base.py,sha256=LYNWQ0vpzWF9H_c2mtWbdRaKTvcaKgMQ8Y6Lnu6RiXA,1786
|
| 280 |
+
rerun/catalog/__init__.py,sha256=VaK4Qvu-cc1G4rt3eUOYABjSXAd93ZrT-wjvuWx-PnY,2405
|
| 281 |
+
rerun/catalog/_catalog_client.py,sha256=tMLdStVDfOL7vHwtz7bx-ouiilcjfAqeRgV6PtcKgkI,18682
|
| 282 |
+
rerun/catalog/_content_filter.py,sha256=YLKduxSaTFf2wRoEB9klMYRKMf2fEqllL1f_juS1Fh4,3961
|
| 283 |
+
rerun/catalog/_dataset_info.py,sha256=GRZmv_bR2269QZAMkjbq-ce7lIGvVifnGtm7opZCqS0,5161
|
| 284 |
+
rerun/catalog/_entry.py,sha256=yvIQXhka8PSnR6ndKbUATmYYWqwYwp3UwJ9p9SXxZYg,80227
|
| 285 |
+
rerun/catalog/_layer.py,sha256=58hPU3yNxEhPlixh9mDNhzvY8gdefHm7HjiPlvG2-OU,1453
|
| 286 |
+
rerun/catalog/_registration_handle.py,sha256=o4FV-sXcfOFlhNG1FZ9mWnGC-Ce-nmyg8eeaURGU5so,3564
|
| 287 |
+
rerun/catalog/_schema.py,sha256=H4QczczOb1XkXQVaVvdI0vRRi0t0eKPata0Fap2ZqDs,8935
|
| 288 |
+
rerun/catalog/_segment.py,sha256=W5Uf3Tx9SmvHpSDoZJSpJzYml4PyXSDVzd2Hoin6pHw,2912
|
| 289 |
+
rerun/catalog/_unregistration_handle.py,sha256=Tm7NPgyKxk04PTLTQ6_s-vXpz3_duDMpPnpsExc3bYs,1212
|
| 290 |
+
rerun/catalog/_write_operation.py,sha256=rxY079s9Sr-Mk4tr_SCjhISPSBpP8Kv4L0fEcAYoON0,2296
|
| 291 |
+
rerun/chunk/__init__.py,sha256=ndiQE4Z00W6aBG4BZKsz2tes_kV-xnD1OTHpot-BQcU,999
|
| 292 |
+
rerun/chunk/_chunk.py,sha256=l2n0FqAOehuxSrmQNXEmr2iv8RnDEdTcLl4cpeKUPKY,17986
|
| 293 |
+
rerun/chunk/_chunk_store.py,sha256=MAfUZu1OIvyWxg6gkoG41Op-bD8IEzNVPD5oO_DNCiA,9362
|
| 294 |
+
rerun/chunk/_index_column.py,sha256=YYoxK8vg-PBmABgX2JcwCXd8NXI_p-kdgHjkWWVd0Fc,2254
|
| 295 |
+
rerun/chunk/_indexed_reader.py,sha256=Hs6uX3Qx9FAlzB6q9Upsy9qpzoXchuJhekwJTiyiJC4,871
|
| 296 |
+
rerun/chunk/_lazy_chunk_stream.py,sha256=IIB4pWIOc6gR_xyegVe_sRGF0Qrf7Jl9LO1nrdHi5GE,14101
|
| 297 |
+
rerun/chunk/_lazy_store.py,sha256=FulOJJCI9AY-JI0M2B71H_ZMJlUsrW9St6vybdLATec,5398
|
| 298 |
+
rerun/chunk/_lens.py,sha256=Wv9syGHct0vSs0oD9yEaopD2YrkERg24er_viFbt-tE,12566
|
| 299 |
+
rerun/chunk/_mcap_reader.py,sha256=rtCFiBQh9v_AsIPdW4OkPesC5UPWLWLh6CYHVXJeuSA,10118
|
| 300 |
+
rerun/chunk/_optimization_profile.py,sha256=drDmFNS6VniVyJZEIbQGThU2A8NJfGPpHEPFsRX9Eyc,3645
|
| 301 |
+
rerun/chunk/_rrd_reader.py,sha256=jwrzjqdokfwlo5orlXgJPPHCMMk9o-aYs3cm2GHVGBI,2768
|
| 302 |
+
rerun/chunk/_selector.py,sha256=FkYZSX7wjpMptEWXiVx4TGiuB_DirROufkMBpXkLSXI,3680
|
| 303 |
+
rerun/chunk/_store_entry.py,sha256=CXt-hkcglBxhe3F5LVSzIBMoMIcRRmHJvvii3_unAn0,1257
|
| 304 |
+
rerun/chunk/_streaming_reader.py,sha256=JebFxZ5cis6nd9M-ch-PmZjmf6xPev5Cg0WWHXMQcxk,663
|
| 305 |
+
rerun/components/.gitattributes,sha256=EhVhAC2VKlQ90ywXM1pPMZD65xK_XeLxahvK_PU7pOo,3905
|
| 306 |
+
rerun/components/__init__.py,sha256=KxYotymiRNivGda6Zb-qKE3ulCNqBgJzK-zVjrtlrB0,11387
|
| 307 |
+
rerun/components/aggregation_policy.py,sha256=NxbbST3J8z3y5IERppnWzHjf350R2oFRQz2K2Y17YUA,4002
|
| 308 |
+
rerun/components/albedo_factor.py,sha256=kR07ZifyVoAJMqZwEspzAXpq6n1fWtGpjrbgPRBN4ck,1097
|
| 309 |
+
rerun/components/annotation_context.py,sha256=5H3L0DeMjuXM9Cmm1o9hDqLBffqpKxfGdF3bKskj5mE,6055
|
| 310 |
+
rerun/components/annotation_context_ext.py,sha256=N93nxfGzpuspbbObCdKQjQEQZUuD5Nyn25Fin7Tnh8g,1740
|
| 311 |
+
rerun/components/axis_length.py,sha256=0UkxclfP3biJE1mI33rqeJ-0PZka3iomTlMDtETVXDA,1057
|
| 312 |
+
rerun/components/blob.py,sha256=oJP5JfQpgh0dZNXpgt7Zmo1SgElSzzSa7H9iAE37Y2Y,939
|
| 313 |
+
rerun/components/bool.py,sha256=lVG6SHStbGAwOUGCx5RvF3ujo771C3oS-eR_tdb6gIU,1188
|
| 314 |
+
rerun/components/cell_size.py,sha256=YKS7bJP80ShKtFJ6l6YNwfMg7X00ROazbhaxwFhDUMk,1138
|
| 315 |
+
rerun/components/channel_id.py,sha256=TQX8wZBWKQpAo2T1m9dIlT8L-KfulVpRglMDZl3S4qs,1103
|
| 316 |
+
rerun/components/channel_message_counts.py,sha256=oMwOVOcsscG_ndMQOXnHe5Xh_pnb01ISKhWphIzDioY,3414
|
| 317 |
+
rerun/components/class_id.py,sha256=RWtehL-H4CmMnBaQF4OLCoHbBIrtv6k1DQRjKWzsxX8,1018
|
| 318 |
+
rerun/components/clear_is_recursive.py,sha256=u1t0UvBQI7_SBITqtg23-NYrxUn7yk_Y5gg4LaIAdu4,1167
|
| 319 |
+
rerun/components/clear_is_recursive_ext.py,sha256=ssotsT1am3beN3z7CBna2UlMXewNCv2I2JaeCv8yGqU,492
|
| 320 |
+
rerun/components/color.py,sha256=tkpWStki6llV8uWENq2rafpA6xjv1modtu8xcJHA0Ng,1423
|
| 321 |
+
rerun/components/color_ext.py,sha256=4kxrBIb5KXCTMoiICbm8mmbR32Z4ZhHHC2JwdlLDjH8,700
|
| 322 |
+
rerun/components/colormap.py,sha256=kAycLsJaeaDpStTGCDcM98cRT9UD2TKxAG8gFYSpr3E,6423
|
| 323 |
+
rerun/components/count.py,sha256=b9PWc_sJ90QAVSQ4ZBHJPIyk-V-9R-ec1h7BBpnhGm0,1170
|
| 324 |
+
rerun/components/depth_meter.py,sha256=Ia3QBe0pFaQqyet5G4cxRuG8oTJs3TIfEAgkPqIvE-I,1549
|
| 325 |
+
rerun/components/draw_order.py,sha256=yewhVod7jlhR8evOSbEArQpwoRCK79HbUk_mXA7lzt0,1292
|
| 326 |
+
rerun/components/entity_path.py,sha256=FzVgKk1r4NjMMlxm2DA3yBqN3GqfcVGk1z-K6m3v8k4,1102
|
| 327 |
+
rerun/components/entry_kind.py,sha256=3cS3U_HsVE9fDVTLqzojW1ZAuIdu8UWxIJLsL2P3wm8,3248
|
| 328 |
+
rerun/components/fill_mode.py,sha256=kzdpgjKEIUsA-LGh5iN9yqwX4xeHHbCnPGFzzzHDwDs,4007
|
| 329 |
+
rerun/components/fill_ratio.py,sha256=54WpxHCl8v8Rk7-F0b7Q0Gsl7YTL7S_ebEQnRMFI-tc,1322
|
| 330 |
+
rerun/components/flag.py,sha256=K1OYn4DtAk7aJTwP3AOsP6E0UYJ4MpcOSvelYtIYy2A,1207
|
| 331 |
+
rerun/components/gamma_correction.py,sha256=Fqy6HQa6RMn9yM9tOoQrRSVkS25-Oxbr2TcxvO5tbHw,1354
|
| 332 |
+
rerun/components/geo_line_string.py,sha256=tp2gCENsf93LoPEGwBC8C7hn8krGvnX6XsgE8FqK9WY,2350
|
| 333 |
+
rerun/components/geo_line_string_ext.py,sha256=ZCNpoNRLVOj-zO7veyziIQyCQzsOiO1NMBXYQWhruoI,4070
|
| 334 |
+
rerun/components/graph_edge.py,sha256=clgxoY4YnhJJkpHnVh-4pCOvEYhwvHmjRfViYIyed7M,1037
|
| 335 |
+
rerun/components/graph_node.py,sha256=N7fTK29Qysdei_cymkUqhcbgWRBBr5sRNviHU0rHrlo,1034
|
| 336 |
+
rerun/components/graph_type.py,sha256=eBVXRJt1bO3MarTw4PRzrqFR73ng7BEnsVAVweClVGM,2356
|
| 337 |
+
rerun/components/half_size2d.py,sha256=ho-sgPBDUuabpeIO-BK681vngKt6HRtzCO-ZKFjSW4k,1292
|
| 338 |
+
rerun/components/half_size3d.py,sha256=cz-wVJpt549WuEnHsmzcMxq7bxO2mhIN_JBQruRTzZ0,1292
|
| 339 |
+
rerun/components/image_buffer.py,sha256=HSH8WJDhbQ2yh2exVq__X46THbUBonsesSYNHwAemzc,1174
|
| 340 |
+
rerun/components/image_format.py,sha256=iGxrFVTifCWf0OeoZXzOvyDeVSFEqPa8PlqWgdZqpXw,1131
|
| 341 |
+
rerun/components/image_plane_distance.py,sha256=8aaNXAIDoQvE061oVayXJWy_9uqLOd-JXMDBIHKm9PA,1317
|
| 342 |
+
rerun/components/interactive.py,sha256=eSW2HoM5UG5KOOKE99i7-I9SanTdFerod5B-cpLX13g,1160
|
| 343 |
+
rerun/components/interpolation_mode.py,sha256=fkP7eF3c2LuyRC87VkANaeGNXNUBKHR2E-MZIyEvjMk,3170
|
| 344 |
+
rerun/components/is_keyframe.py,sha256=KComKArO7yNKe1E8D_RonLWaucIr9SlKTOV9AyVVvIc,1584
|
| 345 |
+
rerun/components/key_value_pairs.py,sha256=ZW8a_X4r7pCh9bKOUayA1Xsvpw8VXAzh0nhxRlHHMd4,3203
|
| 346 |
+
rerun/components/key_value_pairs_ext.py,sha256=idP3839sYKls-6DVKDiIfekUmVflxMSLS1jfntlM5s8,3395
|
| 347 |
+
rerun/components/keypoint_id.py,sha256=Vy-Ge_pvbNWOL76vJh4-Mz1Bhpa4-C70kTvFdVp1k-U,1408
|
| 348 |
+
rerun/components/lat_lon.py,sha256=nSPv2_Ji96lxjAVa991C1xfhK6gXJzBV771b4w9_VuM,1073
|
| 349 |
+
rerun/components/length.py,sha256=v_Ze_klmcyEhWPBrTRPEqiaizkZReZGOZ1Yn76Zk9vU,1142
|
| 350 |
+
rerun/components/line_strip2d.py,sha256=kO_hNfJEOBcG85bloFFSI3hylLNGxO7HJpiDegxVCXI,2718
|
| 351 |
+
rerun/components/line_strip2d_ext.py,sha256=BYJN8qZ2rgFhN7BasisxVd7p3I5McV4Y6EHZ7EUP_IU,3613
|
| 352 |
+
rerun/components/line_strip3d.py,sha256=hm8b1NvlyZiuuj3fOqhwZBNYOjed0-pkG8ScLm2rwzQ,2718
|
| 353 |
+
rerun/components/line_strip3d_ext.py,sha256=5BDGf7l7JBzADcsZfrohbsKWU10f9Kfrf63C2mJuM-w,3625
|
| 354 |
+
rerun/components/linear_speed.py,sha256=A8ZEaNmtoisCZ8-ZA9bKGbMhDYugHjmXmVNgoL5W_C8,1073
|
| 355 |
+
rerun/components/magnification_filter.py,sha256=QpjkvLdB0WnyM7SIvyejAYWSXSR3Bu5E-km0tPz-wGo,3463
|
| 356 |
+
rerun/components/marker_shape.py,sha256=oi9rW1g8LmgMxG2vjeWGOytBhteP8qKrCqpLLpZqtvk,3214
|
| 357 |
+
rerun/components/marker_size.py,sha256=vRdpJm_hQfECe8STTlvRqh5Rva2WV0yK-dZyY2opy0Y,1078
|
| 358 |
+
rerun/components/media_type.py,sha256=q_bwc_Vjt12pbnKe09AtdROVqcFx7onoszeQ-mdVGWg,1368
|
| 359 |
+
rerun/components/media_type_ext.py,sha256=UwN2KnRix-so-jHQZGZfRK3anbHDiHWTdo5rzhhqABQ,5382
|
| 360 |
+
rerun/components/mesh_face_rendering.py,sha256=9uyAn3wsk7PiUj1x2Z5h2mNxsn5GnzEWyoMuVUrQl54,3044
|
| 361 |
+
rerun/components/name.py,sha256=vE_GaNjYSNuapD-m9xFwYfPUfoV6apvnE4EV8hhgJk4,1136
|
| 362 |
+
rerun/components/opacity.py,sha256=dFPA_msn1SDqDtmGTluxo4r1OFxBOnAUdt2d8ZBEdjk,1231
|
| 363 |
+
rerun/components/optical_density.py,sha256=XzsanqXyKLfSZOWqy0FLMnm_86utPLjDKFwRqoJ6PlI,1281
|
| 364 |
+
rerun/components/pinhole_projection.py,sha256=ucVj9XAJM9Wm4DNDe86cTCmxvs1EvglFgzCKcJ7_UzM,1356
|
| 365 |
+
rerun/components/plane3d.py,sha256=4lc-moI9xrYzqvricNGtkMy8TolbXbQClXp2sgfVycs,1511
|
| 366 |
+
rerun/components/point_shading.py,sha256=nUsMXQSOcfcOeuH3qNOmmd-9a7xvUwVNMT793gJvhjA,2376
|
| 367 |
+
rerun/components/position2d.py,sha256=DI0w7h0C9NMAFmPJbS-rf5rlok7-8vJq5ckM91ffk1A,1021
|
| 368 |
+
rerun/components/position3d.py,sha256=K8AMEGoakEZX9-O57JBnRnluCqLAqqVhVTegSKLWZiI,1021
|
| 369 |
+
rerun/components/radius.py,sha256=Sa--yVFDtKX8dm9gR_LbeLcM8Ie40rOyM4ONO9Y3_o8,1437
|
| 370 |
+
rerun/components/radius_ext.py,sha256=QOi9WCUVCXizXdDr7OqHKSI9oPwB2By_WeuVWPbseoc,983
|
| 371 |
+
rerun/components/range1d.py,sha256=chtsBCchNTE4TEW80jADQ_HZxfVf_ihDZ4a1QxKsMO0,1012
|
| 372 |
+
rerun/components/resolution.py,sha256=g88POXbvB-h9NDVADHED7lv3JHiVNnA3tFRV6YBjqLg,1149
|
| 373 |
+
rerun/components/rotation_axis_angle.py,sha256=whCcybumttZeAjNI6LMwZlT1EJ5zDs29XB4h-AqFCs4,1370
|
| 374 |
+
rerun/components/rotation_quat.py,sha256=ivMUKhnNzBSlAfo56Vx_6A7L0tZpSefaOq9JrKzrlSo,1350
|
| 375 |
+
rerun/components/scalar.py,sha256=iyBf6f5AOVgUlTJm5m-t24COWCk8d5KZIZ0z5jVrFLU,1046
|
| 376 |
+
rerun/components/scale3d.py,sha256=Rc9t6YEnznjDLusvlv9dttIKjN1No0PDRjXrUASiD2A,1127
|
| 377 |
+
rerun/components/scale3d_ext.py,sha256=3AYsaWaZciwOQ4ToxEfRJ9q4UnMOHfNwC1JOuWzpVZE,1094
|
| 378 |
+
rerun/components/schema_id.py,sha256=mVtjIcg1aPpc3B9WePnwIk52SpdB2enoIwd6mymtrrQ,1039
|
| 379 |
+
rerun/components/show_labels.py,sha256=BSFXvB0T2QEJuZt1g3BMBbm_BE-A652l4Kn1afn9VAs,1276
|
| 380 |
+
rerun/components/spherical_harmonics3rgb.py,sha256=BjCEUzm5wBZMXhgk4opfkkgRya0T-ZsrKVq-UdHen8Y,1555
|
| 381 |
+
rerun/components/spherical_harmonics_degree.py,sha256=hpiM-YFReBooyu8Q6JyyhFavZnh6WDAYUv46Gjx45rI,1871
|
| 382 |
+
rerun/components/stroke_width.py,sha256=AK3PAM1aezV7qo8AHsYPQf6eEyoS2r7bpsP5GRnHYJM,1065
|
| 383 |
+
rerun/components/tensor_data.py,sha256=7O_Sf52s6D6lqSyC-Ge9aO-tkGt2gbe7vbJyffrY_Vg,1461
|
| 384 |
+
rerun/components/tensor_dimension_index_selection.py,sha256=fRWMnlwnritOHYtJgVGeR1w747r_pt6XeiYFSt9B6kM,1369
|
| 385 |
+
rerun/components/tensor_height_dimension.py,sha256=4gFpTu_kt1nltdN1UHUcDfLcFEBIlksWUddM_4ePQp8,1251
|
| 386 |
+
rerun/components/tensor_width_dimension.py,sha256=zIhOGGXzxi9VAPYyGLOfuav4SWmxeoXqKTvn6v_-4M8,1238
|
| 387 |
+
rerun/components/texcoord2d.py,sha256=q0-2N7dibrYbr4dO6_2LKzEHzMPm7_rZ9tc4kaYKc-8,1567
|
| 388 |
+
rerun/components/text.py,sha256=3akf24oFpD_Vsdlxt0OK5oI0vg0e5GYzjeESrazJOD8,970
|
| 389 |
+
rerun/components/text_log_level.py,sha256=1Qe8k9hQcYdI4_Bn3fvdRP63si_BRuVu4-eQcQgMEME,1323
|
| 390 |
+
rerun/components/text_log_level_ext.py,sha256=0B1dNZXnobHoyIzxllBlPTknrB5ThzvIZPwc5TXeMNE,1017
|
| 391 |
+
rerun/components/thumbnail.py,sha256=SYRMETgemt0R9XUelAMRQ1G8ab3ELzc8-GwVuFhy_Jo,1232
|
| 392 |
+
rerun/components/timestamp.py,sha256=8_lo1ySYKmAgdRxivt5RyuIKmKihqsPjZSoO2CQcUKQ,1090
|
| 393 |
+
rerun/components/transform_frame_id.py,sha256=BBwcdR_wSadiq4coTmCdJa-kgYPAkMy8d_UQoy7jlYU,1806
|
| 394 |
+
rerun/components/transform_mat3x3.py,sha256=vOOaJ05Uknl23OtrT1NOh1SBnIUK0SuC5oyroqAY9rw,2655
|
| 395 |
+
rerun/components/transform_relation.py,sha256=JUtT-M4rtAOtMaae02Duq5XzMWOwfA0Q5Oju8T7mMXw,3490
|
| 396 |
+
rerun/components/translation3d.py,sha256=guEWY084a6HbNrGoApR9SooQ5u68O9OvCobwZ3Lg_9w,1070
|
| 397 |
+
rerun/components/triangle_indices.py,sha256=f_oRej2fWd4Rl1bGZj9NudssBxjn8VbocoFdHtd3F2M,1120
|
| 398 |
+
rerun/components/unit.py,sha256=AIMba4fN8cbSHRgm3MlbAoXKWrEXNPnmoHYnCMV4NNo,1181
|
| 399 |
+
rerun/components/url.py,sha256=LuYbSkgRsPH2TEMyUuGT2U_z8L7Jy5ZsUUeUNv8pOOo,1236
|
| 400 |
+
rerun/components/value_range.py,sha256=jXoVhh4unC2Mf9sUcbmSuVgUdllxUlw-lAbipgsQdOI,1210
|
| 401 |
+
rerun/components/variance.py,sha256=8uAJESZ6dPIVY9GMe0snbNyH70t7B-8QmkCoMdm1gag,1262
|
| 402 |
+
rerun/components/vector2d.py,sha256=Uo2bt2P5tqwnOzotZO0ox1zHb1Enxp9ZpiAkg2PaaBo,993
|
| 403 |
+
rerun/components/vector3d.py,sha256=SUA_a5jMuZydxgRI93EgkhFZ9E23M_6DX0UD5vTsAb4,993
|
| 404 |
+
rerun/components/video_codec.py,sha256=dII_j0mTcHVMa0D02aaq9HdFMcJpYwP6LjRHk3okMEo,5179
|
| 405 |
+
rerun/components/video_sample.py,sha256=WlIk73nYHWWGn7Xnmuig_2B-_PzrJ8mFg7lxtiKs8uU,1330
|
| 406 |
+
rerun/components/video_timestamp.py,sha256=oNxIadhOjRJ_Us6HPZM8R76V5sNsa1JkG2PxCRAdg6I,1171
|
| 407 |
+
rerun/components/video_timestamp_ext.py,sha256=6GMN0qH1Nl0DteKCiv0_PzciCGodPD0_CfPEexSh7ng,2670
|
| 408 |
+
rerun/components/view_coordinates.py,sha256=TP0Vn3YcBohv8UuD4_GJinoO1wUPtRAvFL13-35urSI,2221
|
| 409 |
+
rerun/components/view_coordinates_ext.py,sha256=KHVkCLcH2ier5F_lp89_ghIeDlQbg_8kBYz2Zpy0P_Q,15592
|
| 410 |
+
rerun/components/visible.py,sha256=l1Wx6OIyoSGbo0nsWdr1xYAecQvqIorqiinV86LMwCo,1025
|
| 411 |
+
rerun/components/voxel_index.py,sha256=-uYEtlUPrNjbYr2XJwfr3BDw3jF2zwpzDfP3HKHMhds,1146
|
| 412 |
+
rerun/components/voxel_size.py,sha256=MtleCdahSmhaHWNItIL23dEgC3SYcFiVpNYTMIKG7JI,1195
|
| 413 |
+
rerun/components/voxel_value.py,sha256=0z7B3Lri-wupdD_mNjReTU3mF8MvyVe9Vjf4WuhDUxQ,1066
|
| 414 |
+
rerun/datatypes/__init__.py,sha256=wHbdekOZ9b_-oLlM8Kg0Zl-50XUSnHtXesqhmOsNNVE,566
|
| 415 |
+
rerun/dynamic_archetype.py,sha256=nteWII6lGG_b9PdWTtMdQTzCug_LgCnfoIG1CthZy40,11254
|
| 416 |
+
rerun/encodings/.gitattributes,sha256=9_wbStAguTTZXHj9Tmaif4CelmKbZjAcEHeR-DuzTtk,2176
|
| 417 |
+
rerun/encodings/__init__.py,sha256=oDCvi8q8UZqagtnoIsv8LCvzcfYMC663ueqr2aaS_Q4,9700
|
| 418 |
+
rerun/encodings/absolute_time_range.py,sha256=w-Q3y6G_5QX9-ybVbP1lx9puUhV46XPma6t5DMJdins,2424
|
| 419 |
+
rerun/encodings/absolute_time_range_ext.py,sha256=18l7Rb4fNl_9XeqWyqxdjd2XhMKFeZYGuYX7o3A7zm8,797
|
| 420 |
+
rerun/encodings/angle.py,sha256=mRVbp9D6nHcH24JkQq3j5S-DaYVWNPnoNn2oUGVF8yM,1953
|
| 421 |
+
rerun/encodings/angle_ext.py,sha256=cz0oFgFnMBfp0UdGF8LnBjDM-tKvUjN0CCBuNbFfmYo,834
|
| 422 |
+
rerun/encodings/annotation_info.py,sha256=bc58_MlERaNx2Yx5-VH9oF8cOWWZYoagL7cW1UppoeE,3940
|
| 423 |
+
rerun/encodings/annotation_info_ext.py,sha256=U-e1MJWMd5F7Xj5p-3v88B6I3qkA8MEGIZGWxXJyavk,1442
|
| 424 |
+
rerun/encodings/blob.py,sha256=lXoDbKXjeeh7iaFEddCIvn9Q1ipNhe9ibFDyrGS4HKo,2072
|
| 425 |
+
rerun/encodings/blob_ext.py,sha256=V1mtfPBb4zHhK7mKTdgoPzoDHa3-qKHmJRkKAMClG7E,2706
|
| 426 |
+
rerun/encodings/bool.py,sha256=mQDFEpGHCFDg7TLoY7K48peGJ6YW1Mko8Alpj_TEzWY,1474
|
| 427 |
+
rerun/encodings/channel_count_pair.py,sha256=KBqS_rX6sUhu6VeSeVC4Lh94YK1_3-kfXSiwV7zm_KI,3159
|
| 428 |
+
rerun/encodings/channel_count_pair_ext.py,sha256=8jWfP-UATNIcpIr-xGt0wBlZdY2y22oD4PcW8ToWJRk,1601
|
| 429 |
+
rerun/encodings/channel_datatype.py,sha256=IYzBf9mWCs_3lqoPP95gqI1J2DbtciFA43eYafVYYoE,3613
|
| 430 |
+
rerun/encodings/channel_datatype_ext.py,sha256=c_5Pjs_q3FvsUw3GEsjZ0_TRp3YBc1LNF4x7atMQnW4,1613
|
| 431 |
+
rerun/encodings/class_description.py,sha256=OLD-Bjwvow40bUrD3tQ9omqgy-E7CMlvZFVquD6H1f4,5174
|
| 432 |
+
rerun/encodings/class_description_ext.py,sha256=PukUkUW4jy1vDzH4vTeqWMj_iymGbmf_xHK1_Y6RF1Y,5884
|
| 433 |
+
rerun/encodings/class_description_map_elem.py,sha256=eIW9iuLcm1Y4I6f6KY1_kZb2ouMXf3IR6WSIVTlgjXg,5365
|
| 434 |
+
rerun/encodings/class_description_map_elem_ext.py,sha256=_FdHtb2TiB9HipMl8eUO2aMVDr4nbh5idE1QVeQoqZo,1720
|
| 435 |
+
rerun/encodings/class_id.py,sha256=aPESfu0py_hak0mvW_JzgqrCyrvfnKV-8xLENCnYDIk,1974
|
| 436 |
+
rerun/encodings/color_model.py,sha256=AjKBUn8GuCsPVKWfNbC27P7eODM1L5LgGFswYiTNrYo,2707
|
| 437 |
+
rerun/encodings/color_model_ext.py,sha256=XkrA-8ZFiS3Ia1U0e2d5Gdqyq8itHaHAvtwiYIvw57k,544
|
| 438 |
+
rerun/encodings/dvec2d.py,sha256=jlewUXi3pQeTpPdvzlvxQAhzOFWP-5YvzjUl80lixcQ,2227
|
| 439 |
+
rerun/encodings/dvec2d_ext.py,sha256=pnZYWTUyvACMF9kf1DjMEhRpyjnxZ8v_v5MUj3DQomk,625
|
| 440 |
+
rerun/encodings/entity_path.py,sha256=1iyyhHEBLxnzB5dsyNaFZjOczs2WQszUwgDW6EpXdgU,1974
|
| 441 |
+
rerun/encodings/float32.py,sha256=N8IuMSKj1K8ev8PCTaPSzvG9j9OKlxspjnUYZ9c50pk,2079
|
| 442 |
+
rerun/encodings/float64.py,sha256=4rT-Q_VsPGZ-1zQffn_dmWsmXIE5qAqCNif1meydNxQ,2079
|
| 443 |
+
rerun/encodings/image_format.py,sha256=9Ilz0LknTI1lKRBvrncWsTxhNQI_4mujgM2o_-Rcu48,5960
|
| 444 |
+
rerun/encodings/image_format_ext.py,sha256=xVqutiHAFItoww5EsHE_G1ZlFjKWxB_rv5UlxDc8xC4,1079
|
| 445 |
+
rerun/encodings/ivec3d.py,sha256=lxc-jLiW1a3j6YPKIQoaLhm4pfHZd7mfzor_zM_6g98,2209
|
| 446 |
+
rerun/encodings/ivec3d_ext.py,sha256=SNT7z1l_d61rjs-bPIEwqBiaFl-VpT05-QWGAtOh32k,534
|
| 447 |
+
rerun/encodings/keypoint_id.py,sha256=VopvA3AqRHxLVZf0_fpK3ORMTFyPkMSccfxyqoED0Ck,2391
|
| 448 |
+
rerun/encodings/keypoint_pair.py,sha256=b8WSjazdRy-p-76fjn44hj6vhKMsFi_I4mYqN-rOXn0,3037
|
| 449 |
+
rerun/encodings/keypoint_pair_ext.py,sha256=GxE9lKNc1jP0hz_iOQL7k4wIZG_ObTzH-jq-qHoSSS8,1289
|
| 450 |
+
rerun/encodings/mat3x3.py,sha256=C1od9g-KHr6baemj2Rl1iCQPAiegqpOxk6cUo1n-1xE,3449
|
| 451 |
+
rerun/encodings/mat3x3_ext.py,sha256=BGYFlBcc9zL-WByBVrMcuBR2d2ES4x8TRTxdOtbv7jc,2782
|
| 452 |
+
rerun/encodings/mat4x4.py,sha256=ZTrR7jzG_MQwjjsaYKHQtgrbxMZjr8yspclsfPEkRZM,3877
|
| 453 |
+
rerun/encodings/mat4x4_ext.py,sha256=m1eY3l9KLVMxgS4vKn8We31uZoWaCVYjx0Q9eYpTPFk,2332
|
| 454 |
+
rerun/encodings/pixel_format.py,sha256=QgvYYStF6PEMF-L_vn9fqYhIans5-CBAyazGvuvC8sg,9346
|
| 455 |
+
rerun/encodings/plane3d.py,sha256=MsU200nEveJTwlOj7kGzajaE_m_e1R0KFkbl_EyoHqs,2466
|
| 456 |
+
rerun/encodings/plane3d_ext.py,sha256=8w2vGbofJyRqmGxJPPXN0hcz06rqckXlsdyy9rVkAu8,2291
|
| 457 |
+
rerun/encodings/quaternion.py,sha256=4rxBecq_-NLNPNYNwHaTOWolB4f-_3b96iv6fjt1uwU,2200
|
| 458 |
+
rerun/encodings/quaternion_ext.py,sha256=_Zka5N5y-Y2G12S3NxBMrGAUuUa96GUEpq07C6xeG4M,1120
|
| 459 |
+
rerun/encodings/range1d.py,sha256=xTxyQm9YipRzc8NbjwdZMHM6YhIiWFhhctsIjy8iMdg,2293
|
| 460 |
+
rerun/encodings/range1d_ext.py,sha256=VTe5qJhqz4DEx2_ufZQFzxJKVFD1pZgRs1ev6H8Dd44,766
|
| 461 |
+
rerun/encodings/range2d.py,sha256=f4WHot5TWiM87CoqtjzL3sD82QvHCm_zZ9eEt_LY-Bg,3492
|
| 462 |
+
rerun/encodings/rgba32.py,sha256=uOIDlGvUXVq33jaVMGAkgdkQrvaOPBJzAhO3RNAHbT8,2510
|
| 463 |
+
rerun/encodings/rgba32_ext.py,sha256=20jCw0FfBNnAb1pmDCv0lhTQAY4bEMqNLec1Uc1fM1k,5287
|
| 464 |
+
rerun/encodings/rotation_axis_angle.py,sha256=Ak6XjJX9ttvxWLjnhlzF6nSG1imPbM8cfZPR3xdD90c,3153
|
| 465 |
+
rerun/encodings/rotation_axis_angle_ext.py,sha256=R0kOnfIpmsOvLaD5NqXRAb-E-FdsRUen53BxzE_QbSk,1830
|
| 466 |
+
rerun/encodings/spherical_harmonics3rgb.py,sha256=EbmgrVqQUo-zRkXMifsIWWuO35SMpUAol1e5B5av-yE,4601
|
| 467 |
+
rerun/encodings/spherical_harmonics3rgb_ext.py,sha256=6obcXabZ1SHgvT0VsPMdZ6lHlg8ntMmXv2SHj0rV7yg,1967
|
| 468 |
+
rerun/encodings/tensor_buffer.py,sha256=1DvnpwZKFszGY5M1bGg78K77A9u02uFKB5yNjJ6qIAU,5643
|
| 469 |
+
rerun/encodings/tensor_buffer_ext.py,sha256=aNRxadhCAfFqORZcjgp-ozxWFmsJDaDt305yFlzpZpY,395
|
| 470 |
+
rerun/encodings/tensor_data.py,sha256=1rvPcMjWwNH0XpQZ97RQOP7wJr1NigMuSt6q4iwLKi0,6386
|
| 471 |
+
rerun/encodings/tensor_data_ext.py,sha256=Dxcoxuia5EyzvBcRY58el6olRNnTAEXrqAf5FMGzSu4,8496
|
| 472 |
+
rerun/encodings/tensor_dimension_index_selection.py,sha256=tII42gte9WyJ-5t3aEciUP8D-mjv3418VL6bCDFR2ko,3071
|
| 473 |
+
rerun/encodings/tensor_dimension_selection.py,sha256=u3Cng1IPRqt26txVezN2hk4puITAj2VfXkCqIQN-Y_4,2214
|
| 474 |
+
rerun/encodings/tensor_dimension_selection_ext.py,sha256=11W3kFGDXVeRqfhm_67hfM6tV9J6zPySv7nGnWQRCR0,1856
|
| 475 |
+
rerun/encodings/time_int.py,sha256=L982oEglpzdY1nnSj4ng0OEFI5XitDMxWCukdkJubk0,1826
|
| 476 |
+
rerun/encodings/time_int_ext.py,sha256=QHWMuEOGDSfPrLzyhdgGO7TxIpzrpGIBH0dzizsh8qk,1433
|
| 477 |
+
rerun/encodings/time_range.py,sha256=2KEAggBkLCIYosTFly5btGwlBUVJyYOJElsgwGKx8fU,4132
|
| 478 |
+
rerun/encodings/time_range_boundary.py,sha256=NLyT7qevJociakEQ4BUuTk8hyO30aXzKG8XhEj5k96Y,4711
|
| 479 |
+
rerun/encodings/time_range_boundary_ext.py,sha256=kQMe2V00k2lp3HGj3cY3TDh6pxmLyxWCQsbIzMhStgU,4555
|
| 480 |
+
rerun/encodings/uint16.py,sha256=lnEmOdUuEppt7iaffaDO0xpgeJkYobGIiNSmK9-p8-4,1950
|
| 481 |
+
rerun/encodings/uint32.py,sha256=ZnnE4h2fLvuSzzYucWiavdRt0u5BN2VX1Sx0v6Zyt-Q,1950
|
| 482 |
+
rerun/encodings/uint64.py,sha256=hoH-_nkKEVJGncK12NOP3-DW6FpTrxxkbtp34zK0AcU,1950
|
| 483 |
+
rerun/encodings/utf8.py,sha256=J2lrZuhxL9ROalwfgfLm2hEG4IobUmvd_eXKdmbM8Xk,1856
|
| 484 |
+
rerun/encodings/utf8pair.py,sha256=8JfLz-X8TnFprIsihhTvfl3fNtMQXFuXyTQWmKSrE5c,2767
|
| 485 |
+
rerun/encodings/utf8pair_ext.py,sha256=eH0IUtE75BIrw_PUfxxkS4f7IQdJhTZvL9gAYHZ34hw,2038
|
| 486 |
+
rerun/encodings/uuid.py,sha256=pB-iTFwFGY8WLuIeWVMfClbAULA8JmDJZvUDui3Q8gw,2447
|
| 487 |
+
rerun/encodings/uuid_ext.py,sha256=TG0Xv6xJJLpJDG10GsTpMBDD-QHRLDKAzR_XpFS5Q0w,757
|
| 488 |
+
rerun/encodings/uvec2d.py,sha256=HvJtS2S3Iyl6ZUvJY08lOnCKAE3W52jlvBGOkmnCLkA,2207
|
| 489 |
+
rerun/encodings/uvec2d_ext.py,sha256=oLnw1FKgXk3DAWR7ONOwAh6YCYSznpqEiD1iLUkHu3Q,624
|
| 490 |
+
rerun/encodings/uvec3d.py,sha256=B5uJWmjBownqnikStB-BUuFE4w1B6id6QiE9up6bbcA,2213
|
| 491 |
+
rerun/encodings/uvec3d_ext.py,sha256=wejel5bdbt3XFH57SA6Oq6F0YUTnZu9KYPvtONHZqBM,624
|
| 492 |
+
rerun/encodings/uvec4d.py,sha256=w_j1CjeyECUVETIeuFTjvgfRzrdFtVY5eqgm-rOiS7k,2315
|
| 493 |
+
rerun/encodings/vec2d.py,sha256=8MWkNYl84vfriT89GY9YFLHz78gkqgTskGN9qt2zRoc,2179
|
| 494 |
+
rerun/encodings/vec2d_ext.py,sha256=Wn4U7ALd0EEJh6EUk6bcDnOUA87K02uJLzdrcQ22R1o,621
|
| 495 |
+
rerun/encodings/vec3d.py,sha256=IO3UE8Q6ZAfwr5_5K8pYFRfBxJF5kdlJTGR8E1cHL-w,2185
|
| 496 |
+
rerun/encodings/vec3d_ext.py,sha256=D8FYEPD075K9wFxmc0B7SfyY5sG1GfFUknRiNiVHZb4,667
|
| 497 |
+
rerun/encodings/vec4d.py,sha256=Vvdu58QiZRLN6V01j0eWISw52ApVFi8Cq29mcdlysqY,2191
|
| 498 |
+
rerun/encodings/vec4d_ext.py,sha256=SrUwFI0dvHQYB0EGdTtCWRJgrUKrLDdBztIRoOnuWMs,621
|
| 499 |
+
rerun/encodings/video_timestamp.py,sha256=hqag2Dl1JMhGh7-dNi2xjartsY4RNRz01QFincMiTok,2648
|
| 500 |
+
rerun/encodings/view_coordinates.py,sha256=Dij05w7I6qDG1d8t3LrvLzEdKxLa-W_aQR_68jSJep8,4650
|
| 501 |
+
rerun/encodings/view_dir.py,sha256=VJl1DaSu0uDqNpS_CD6_1tNtuypcsujlJ-gg7hg9jrg,2533
|
| 502 |
+
rerun/encodings/visible_time_range.py,sha256=XET_AuHwIXzc9XlKQi6h1Q52nnLXBIInxF7E2ut5qw4,5995
|
| 503 |
+
rerun/encodings/visible_time_range_ext.py,sha256=9UhfvH9weAH6IddPA1qGnckR1cfi_O8IgDPkNs_Nb4w,1404
|
| 504 |
+
rerun/error_utils.py,sha256=pGWnDBlpWrIW1CQYukOQKuG1mlpsoSgsoUBodvybb78,10662
|
| 505 |
+
rerun/experimental/__init__.py,sha256=dR1sqLRbSJK_ydRppu5tcXCPFrBC9bMJxyNuqklXiKw,3440
|
| 506 |
+
rerun/experimental/_chunk_index.py,sha256=UA_mR547WIs3-_asJRJfaFbRtbUn8Rv1k3vtOwpOHCg,1978
|
| 507 |
+
rerun/experimental/_hdf5_reader.py,sha256=qFaC_Uv7nB6n-_VlUEyiu6PbyHtbyajbR4BWcZbySkA,9643
|
| 508 |
+
rerun/experimental/_lerobot_reader.py,sha256=9e0iOG1IFecPmI0Wrxwz1JN4dVXeLlVDXmn0lzZy3Tg,4765
|
| 509 |
+
rerun/experimental/_mp4_reader.py,sha256=TH5aAhiv-oYpkW9udXKg7NE1PWBZZcZ7t50W2pF8ERs,7580
|
| 510 |
+
rerun/experimental/_object_store.py,sha256=zPhTk1Fqa0gjXt27Wdi8xPPJkjyLB-rFQjBaoBQLqfM,475
|
| 511 |
+
rerun/experimental/_optimizer_settings.py,sha256=YubrzSDsC3iTkUjXkw4z3fndwtAXD8z5ch2ZAj79lPw,5902
|
| 512 |
+
rerun/experimental/_parquet_reader.py,sha256=JQ-kl-z80n_Rv81-5QRgqK-_w6eIulgbBZovadG53oM,4625
|
| 513 |
+
rerun/experimental/_query_metrics.py,sha256=9fTl_lJl2XjX6xAhnlQPs-DXC05IzIvccSVJVMuJzJ0,16105
|
| 514 |
+
rerun/experimental/_viewer_client.py,sha256=zMF8hf3v3cUr5_6UciUF5QZZRlmhv5bEY4pAXvJBz_g,55954
|
| 515 |
+
rerun/experimental/dataloader/__init__.py,sha256=RPj3XNSsRl768yEJTwpTaYOLiKfkilBC2XNHTGO6as8,2403
|
| 516 |
+
rerun/experimental/dataloader/_config.py,sha256=oFyhYijYxMjl2_-IP4cc_b9nuYVS7C91qqTvDgrznOw,5417
|
| 517 |
+
rerun/experimental/dataloader/_iterable_dataset.py,sha256=uBCVOoDmF1iwNL4I8FEswuRXXcqz7zuAUvUOtD2Aqpg,21364
|
| 518 |
+
rerun/experimental/dataloader/_map_dataset.py,sha256=1MEUd__t_fibKxcK5vcSGJvg6o2-__ql8gn41KxSoQY,7913
|
| 519 |
+
rerun/experimental/dataloader/_pooled_batches.py,sha256=tE1Y-SgA2quw4WbwNwKrMKZ9j9cyy3x5wrqOaxaQQjA,18655
|
| 520 |
+
rerun/experimental/dataloader/_sample_index.py,sha256=UWBam2ksTDlS9RV3pZBq8d8hGiUNicv4a-iiKCHeqdw,15627
|
| 521 |
+
rerun/experimental/dataloader/_shuffle.py,sha256=nyEZasP4FbgNdPH_BgF1dXqBnSKwy8urmovSk2P0SE8,12734
|
| 522 |
+
rerun/experimental/dataloader/_utils.py,sha256=4zkQ9mkGWRjDEFpn-4o5iNeFVl-Q_4dtcvXSKw0Tbgg,43890
|
| 523 |
+
rerun/experimental/dataloader/_yuv.py,sha256=dwJjpfos6HTDK_tye4UHU2XHh2yOoeFcc7F6TI8vTd4,10615
|
| 524 |
+
rerun/experimental/dataloader/decoders/__init__.py,sha256=w2znApwhtm1DGWzLJmSv1w8LJKbeArJzmjBKVXJN9tY,514
|
| 525 |
+
rerun/experimental/dataloader/decoders/_arrow.py,sha256=7dyyJ45iL2oCYLWW8XvzIq4cYcipmicA_mPrw18Xljw,3408
|
| 526 |
+
rerun/experimental/dataloader/decoders/_base.py,sha256=6wROV1XROMnUz9IcCv-l7Ip59ywpVVQg4rI7LGyxy0w,10149
|
| 527 |
+
rerun/experimental/dataloader/decoders/_image.py,sha256=xYUWJzfUf9bx-7veFmKVJK60xdwFMUKcScYDndJEsWM,1885
|
| 528 |
+
rerun/experimental/dataloader/decoders/_numeric.py,sha256=ldJPkG-nYeZ5-2FY9_Lii-357HOJPNKOVk7g_tGaZrk,3924
|
| 529 |
+
rerun/experimental/dataloader/decoders/_video.py,sha256=GfSnyizR62Dk0KnCUYFFgGZxzvuNHx-fNSxjUe4EXPg,39821
|
| 530 |
+
rerun/experimental/dataloader/manifest/__init__.py,sha256=QCjVUnV9B7SzHJxBDfAYKhMAEBxWeVLYpHlu8tBnqhQ,139
|
| 531 |
+
rerun/experimental/dataloader/manifest/_manifest.py,sha256=pwsRcNbWCV7S-EILBsJB6QQYJgwmB-d9p_VMpFm7JP4,14597
|
| 532 |
+
rerun/experimental/dataloader/manifest/_manifest_build.py,sha256=3xKiQKuTZ8FXBLX02P6QzCWRS_-yq5GfSeuodhP1S7c,27642
|
| 533 |
+
rerun/experimental/dataloader/manifest/_manifest_read.py,sha256=H8iRWcA23m9b5tGhiDX6fzAPFq5tqUEVvvTkT2RCA84,2529
|
| 534 |
+
rerun/experimental/video.py,sha256=fSX2pf5QigS8atD_94X4s2QBpDTBbduXe9m2lZkUeQA,886
|
| 535 |
+
rerun/notebook.py,sha256=6UqbesPQUG5b1i_PhNIHP1BZx6Xz6we6Vo1XUuubNMY,20380
|
| 536 |
+
rerun/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 537 |
+
rerun/recording_stream.py,sha256=9fQodrQXOpj2zLy5HCpdqFMIgBJ3Itc1e1ptwRSKjZE,61543
|
| 538 |
+
rerun/server.py,sha256=BFVMKbjJQJV5wvp6ojIdSKLij9Tq42qNwhB2Yo1R4hU,6976
|
| 539 |
+
rerun/sinks.py,sha256=aBwOjRFxApHd330uimQ5hlcWgG9Bko0xeRJyGqzcMNA,20565
|
| 540 |
+
rerun/time.py,sha256=w_44gYzLNUhslZswM0kl-GcmADC1YpxHeBWEMa-3xX8,9319
|
| 541 |
+
rerun/urdf.py,sha256=RHdjC0WvlLnqPp5SGAp5dbEy-w-gNE5-vwTQGF26EIk,12928
|
| 542 |
+
rerun/utilities/__init__.py,sha256=FtdAoZMt7SnMkIRjshMGSkqytx6Tpvtv2VoGyJ5jzxI,326
|
| 543 |
+
rerun/utilities/_data.py,sha256=q9M2WfL_5Myo7Xi58epW1BmLa1Z-CemVKFFweNvByFE,2697
|
| 544 |
+
rerun/utilities/_turbo.py,sha256=W5RhRDEeXFS9nizfySD3rkMTnEbBhoJKsNVftUKqHB8,8540
|
| 545 |
+
rerun/utilities/_util.py,sha256=Ssnebz3NMMtZzOxKTUngVmivCbY-fPEn2m9iQR8QJbw,680
|
| 546 |
+
rerun/utilities/datafusion/__init__.py,sha256=xP_nIRnlkKJWFjGdzZxvNQFVY0GEbDMsJ9GEK4amm5I,28
|
| 547 |
+
rerun/utilities/datafusion/collect.py,sha256=43xCKtROnAAW6Yps_NpxOH2aN7POyQjQwdHF24bg15M,1377
|
| 548 |
+
rerun/utilities/datafusion/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 549 |
+
rerun/utilities/datafusion/functions/url_generation.py,sha256=rhH9__LuQGUbMacR-yhK1lrozRh17jxBTtxb4FkhLIo,4831
|
| 550 |
+
rerun/web.py,sha256=-lxlxb3BAZr51s1lB1Y16kQidhIjx3XM5Hlz6iZ4r_Y,1775
|
| 551 |
+
rerun_bindings/THIRD_PARTY_NOTICES.md,sha256=eq9I6h6lgqpFZS18B58f2rQG-mrhcegWgx00ZzynCxE,264508
|
| 552 |
+
rerun_bindings/__init__.py,sha256=7Z4XY5paVddfLRJkrbms9pPmRP0-nIORXhCpeyZxWGE,1035
|
| 553 |
+
rerun_bindings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 554 |
+
rerun_bindings/rerun_bindings.pyd,sha256=MYnF7976LYEPcQ5WnsQMJC7DDuAXEZBNhd72bDukfYA,170249216
|
| 555 |
+
rerun_bindings/rerun_bindings.pyi,sha256=fwkgsc_CFg5LDpFZUjL7Qz9WM_3FogKEe69qQ9o85DY,76080
|
| 556 |
+
rerun_bindings/types.py,sha256=RxPq5NeSOZWhKDs97zD3rdVOdZM6DYS5R3yMTX_u-JE,2111
|
| 557 |
+
rerun_cli/THIRD_PARTY_NOTICES.md,sha256=AdzYqfjGuL2ShrB3TJACkb79MMck2DoVMCpYxxCcfD4,300749
|
| 558 |
+
rerun_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 559 |
+
rerun_cli/__main__.py,sha256=zbTXd3rrcUtuyLTxbsxjF7O6-NJh-ouENqVOQwikX7s,1259
|
| 560 |
+
rerun_cli/rerun.exe,sha256=aaDDTvdoYXPjW-FgbuXFmVuuFkcL3UnO_AhBhxP8C-A,221251584
|
| 561 |
+
rerun_sdk-0.41.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 562 |
+
rerun_sdk-0.41.0.dist-info/METADATA,sha256=KxWUaIpeqLUTIzQavEjecLa6WN0vkx6GMpHTTctbTHs,7200
|
| 563 |
+
rerun_sdk-0.41.0.dist-info/RECORD,,
|
| 564 |
+
rerun_sdk-0.41.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 565 |
+
rerun_sdk-0.41.0.dist-info/WHEEL,sha256=nv5WBZ27cxxDjIIqxBMqK2cOF025DwkFmqJGqL3SpXU,96
|
| 566 |
+
rerun_sdk-0.41.0.dist-info/entry_points.txt,sha256=ntpVYXEXKXnMnitEQHofsgTecLukO-Ru15gddOIf66A,48
|
| 567 |
+
rerun_sdk-0.41.0.dist-info/licenses/LICENSE-APACHE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
| 568 |
+
rerun_sdk-0.41.0.dist-info/licenses/LICENSE-MIT,sha256=fT21lGj5LXDxdhcN6s-KxoWLbXgBCjCuAeukK6wwKUA,1087
|
| 569 |
+
rerun_sdk-0.41.0.dist-info/sboms/rerun_py.cyclonedx.json,sha256=WmNrEKdPpwmyvmZUtMK5f7DoykZT3aJbJAFxUOIUAEk,1051529
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/REQUESTED
ADDED
|
File without changes
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: maturin (1.14.1)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp311-abi3-win_amd64
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
rerun=rerun_cli.__main__:main
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/licenses/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/licenses/LICENSE-MIT
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2022 Rerun Technologies AB <opensource@rerun.io>
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any
|
| 4 |
+
person obtaining a copy of this software and associated
|
| 5 |
+
documentation files (the "Software"), to deal in the
|
| 6 |
+
Software without restriction, including without
|
| 7 |
+
limitation the rights to use, copy, modify, merge,
|
| 8 |
+
publish, distribute, sublicense, and/or sell copies of
|
| 9 |
+
the Software, and to permit persons to whom the Software
|
| 10 |
+
is furnished to do so, subject to the following
|
| 11 |
+
conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice
|
| 14 |
+
shall be included in all copies or substantial portions
|
| 15 |
+
of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
| 18 |
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
| 19 |
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
| 20 |
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
| 21 |
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 22 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 23 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
| 24 |
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 25 |
+
DEALINGS IN THE SOFTWARE.
|
player/runtime/python/Lib/site-packages/rerun_sdk-0.41.0.dist-info/sboms/rerun_py.cyclonedx.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: typing_extensions
|
| 3 |
+
Version: 4.16.0
|
| 4 |
+
Summary: Backported and Experimental Type Hints for Python 3.9+
|
| 5 |
+
Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing
|
| 6 |
+
Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" <levkivskyi@gmail.com>
|
| 7 |
+
Requires-Python: >=3.9
|
| 8 |
+
Description-Content-Type: text/markdown
|
| 9 |
+
License-Expression: PSF-2.0
|
| 10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 11 |
+
Classifier: Environment :: Console
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: Operating System :: OS Independent
|
| 14 |
+
Classifier: Programming Language :: Python :: 3
|
| 15 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.15
|
| 23 |
+
Classifier: Topic :: Software Development
|
| 24 |
+
License-File: LICENSE
|
| 25 |
+
Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues
|
| 26 |
+
Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md
|
| 27 |
+
Project-URL: Documentation, https://typing-extensions.readthedocs.io/
|
| 28 |
+
Project-URL: Home, https://github.com/python/typing_extensions
|
| 29 |
+
Project-URL: Q & A, https://github.com/python/typing/discussions
|
| 30 |
+
Project-URL: Repository, https://github.com/python/typing_extensions
|
| 31 |
+
|
| 32 |
+
# Typing Extensions
|
| 33 |
+
|
| 34 |
+
[](https://gitter.im/python/typing)
|
| 35 |
+
|
| 36 |
+
[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) –
|
| 37 |
+
[PyPI](https://pypi.org/project/typing-extensions/)
|
| 38 |
+
|
| 39 |
+
## Overview
|
| 40 |
+
|
| 41 |
+
The `typing_extensions` module serves two related purposes:
|
| 42 |
+
|
| 43 |
+
- Enable use of new type system features on older Python versions. For example,
|
| 44 |
+
`typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows
|
| 45 |
+
users on previous Python versions to use it too.
|
| 46 |
+
- Enable experimentation with new type system PEPs before they are accepted and
|
| 47 |
+
added to the `typing` module.
|
| 48 |
+
|
| 49 |
+
`typing_extensions` is treated specially by static type checkers such as
|
| 50 |
+
mypy and pyright. Objects defined in `typing_extensions` are treated the same
|
| 51 |
+
way as equivalent forms in `typing`.
|
| 52 |
+
|
| 53 |
+
`typing_extensions` uses
|
| 54 |
+
[Semantic Versioning](https://semver.org/). The
|
| 55 |
+
major version will be incremented only for backwards-incompatible changes.
|
| 56 |
+
Therefore, it's safe to depend
|
| 57 |
+
on `typing_extensions` like this: `typing_extensions ~=x.y`,
|
| 58 |
+
where `x.y` is the first version that includes all features you need.
|
| 59 |
+
[This](https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release)
|
| 60 |
+
is equivalent to `typing_extensions >=x.y, <(x+1)`. Do not depend on `~= x.y.z`
|
| 61 |
+
unless you really know what you're doing; that defeats the purpose of
|
| 62 |
+
semantic versioning.
|
| 63 |
+
|
| 64 |
+
## Included items
|
| 65 |
+
|
| 66 |
+
See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a
|
| 67 |
+
complete listing of module contents.
|
| 68 |
+
|
| 69 |
+
## Contributing
|
| 70 |
+
|
| 71 |
+
See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md)
|
| 72 |
+
for how to contribute to `typing_extensions`.
|
| 73 |
+
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
typing_extensions-4.16.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
typing_extensions-4.16.0.dist-info/METADATA,sha256=sFCEyh1Qh5hlF42f_5-r6rYb37HzYb-96VQh_8j5vkY,3310
|
| 3 |
+
typing_extensions-4.16.0.dist-info/RECORD,,
|
| 4 |
+
typing_extensions-4.16.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
typing_extensions-4.16.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
| 6 |
+
typing_extensions-4.16.0.dist-info/licenses/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
|
| 7 |
+
typing_extensions.py,sha256=QEDKGh7L7gDROFwSqTCE0cW9RvC3dPB-WufpHE9V5pY,165012
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/REQUESTED
ADDED
|
File without changes
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: flit 3.12.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
player/runtime/python/Lib/site-packages/typing_extensions-4.16.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
A. HISTORY OF THE SOFTWARE
|
| 2 |
+
==========================
|
| 3 |
+
|
| 4 |
+
Python was created in the early 1990s by Guido van Rossum at Stichting
|
| 5 |
+
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
|
| 6 |
+
as a successor of a language called ABC. Guido remains Python's
|
| 7 |
+
principal author, although it includes many contributions from others.
|
| 8 |
+
|
| 9 |
+
In 1995, Guido continued his work on Python at the Corporation for
|
| 10 |
+
National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
|
| 11 |
+
in Reston, Virginia where he released several versions of the
|
| 12 |
+
software.
|
| 13 |
+
|
| 14 |
+
In May 2000, Guido and the Python core development team moved to
|
| 15 |
+
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
| 16 |
+
year, the PythonLabs team moved to Digital Creations, which became
|
| 17 |
+
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
| 18 |
+
https://www.python.org/psf/) was formed, a non-profit organization
|
| 19 |
+
created specifically to own Python-related Intellectual Property.
|
| 20 |
+
Zope Corporation was a sponsoring member of the PSF.
|
| 21 |
+
|
| 22 |
+
All Python releases are Open Source (see https://opensource.org for
|
| 23 |
+
the Open Source Definition). Historically, most, but not all, Python
|
| 24 |
+
releases have also been GPL-compatible; the table below summarizes
|
| 25 |
+
the various releases.
|
| 26 |
+
|
| 27 |
+
Release Derived Year Owner GPL-
|
| 28 |
+
from compatible? (1)
|
| 29 |
+
|
| 30 |
+
0.9.0 thru 1.2 1991-1995 CWI yes
|
| 31 |
+
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
| 32 |
+
1.6 1.5.2 2000 CNRI no
|
| 33 |
+
2.0 1.6 2000 BeOpen.com no
|
| 34 |
+
1.6.1 1.6 2001 CNRI yes (2)
|
| 35 |
+
2.1 2.0+1.6.1 2001 PSF no
|
| 36 |
+
2.0.1 2.0+1.6.1 2001 PSF yes
|
| 37 |
+
2.1.1 2.1+2.0.1 2001 PSF yes
|
| 38 |
+
2.1.2 2.1.1 2002 PSF yes
|
| 39 |
+
2.1.3 2.1.2 2002 PSF yes
|
| 40 |
+
2.2 and above 2.1.1 2001-now PSF yes
|
| 41 |
+
|
| 42 |
+
Footnotes:
|
| 43 |
+
|
| 44 |
+
(1) GPL-compatible doesn't mean that we're distributing Python under
|
| 45 |
+
the GPL. All Python licenses, unlike the GPL, let you distribute
|
| 46 |
+
a modified version without making your changes open source. The
|
| 47 |
+
GPL-compatible licenses make it possible to combine Python with
|
| 48 |
+
other software that is released under the GPL; the others don't.
|
| 49 |
+
|
| 50 |
+
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
| 51 |
+
because its license has a choice of law clause. According to
|
| 52 |
+
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
| 53 |
+
is "not incompatible" with the GPL.
|
| 54 |
+
|
| 55 |
+
Thanks to the many outside volunteers who have worked under Guido's
|
| 56 |
+
direction to make these releases possible.
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
| 60 |
+
===============================================================
|
| 61 |
+
|
| 62 |
+
Python software and documentation are licensed under the
|
| 63 |
+
Python Software Foundation License Version 2.
|
| 64 |
+
|
| 65 |
+
Starting with Python 3.8.6, examples, recipes, and other code in
|
| 66 |
+
the documentation are dual licensed under the PSF License Version 2
|
| 67 |
+
and the Zero-Clause BSD license.
|
| 68 |
+
|
| 69 |
+
Some software incorporated into Python is under different licenses.
|
| 70 |
+
The licenses are listed with code falling under that license.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
| 74 |
+
--------------------------------------------
|
| 75 |
+
|
| 76 |
+
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
| 77 |
+
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
| 78 |
+
otherwise using this software ("Python") in source or binary form and
|
| 79 |
+
its associated documentation.
|
| 80 |
+
|
| 81 |
+
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
| 82 |
+
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
| 83 |
+
analyze, test, perform and/or display publicly, prepare derivative works,
|
| 84 |
+
distribute, and otherwise use Python alone or in any derivative version,
|
| 85 |
+
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
| 86 |
+
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
| 87 |
+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
|
| 88 |
+
All Rights Reserved" are retained in Python alone or in any derivative version
|
| 89 |
+
prepared by Licensee.
|
| 90 |
+
|
| 91 |
+
3. In the event Licensee prepares a derivative work that is based on
|
| 92 |
+
or incorporates Python or any part thereof, and wants to make
|
| 93 |
+
the derivative work available to others as provided herein, then
|
| 94 |
+
Licensee hereby agrees to include in any such work a brief summary of
|
| 95 |
+
the changes made to Python.
|
| 96 |
+
|
| 97 |
+
4. PSF is making Python available to Licensee on an "AS IS"
|
| 98 |
+
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
| 99 |
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
| 100 |
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
| 101 |
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
| 102 |
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
| 103 |
+
|
| 104 |
+
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
| 105 |
+
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
| 106 |
+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
| 107 |
+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
| 108 |
+
|
| 109 |
+
6. This License Agreement will automatically terminate upon a material
|
| 110 |
+
breach of its terms and conditions.
|
| 111 |
+
|
| 112 |
+
7. Nothing in this License Agreement shall be deemed to create any
|
| 113 |
+
relationship of agency, partnership, or joint venture between PSF and
|
| 114 |
+
Licensee. This License Agreement does not grant permission to use PSF
|
| 115 |
+
trademarks or trade name in a trademark sense to endorse or promote
|
| 116 |
+
products or services of Licensee, or any third party.
|
| 117 |
+
|
| 118 |
+
8. By copying, installing or otherwise using Python, Licensee
|
| 119 |
+
agrees to be bound by the terms and conditions of this License
|
| 120 |
+
Agreement.
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
| 124 |
+
-------------------------------------------
|
| 125 |
+
|
| 126 |
+
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
| 127 |
+
|
| 128 |
+
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
| 129 |
+
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
| 130 |
+
Individual or Organization ("Licensee") accessing and otherwise using
|
| 131 |
+
this software in source or binary form and its associated
|
| 132 |
+
documentation ("the Software").
|
| 133 |
+
|
| 134 |
+
2. Subject to the terms and conditions of this BeOpen Python License
|
| 135 |
+
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
| 136 |
+
royalty-free, world-wide license to reproduce, analyze, test, perform
|
| 137 |
+
and/or display publicly, prepare derivative works, distribute, and
|
| 138 |
+
otherwise use the Software alone or in any derivative version,
|
| 139 |
+
provided, however, that the BeOpen Python License is retained in the
|
| 140 |
+
Software, alone or in any derivative version prepared by Licensee.
|
| 141 |
+
|
| 142 |
+
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
| 143 |
+
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
| 144 |
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
| 145 |
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
| 146 |
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
| 147 |
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
| 148 |
+
|
| 149 |
+
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
| 150 |
+
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
| 151 |
+
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
| 152 |
+
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
| 153 |
+
|
| 154 |
+
5. This License Agreement will automatically terminate upon a material
|
| 155 |
+
breach of its terms and conditions.
|
| 156 |
+
|
| 157 |
+
6. This License Agreement shall be governed by and interpreted in all
|
| 158 |
+
respects by the law of the State of California, excluding conflict of
|
| 159 |
+
law provisions. Nothing in this License Agreement shall be deemed to
|
| 160 |
+
create any relationship of agency, partnership, or joint venture
|
| 161 |
+
between BeOpen and Licensee. This License Agreement does not grant
|
| 162 |
+
permission to use BeOpen trademarks or trade names in a trademark
|
| 163 |
+
sense to endorse or promote products or services of Licensee, or any
|
| 164 |
+
third party. As an exception, the "BeOpen Python" logos available at
|
| 165 |
+
http://www.pythonlabs.com/logos.html may be used according to the
|
| 166 |
+
permissions granted on that web page.
|
| 167 |
+
|
| 168 |
+
7. By copying, installing or otherwise using the software, Licensee
|
| 169 |
+
agrees to be bound by the terms and conditions of this License
|
| 170 |
+
Agreement.
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
| 174 |
+
---------------------------------------
|
| 175 |
+
|
| 176 |
+
1. This LICENSE AGREEMENT is between the Corporation for National
|
| 177 |
+
Research Initiatives, having an office at 1895 Preston White Drive,
|
| 178 |
+
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
| 179 |
+
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
| 180 |
+
source or binary form and its associated documentation.
|
| 181 |
+
|
| 182 |
+
2. Subject to the terms and conditions of this License Agreement, CNRI
|
| 183 |
+
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
| 184 |
+
license to reproduce, analyze, test, perform and/or display publicly,
|
| 185 |
+
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
| 186 |
+
alone or in any derivative version, provided, however, that CNRI's
|
| 187 |
+
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
| 188 |
+
1995-2001 Corporation for National Research Initiatives; All Rights
|
| 189 |
+
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
| 190 |
+
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
| 191 |
+
Agreement, Licensee may substitute the following text (omitting the
|
| 192 |
+
quotes): "Python 1.6.1 is made available subject to the terms and
|
| 193 |
+
conditions in CNRI's License Agreement. This Agreement together with
|
| 194 |
+
Python 1.6.1 may be located on the internet using the following
|
| 195 |
+
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
| 196 |
+
Agreement may also be obtained from a proxy server on the internet
|
| 197 |
+
using the following URL: http://hdl.handle.net/1895.22/1013".
|
| 198 |
+
|
| 199 |
+
3. In the event Licensee prepares a derivative work that is based on
|
| 200 |
+
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
| 201 |
+
the derivative work available to others as provided herein, then
|
| 202 |
+
Licensee hereby agrees to include in any such work a brief summary of
|
| 203 |
+
the changes made to Python 1.6.1.
|
| 204 |
+
|
| 205 |
+
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
| 206 |
+
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
| 207 |
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
| 208 |
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
| 209 |
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
| 210 |
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
| 211 |
+
|
| 212 |
+
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
| 213 |
+
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
| 214 |
+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
| 215 |
+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
| 216 |
+
|
| 217 |
+
6. This License Agreement will automatically terminate upon a material
|
| 218 |
+
breach of its terms and conditions.
|
| 219 |
+
|
| 220 |
+
7. This License Agreement shall be governed by the federal
|
| 221 |
+
intellectual property law of the United States, including without
|
| 222 |
+
limitation the federal copyright law, and, to the extent such
|
| 223 |
+
U.S. federal law does not apply, by the law of the Commonwealth of
|
| 224 |
+
Virginia, excluding Virginia's conflict of law provisions.
|
| 225 |
+
Notwithstanding the foregoing, with regard to derivative works based
|
| 226 |
+
on Python 1.6.1 that incorporate non-separable material that was
|
| 227 |
+
previously distributed under the GNU General Public License (GPL), the
|
| 228 |
+
law of the Commonwealth of Virginia shall govern this License
|
| 229 |
+
Agreement only as to issues arising under or with respect to
|
| 230 |
+
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
| 231 |
+
License Agreement shall be deemed to create any relationship of
|
| 232 |
+
agency, partnership, or joint venture between CNRI and Licensee. This
|
| 233 |
+
License Agreement does not grant permission to use CNRI trademarks or
|
| 234 |
+
trade name in a trademark sense to endorse or promote products or
|
| 235 |
+
services of Licensee, or any third party.
|
| 236 |
+
|
| 237 |
+
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
| 238 |
+
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
| 239 |
+
bound by the terms and conditions of this License Agreement.
|
| 240 |
+
|
| 241 |
+
ACCEPT
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
| 245 |
+
--------------------------------------------------
|
| 246 |
+
|
| 247 |
+
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
| 248 |
+
The Netherlands. All rights reserved.
|
| 249 |
+
|
| 250 |
+
Permission to use, copy, modify, and distribute this software and its
|
| 251 |
+
documentation for any purpose and without fee is hereby granted,
|
| 252 |
+
provided that the above copyright notice appear in all copies and that
|
| 253 |
+
both that copyright notice and this permission notice appear in
|
| 254 |
+
supporting documentation, and that the name of Stichting Mathematisch
|
| 255 |
+
Centrum or CWI not be used in advertising or publicity pertaining to
|
| 256 |
+
distribution of the software without specific, written prior
|
| 257 |
+
permission.
|
| 258 |
+
|
| 259 |
+
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
| 260 |
+
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
| 261 |
+
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
| 262 |
+
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 263 |
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 264 |
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
| 265 |
+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 266 |
+
|
| 267 |
+
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
|
| 268 |
+
----------------------------------------------------------------------
|
| 269 |
+
|
| 270 |
+
Permission to use, copy, modify, and/or distribute this software for any
|
| 271 |
+
purpose with or without fee is hereby granted.
|
| 272 |
+
|
| 273 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
| 274 |
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
| 275 |
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
| 276 |
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
| 277 |
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
| 278 |
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
| 279 |
+
PERFORMANCE OF THIS SOFTWARE.
|
player/runtime/python/Lib/site-packages/typing_extensions.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
player/runtime/python/Lib/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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Append module search paths for third-party packages to sys.path.
|
| 2 |
+
|
| 3 |
+
****************************************************************
|
| 4 |
+
* This module is automatically imported during initialization. *
|
| 5 |
+
****************************************************************
|
| 6 |
+
|
| 7 |
+
This will append site-specific paths to the module search path. On
|
| 8 |
+
Unix (including Mac OSX), it starts with sys.prefix and
|
| 9 |
+
sys.exec_prefix (if different) and appends
|
| 10 |
+
lib/python<version>/site-packages.
|
| 11 |
+
On other platforms (such as Windows), it tries each of the
|
| 12 |
+
prefixes directly, as well as with lib/site-packages appended. The
|
| 13 |
+
resulting directories, if they exist, are appended to sys.path, and
|
| 14 |
+
also inspected for path configuration files.
|
| 15 |
+
|
| 16 |
+
If a file named "pyvenv.cfg" exists one directory above sys.executable,
|
| 17 |
+
sys.prefix and sys.exec_prefix are set to that directory and
|
| 18 |
+
it is also checked for site-packages (sys.base_prefix and
|
| 19 |
+
sys.base_exec_prefix will always be the "real" prefixes of the Python
|
| 20 |
+
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
|
| 21 |
+
the key "include-system-site-packages" set to anything other than "false"
|
| 22 |
+
(case-insensitive), the system-level prefixes will still also be
|
| 23 |
+
searched for site-packages; otherwise they won't.
|
| 24 |
+
|
| 25 |
+
All of the resulting site-specific directories, if they exist, are
|
| 26 |
+
appended to sys.path, and also inspected for path configuration
|
| 27 |
+
files.
|
| 28 |
+
|
| 29 |
+
A path configuration file is a file whose name has the form
|
| 30 |
+
<package>.pth; its contents are additional directories (one per line)
|
| 31 |
+
to be added to sys.path. Non-existing directories (or
|
| 32 |
+
non-directories) are never added to sys.path; no directory is added to
|
| 33 |
+
sys.path more than once. Blank lines and lines beginning with
|
| 34 |
+
'#' are skipped. Lines starting with 'import' are executed.
|
| 35 |
+
|
| 36 |
+
For example, suppose sys.prefix and sys.exec_prefix are set to
|
| 37 |
+
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
|
| 38 |
+
with three subdirectories, foo, bar and spam, and two path
|
| 39 |
+
configuration files, foo.pth and bar.pth. Assume foo.pth contains the
|
| 40 |
+
following:
|
| 41 |
+
|
| 42 |
+
# foo package configuration
|
| 43 |
+
foo
|
| 44 |
+
bar
|
| 45 |
+
bletch
|
| 46 |
+
|
| 47 |
+
and bar.pth contains:
|
| 48 |
+
|
| 49 |
+
# bar package configuration
|
| 50 |
+
bar
|
| 51 |
+
|
| 52 |
+
Then the following directories are added to sys.path, in this order:
|
| 53 |
+
|
| 54 |
+
/usr/local/lib/python2.5/site-packages/bar
|
| 55 |
+
/usr/local/lib/python2.5/site-packages/foo
|
| 56 |
+
|
| 57 |
+
Note that bletch is omitted because it doesn't exist; bar precedes foo
|
| 58 |
+
because bar.pth comes alphabetically before foo.pth; and spam is
|
| 59 |
+
omitted because it is not mentioned in either path configuration file.
|
| 60 |
+
|
| 61 |
+
The readline module is also automatically configured to enable
|
| 62 |
+
completion for systems that support it. This can be overridden in
|
| 63 |
+
sitecustomize, usercustomize or PYTHONSTARTUP. Starting Python in
|
| 64 |
+
isolated mode (-I) disables automatic readline configuration.
|
| 65 |
+
|
| 66 |
+
After these operations, an attempt is made to import a module
|
| 67 |
+
named sitecustomize, which can perform arbitrary additional
|
| 68 |
+
site-specific customizations. If this import fails with an
|
| 69 |
+
ImportError exception, it is silently ignored.
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
import sys
|
| 73 |
+
import os
|
| 74 |
+
import builtins
|
| 75 |
+
import _sitebuiltins
|
| 76 |
+
import io
|
| 77 |
+
import stat
|
| 78 |
+
|
| 79 |
+
# Prefixes for site-packages; add additional prefixes like /usr/local here
|
| 80 |
+
PREFIXES = [sys.prefix, sys.exec_prefix]
|
| 81 |
+
# Enable per user site-packages directory
|
| 82 |
+
# set it to False to disable the feature or True to force the feature
|
| 83 |
+
ENABLE_USER_SITE = None
|
| 84 |
+
|
| 85 |
+
# for distutils.commands.install
|
| 86 |
+
# These values are initialized by the getuserbase() and getusersitepackages()
|
| 87 |
+
# functions, through the main() function when Python starts.
|
| 88 |
+
USER_SITE = None
|
| 89 |
+
USER_BASE = None
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def _trace(message):
|
| 93 |
+
if sys.flags.verbose:
|
| 94 |
+
print(message, file=sys.stderr)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def makepath(*paths):
|
| 98 |
+
dir = os.path.join(*paths)
|
| 99 |
+
try:
|
| 100 |
+
dir = os.path.abspath(dir)
|
| 101 |
+
except OSError:
|
| 102 |
+
pass
|
| 103 |
+
return dir, os.path.normcase(dir)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def abs_paths():
|
| 107 |
+
"""Set all module __file__ and __cached__ attributes to an absolute path"""
|
| 108 |
+
for m in set(sys.modules.values()):
|
| 109 |
+
loader_module = None
|
| 110 |
+
try:
|
| 111 |
+
loader_module = m.__loader__.__module__
|
| 112 |
+
except AttributeError:
|
| 113 |
+
try:
|
| 114 |
+
loader_module = m.__spec__.loader.__module__
|
| 115 |
+
except AttributeError:
|
| 116 |
+
pass
|
| 117 |
+
if loader_module not in {'_frozen_importlib', '_frozen_importlib_external'}:
|
| 118 |
+
continue # don't mess with a PEP 302-supplied __file__
|
| 119 |
+
try:
|
| 120 |
+
m.__file__ = os.path.abspath(m.__file__)
|
| 121 |
+
except (AttributeError, OSError, TypeError):
|
| 122 |
+
pass
|
| 123 |
+
try:
|
| 124 |
+
m.__cached__ = os.path.abspath(m.__cached__)
|
| 125 |
+
except (AttributeError, OSError, TypeError):
|
| 126 |
+
pass
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def removeduppaths():
|
| 130 |
+
""" Remove duplicate entries from sys.path along with making them
|
| 131 |
+
absolute"""
|
| 132 |
+
# This ensures that the initial path provided by the interpreter contains
|
| 133 |
+
# only absolute pathnames, even if we're running from the build directory.
|
| 134 |
+
L = []
|
| 135 |
+
known_paths = set()
|
| 136 |
+
for dir in sys.path:
|
| 137 |
+
# Filter out duplicate paths (on case-insensitive file systems also
|
| 138 |
+
# if they only differ in case); turn relative paths into absolute
|
| 139 |
+
# paths.
|
| 140 |
+
dir, dircase = makepath(dir)
|
| 141 |
+
if dircase not in known_paths:
|
| 142 |
+
L.append(dir)
|
| 143 |
+
known_paths.add(dircase)
|
| 144 |
+
sys.path[:] = L
|
| 145 |
+
return known_paths
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def _init_pathinfo():
|
| 149 |
+
"""Return a set containing all existing file system items from sys.path."""
|
| 150 |
+
d = set()
|
| 151 |
+
for item in sys.path:
|
| 152 |
+
try:
|
| 153 |
+
if os.path.exists(item):
|
| 154 |
+
_, itemcase = makepath(item)
|
| 155 |
+
d.add(itemcase)
|
| 156 |
+
except TypeError:
|
| 157 |
+
continue
|
| 158 |
+
return d
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def addpackage(sitedir, name, known_paths):
|
| 162 |
+
"""Process a .pth file within the site-packages directory:
|
| 163 |
+
For each line in the file, either combine it with sitedir to a path
|
| 164 |
+
and add that to known_paths, or execute it if it starts with 'import '.
|
| 165 |
+
"""
|
| 166 |
+
if known_paths is None:
|
| 167 |
+
known_paths = _init_pathinfo()
|
| 168 |
+
reset = True
|
| 169 |
+
else:
|
| 170 |
+
reset = False
|
| 171 |
+
fullname = os.path.join(sitedir, name)
|
| 172 |
+
try:
|
| 173 |
+
st = os.lstat(fullname)
|
| 174 |
+
except OSError:
|
| 175 |
+
return
|
| 176 |
+
if ((getattr(st, 'st_flags', 0) & stat.UF_HIDDEN) or
|
| 177 |
+
(getattr(st, 'st_file_attributes', 0) & stat.FILE_ATTRIBUTE_HIDDEN)):
|
| 178 |
+
_trace(f"Skipping hidden .pth file: {fullname!r}")
|
| 179 |
+
return
|
| 180 |
+
_trace(f"Processing .pth file: {fullname!r}")
|
| 181 |
+
try:
|
| 182 |
+
with io.open_code(fullname) as f:
|
| 183 |
+
pth_content = f.read()
|
| 184 |
+
except OSError:
|
| 185 |
+
return
|
| 186 |
+
|
| 187 |
+
try:
|
| 188 |
+
# Accept BOM markers in .pth files as we do in source files
|
| 189 |
+
# (Windows PowerShell 5.1 makes it hard to emit UTF-8 files without a BOM)
|
| 190 |
+
pth_content = pth_content.decode("utf-8-sig")
|
| 191 |
+
except UnicodeDecodeError:
|
| 192 |
+
# Fallback to locale encoding for backward compatibility.
|
| 193 |
+
# We will deprecate this fallback in the future.
|
| 194 |
+
import locale
|
| 195 |
+
pth_content = pth_content.decode(locale.getencoding())
|
| 196 |
+
_trace(f"Cannot read {fullname!r} as UTF-8. "
|
| 197 |
+
f"Using fallback encoding {locale.getencoding()!r}")
|
| 198 |
+
|
| 199 |
+
for n, line in enumerate(pth_content.splitlines(), 1):
|
| 200 |
+
if line.startswith("#"):
|
| 201 |
+
continue
|
| 202 |
+
if line.strip() == "":
|
| 203 |
+
continue
|
| 204 |
+
try:
|
| 205 |
+
if line.startswith(("import ", "import\t")):
|
| 206 |
+
exec(line)
|
| 207 |
+
continue
|
| 208 |
+
line = line.rstrip()
|
| 209 |
+
dir, dircase = makepath(sitedir, line)
|
| 210 |
+
if dircase not in known_paths and os.path.exists(dir):
|
| 211 |
+
sys.path.append(dir)
|
| 212 |
+
known_paths.add(dircase)
|
| 213 |
+
except Exception as exc:
|
| 214 |
+
print(f"Error processing line {n:d} of {fullname}:\n",
|
| 215 |
+
file=sys.stderr)
|
| 216 |
+
import traceback
|
| 217 |
+
for record in traceback.format_exception(exc):
|
| 218 |
+
for line in record.splitlines():
|
| 219 |
+
print(' '+line, file=sys.stderr)
|
| 220 |
+
print("\nRemainder of file ignored", file=sys.stderr)
|
| 221 |
+
break
|
| 222 |
+
if reset:
|
| 223 |
+
known_paths = None
|
| 224 |
+
return known_paths
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
def addsitedir(sitedir, known_paths=None):
|
| 228 |
+
"""Add 'sitedir' argument to sys.path if missing and handle .pth files in
|
| 229 |
+
'sitedir'"""
|
| 230 |
+
_trace(f"Adding directory: {sitedir!r}")
|
| 231 |
+
if known_paths is None:
|
| 232 |
+
known_paths = _init_pathinfo()
|
| 233 |
+
reset = True
|
| 234 |
+
else:
|
| 235 |
+
reset = False
|
| 236 |
+
sitedir, sitedircase = makepath(sitedir)
|
| 237 |
+
if not sitedircase in known_paths:
|
| 238 |
+
sys.path.append(sitedir) # Add path component
|
| 239 |
+
known_paths.add(sitedircase)
|
| 240 |
+
try:
|
| 241 |
+
names = os.listdir(sitedir)
|
| 242 |
+
except OSError:
|
| 243 |
+
return
|
| 244 |
+
names = [name for name in names
|
| 245 |
+
if name.endswith(".pth") and not name.startswith(".")]
|
| 246 |
+
for name in sorted(names):
|
| 247 |
+
addpackage(sitedir, name, known_paths)
|
| 248 |
+
if reset:
|
| 249 |
+
known_paths = None
|
| 250 |
+
return known_paths
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
def check_enableusersite():
|
| 254 |
+
"""Check if user site directory is safe for inclusion
|
| 255 |
+
|
| 256 |
+
The function tests for the command line flag (including environment var),
|
| 257 |
+
process uid/gid equal to effective uid/gid.
|
| 258 |
+
|
| 259 |
+
None: Disabled for security reasons
|
| 260 |
+
False: Disabled by user (command line option)
|
| 261 |
+
True: Safe and enabled
|
| 262 |
+
"""
|
| 263 |
+
if sys.flags.no_user_site:
|
| 264 |
+
return False
|
| 265 |
+
|
| 266 |
+
if hasattr(os, "getuid") and hasattr(os, "geteuid"):
|
| 267 |
+
# check process uid == effective uid
|
| 268 |
+
if os.geteuid() != os.getuid():
|
| 269 |
+
return None
|
| 270 |
+
if hasattr(os, "getgid") and hasattr(os, "getegid"):
|
| 271 |
+
# check process gid == effective gid
|
| 272 |
+
if os.getegid() != os.getgid():
|
| 273 |
+
return None
|
| 274 |
+
|
| 275 |
+
return True
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
# NOTE: sysconfig and it's dependencies are relatively large but site module
|
| 279 |
+
# needs very limited part of them.
|
| 280 |
+
# To speedup startup time, we have copy of them.
|
| 281 |
+
#
|
| 282 |
+
# See https://bugs.python.org/issue29585
|
| 283 |
+
|
| 284 |
+
# Copy of sysconfig._getuserbase()
|
| 285 |
+
def _getuserbase():
|
| 286 |
+
env_base = os.environ.get("PYTHONUSERBASE", None)
|
| 287 |
+
if env_base:
|
| 288 |
+
return env_base
|
| 289 |
+
|
| 290 |
+
# Emscripten, VxWorks, and WASI have no home directories
|
| 291 |
+
if sys.platform in {"emscripten", "vxworks", "wasi"}:
|
| 292 |
+
return None
|
| 293 |
+
|
| 294 |
+
def joinuser(*args):
|
| 295 |
+
return os.path.expanduser(os.path.join(*args))
|
| 296 |
+
|
| 297 |
+
if os.name == "nt":
|
| 298 |
+
base = os.environ.get("APPDATA") or "~"
|
| 299 |
+
return joinuser(base, "Python")
|
| 300 |
+
|
| 301 |
+
if sys.platform == "darwin" and sys._framework:
|
| 302 |
+
return joinuser("~", "Library", sys._framework,
|
| 303 |
+
"%d.%d" % sys.version_info[:2])
|
| 304 |
+
|
| 305 |
+
return joinuser("~", ".local")
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
# Same to sysconfig.get_path('purelib', os.name+'_user')
|
| 309 |
+
def _get_path(userbase):
|
| 310 |
+
version = sys.version_info
|
| 311 |
+
|
| 312 |
+
if os.name == 'nt':
|
| 313 |
+
ver_nodot = sys.winver.replace('.', '')
|
| 314 |
+
return f'{userbase}\\Python{ver_nodot}\\site-packages'
|
| 315 |
+
|
| 316 |
+
if sys.platform == 'darwin' and sys._framework:
|
| 317 |
+
return f'{userbase}/lib/python/site-packages'
|
| 318 |
+
|
| 319 |
+
return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
def getuserbase():
|
| 323 |
+
"""Returns the `user base` directory path.
|
| 324 |
+
|
| 325 |
+
The `user base` directory can be used to store data. If the global
|
| 326 |
+
variable ``USER_BASE`` is not initialized yet, this function will also set
|
| 327 |
+
it.
|
| 328 |
+
"""
|
| 329 |
+
global USER_BASE
|
| 330 |
+
if USER_BASE is None:
|
| 331 |
+
USER_BASE = _getuserbase()
|
| 332 |
+
return USER_BASE
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
def getusersitepackages():
|
| 336 |
+
"""Returns the user-specific site-packages directory path.
|
| 337 |
+
|
| 338 |
+
If the global variable ``USER_SITE`` is not initialized yet, this
|
| 339 |
+
function will also set it.
|
| 340 |
+
"""
|
| 341 |
+
global USER_SITE, ENABLE_USER_SITE
|
| 342 |
+
userbase = getuserbase() # this will also set USER_BASE
|
| 343 |
+
|
| 344 |
+
if USER_SITE is None:
|
| 345 |
+
if userbase is None:
|
| 346 |
+
ENABLE_USER_SITE = False # disable user site and return None
|
| 347 |
+
else:
|
| 348 |
+
USER_SITE = _get_path(userbase)
|
| 349 |
+
|
| 350 |
+
return USER_SITE
|
| 351 |
+
|
| 352 |
+
def addusersitepackages(known_paths):
|
| 353 |
+
"""Add a per user site-package to sys.path
|
| 354 |
+
|
| 355 |
+
Each user has its own python directory with site-packages in the
|
| 356 |
+
home directory.
|
| 357 |
+
"""
|
| 358 |
+
# get the per user site-package path
|
| 359 |
+
# this call will also make sure USER_BASE and USER_SITE are set
|
| 360 |
+
_trace("Processing user site-packages")
|
| 361 |
+
user_site = getusersitepackages()
|
| 362 |
+
|
| 363 |
+
if ENABLE_USER_SITE and os.path.isdir(user_site):
|
| 364 |
+
addsitedir(user_site, known_paths)
|
| 365 |
+
return known_paths
|
| 366 |
+
|
| 367 |
+
def getsitepackages(prefixes=None):
|
| 368 |
+
"""Returns a list containing all global site-packages directories.
|
| 369 |
+
|
| 370 |
+
For each directory present in ``prefixes`` (or the global ``PREFIXES``),
|
| 371 |
+
this function will find its `site-packages` subdirectory depending on the
|
| 372 |
+
system environment, and will return a list of full paths.
|
| 373 |
+
"""
|
| 374 |
+
sitepackages = []
|
| 375 |
+
seen = set()
|
| 376 |
+
|
| 377 |
+
if prefixes is None:
|
| 378 |
+
prefixes = PREFIXES
|
| 379 |
+
|
| 380 |
+
for prefix in prefixes:
|
| 381 |
+
if not prefix or prefix in seen:
|
| 382 |
+
continue
|
| 383 |
+
seen.add(prefix)
|
| 384 |
+
|
| 385 |
+
if os.sep == '/':
|
| 386 |
+
libdirs = [sys.platlibdir]
|
| 387 |
+
if sys.platlibdir != "lib":
|
| 388 |
+
libdirs.append("lib")
|
| 389 |
+
|
| 390 |
+
for libdir in libdirs:
|
| 391 |
+
path = os.path.join(prefix, libdir,
|
| 392 |
+
"python%d.%d" % sys.version_info[:2],
|
| 393 |
+
"site-packages")
|
| 394 |
+
sitepackages.append(path)
|
| 395 |
+
else:
|
| 396 |
+
sitepackages.append(prefix)
|
| 397 |
+
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
|
| 398 |
+
return sitepackages
|
| 399 |
+
|
| 400 |
+
def addsitepackages(known_paths, prefixes=None):
|
| 401 |
+
"""Add site-packages to sys.path"""
|
| 402 |
+
_trace("Processing global site-packages")
|
| 403 |
+
for sitedir in getsitepackages(prefixes):
|
| 404 |
+
if os.path.isdir(sitedir):
|
| 405 |
+
addsitedir(sitedir, known_paths)
|
| 406 |
+
|
| 407 |
+
return known_paths
|
| 408 |
+
|
| 409 |
+
def setquit():
|
| 410 |
+
"""Define new builtins 'quit' and 'exit'.
|
| 411 |
+
|
| 412 |
+
These are objects which make the interpreter exit when called.
|
| 413 |
+
The repr of each object contains a hint at how it works.
|
| 414 |
+
|
| 415 |
+
"""
|
| 416 |
+
if os.sep == '\\':
|
| 417 |
+
eof = 'Ctrl-Z plus Return'
|
| 418 |
+
else:
|
| 419 |
+
eof = 'Ctrl-D (i.e. EOF)'
|
| 420 |
+
|
| 421 |
+
builtins.quit = _sitebuiltins.Quitter('quit', eof)
|
| 422 |
+
builtins.exit = _sitebuiltins.Quitter('exit', eof)
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def setcopyright():
|
| 426 |
+
"""Set 'copyright' and 'credits' in builtins"""
|
| 427 |
+
builtins.copyright = _sitebuiltins._Printer("copyright", sys.copyright)
|
| 428 |
+
builtins.credits = _sitebuiltins._Printer("credits", """\
|
| 429 |
+
Thanks to CWI, CNRI, BeOpen, Zope Corporation, the Python Software
|
| 430 |
+
Foundation, and a cast of thousands for supporting Python
|
| 431 |
+
development. See www.python.org for more information.""")
|
| 432 |
+
files, dirs = [], []
|
| 433 |
+
# Not all modules are required to have a __file__ attribute. See
|
| 434 |
+
# PEP 420 for more details.
|
| 435 |
+
here = getattr(sys, '_stdlib_dir', None)
|
| 436 |
+
if not here and hasattr(os, '__file__'):
|
| 437 |
+
here = os.path.dirname(os.__file__)
|
| 438 |
+
if here:
|
| 439 |
+
files.extend(["LICENSE.txt", "LICENSE"])
|
| 440 |
+
dirs.extend([os.path.join(here, os.pardir), here, os.curdir])
|
| 441 |
+
builtins.license = _sitebuiltins._Printer(
|
| 442 |
+
"license",
|
| 443 |
+
"See https://www.python.org/psf/license/",
|
| 444 |
+
files, dirs)
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
def sethelper():
|
| 448 |
+
builtins.help = _sitebuiltins._Helper()
|
| 449 |
+
|
| 450 |
+
def enablerlcompleter():
|
| 451 |
+
"""Enable default readline configuration on interactive prompts, by
|
| 452 |
+
registering a sys.__interactivehook__.
|
| 453 |
+
|
| 454 |
+
If the readline module can be imported, the hook will set the Tab key
|
| 455 |
+
as completion key and register ~/.python_history as history file.
|
| 456 |
+
This can be overridden in the sitecustomize or usercustomize module,
|
| 457 |
+
or in a PYTHONSTARTUP file.
|
| 458 |
+
"""
|
| 459 |
+
def register_readline():
|
| 460 |
+
import atexit
|
| 461 |
+
try:
|
| 462 |
+
import readline
|
| 463 |
+
import rlcompleter
|
| 464 |
+
except ImportError:
|
| 465 |
+
return
|
| 466 |
+
|
| 467 |
+
# Reading the initialization (config) file may not be enough to set a
|
| 468 |
+
# completion key, so we set one first and then read the file.
|
| 469 |
+
readline_doc = getattr(readline, '__doc__', '')
|
| 470 |
+
if readline_doc is not None and 'libedit' in readline_doc:
|
| 471 |
+
readline.parse_and_bind('bind ^I rl_complete')
|
| 472 |
+
else:
|
| 473 |
+
readline.parse_and_bind('tab: complete')
|
| 474 |
+
|
| 475 |
+
try:
|
| 476 |
+
readline.read_init_file()
|
| 477 |
+
except OSError:
|
| 478 |
+
# An OSError here could have many causes, but the most likely one
|
| 479 |
+
# is that there's no .inputrc file (or .editrc file in the case of
|
| 480 |
+
# Mac OS X + libedit) in the expected location. In that case, we
|
| 481 |
+
# want to ignore the exception.
|
| 482 |
+
pass
|
| 483 |
+
|
| 484 |
+
if readline.get_current_history_length() == 0:
|
| 485 |
+
# If no history was loaded, default to .python_history.
|
| 486 |
+
# The guard is necessary to avoid doubling history size at
|
| 487 |
+
# each interpreter exit when readline was already configured
|
| 488 |
+
# through a PYTHONSTARTUP hook, see:
|
| 489 |
+
# http://bugs.python.org/issue5845#msg198636
|
| 490 |
+
history = os.path.join(os.path.expanduser('~'),
|
| 491 |
+
'.python_history')
|
| 492 |
+
try:
|
| 493 |
+
readline.read_history_file(history)
|
| 494 |
+
except OSError:
|
| 495 |
+
pass
|
| 496 |
+
|
| 497 |
+
def write_history():
|
| 498 |
+
try:
|
| 499 |
+
readline.write_history_file(history)
|
| 500 |
+
except OSError:
|
| 501 |
+
# bpo-19891, bpo-41193: Home directory does not exist
|
| 502 |
+
# or is not writable, or the filesystem is read-only.
|
| 503 |
+
pass
|
| 504 |
+
|
| 505 |
+
atexit.register(write_history)
|
| 506 |
+
|
| 507 |
+
sys.__interactivehook__ = register_readline
|
| 508 |
+
|
| 509 |
+
def venv(known_paths):
|
| 510 |
+
global PREFIXES, ENABLE_USER_SITE
|
| 511 |
+
|
| 512 |
+
env = os.environ
|
| 513 |
+
if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
|
| 514 |
+
executable = sys._base_executable = os.environ['__PYVENV_LAUNCHER__']
|
| 515 |
+
else:
|
| 516 |
+
executable = sys.executable
|
| 517 |
+
exe_dir = os.path.dirname(os.path.abspath(executable))
|
| 518 |
+
site_prefix = os.path.dirname(exe_dir)
|
| 519 |
+
sys._home = None
|
| 520 |
+
conf_basename = 'pyvenv.cfg'
|
| 521 |
+
candidate_conf = next(
|
| 522 |
+
(
|
| 523 |
+
conffile for conffile in (
|
| 524 |
+
os.path.join(exe_dir, conf_basename),
|
| 525 |
+
os.path.join(site_prefix, conf_basename)
|
| 526 |
+
)
|
| 527 |
+
if os.path.isfile(conffile)
|
| 528 |
+
),
|
| 529 |
+
None
|
| 530 |
+
)
|
| 531 |
+
|
| 532 |
+
if candidate_conf:
|
| 533 |
+
virtual_conf = candidate_conf
|
| 534 |
+
system_site = "true"
|
| 535 |
+
# Issue 25185: Use UTF-8, as that's what the venv module uses when
|
| 536 |
+
# writing the file.
|
| 537 |
+
with open(virtual_conf, encoding='utf-8') as f:
|
| 538 |
+
for line in f:
|
| 539 |
+
if '=' in line:
|
| 540 |
+
key, _, value = line.partition('=')
|
| 541 |
+
key = key.strip().lower()
|
| 542 |
+
value = value.strip()
|
| 543 |
+
if key == 'include-system-site-packages':
|
| 544 |
+
system_site = value.lower()
|
| 545 |
+
elif key == 'home':
|
| 546 |
+
sys._home = value
|
| 547 |
+
|
| 548 |
+
sys.prefix = sys.exec_prefix = site_prefix
|
| 549 |
+
|
| 550 |
+
# Doing this here ensures venv takes precedence over user-site
|
| 551 |
+
addsitepackages(known_paths, [sys.prefix])
|
| 552 |
+
|
| 553 |
+
# addsitepackages will process site_prefix again if its in PREFIXES,
|
| 554 |
+
# but that's ok; known_paths will prevent anything being added twice
|
| 555 |
+
if system_site == "true":
|
| 556 |
+
PREFIXES.insert(0, sys.prefix)
|
| 557 |
+
else:
|
| 558 |
+
PREFIXES = [sys.prefix]
|
| 559 |
+
ENABLE_USER_SITE = False
|
| 560 |
+
|
| 561 |
+
return known_paths
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
def execsitecustomize():
|
| 565 |
+
"""Run custom site specific code, if available."""
|
| 566 |
+
try:
|
| 567 |
+
try:
|
| 568 |
+
import sitecustomize
|
| 569 |
+
except ImportError as exc:
|
| 570 |
+
if exc.name == 'sitecustomize':
|
| 571 |
+
pass
|
| 572 |
+
else:
|
| 573 |
+
raise
|
| 574 |
+
except Exception as err:
|
| 575 |
+
if sys.flags.verbose:
|
| 576 |
+
sys.excepthook(*sys.exc_info())
|
| 577 |
+
else:
|
| 578 |
+
sys.stderr.write(
|
| 579 |
+
"Error in sitecustomize; set PYTHONVERBOSE for traceback:\n"
|
| 580 |
+
"%s: %s\n" %
|
| 581 |
+
(err.__class__.__name__, err))
|
| 582 |
+
|
| 583 |
+
|
| 584 |
+
def execusercustomize():
|
| 585 |
+
"""Run custom user specific code, if available."""
|
| 586 |
+
try:
|
| 587 |
+
try:
|
| 588 |
+
import usercustomize
|
| 589 |
+
except ImportError as exc:
|
| 590 |
+
if exc.name == 'usercustomize':
|
| 591 |
+
pass
|
| 592 |
+
else:
|
| 593 |
+
raise
|
| 594 |
+
except Exception as err:
|
| 595 |
+
if sys.flags.verbose:
|
| 596 |
+
sys.excepthook(*sys.exc_info())
|
| 597 |
+
else:
|
| 598 |
+
sys.stderr.write(
|
| 599 |
+
"Error in usercustomize; set PYTHONVERBOSE for traceback:\n"
|
| 600 |
+
"%s: %s\n" %
|
| 601 |
+
(err.__class__.__name__, err))
|
| 602 |
+
|
| 603 |
+
|
| 604 |
+
def main():
|
| 605 |
+
"""Add standard site-specific directories to the module search path.
|
| 606 |
+
|
| 607 |
+
This function is called automatically when this module is imported,
|
| 608 |
+
unless the python interpreter was started with the -S flag.
|
| 609 |
+
"""
|
| 610 |
+
global ENABLE_USER_SITE
|
| 611 |
+
|
| 612 |
+
orig_path = sys.path[:]
|
| 613 |
+
known_paths = removeduppaths()
|
| 614 |
+
if orig_path != sys.path:
|
| 615 |
+
# removeduppaths() might make sys.path absolute.
|
| 616 |
+
# fix __file__ and __cached__ of already imported modules too.
|
| 617 |
+
abs_paths()
|
| 618 |
+
|
| 619 |
+
known_paths = venv(known_paths)
|
| 620 |
+
if ENABLE_USER_SITE is None:
|
| 621 |
+
ENABLE_USER_SITE = check_enableusersite()
|
| 622 |
+
known_paths = addusersitepackages(known_paths)
|
| 623 |
+
known_paths = addsitepackages(known_paths)
|
| 624 |
+
setquit()
|
| 625 |
+
setcopyright()
|
| 626 |
+
sethelper()
|
| 627 |
+
if not sys.flags.isolated:
|
| 628 |
+
enablerlcompleter()
|
| 629 |
+
execsitecustomize()
|
| 630 |
+
if ENABLE_USER_SITE:
|
| 631 |
+
execusercustomize()
|
| 632 |
+
|
| 633 |
+
# Prevent extending of sys.path when python was started with -S and
|
| 634 |
+
# site is imported later.
|
| 635 |
+
if not sys.flags.no_site:
|
| 636 |
+
main()
|
| 637 |
+
|
| 638 |
+
def _script():
|
| 639 |
+
help = """\
|
| 640 |
+
%s [--user-base] [--user-site]
|
| 641 |
+
|
| 642 |
+
Without arguments print some useful information
|
| 643 |
+
With arguments print the value of USER_BASE and/or USER_SITE separated
|
| 644 |
+
by '%s'.
|
| 645 |
+
|
| 646 |
+
Exit codes with --user-base or --user-site:
|
| 647 |
+
0 - user site directory is enabled
|
| 648 |
+
1 - user site directory is disabled by user
|
| 649 |
+
2 - user site directory is disabled by super user
|
| 650 |
+
or for security reasons
|
| 651 |
+
>2 - unknown error
|
| 652 |
+
"""
|
| 653 |
+
args = sys.argv[1:]
|
| 654 |
+
if not args:
|
| 655 |
+
user_base = getuserbase()
|
| 656 |
+
user_site = getusersitepackages()
|
| 657 |
+
print("sys.path = [")
|
| 658 |
+
for dir in sys.path:
|
| 659 |
+
print(" %r," % (dir,))
|
| 660 |
+
print("]")
|
| 661 |
+
def exists(path):
|
| 662 |
+
if path is not None and os.path.isdir(path):
|
| 663 |
+
return "exists"
|
| 664 |
+
else:
|
| 665 |
+
return "doesn't exist"
|
| 666 |
+
print(f"USER_BASE: {user_base!r} ({exists(user_base)})")
|
| 667 |
+
print(f"USER_SITE: {user_site!r} ({exists(user_site)})")
|
| 668 |
+
print(f"ENABLE_USER_SITE: {ENABLE_USER_SITE!r}")
|
| 669 |
+
sys.exit(0)
|
| 670 |
+
|
| 671 |
+
buffer = []
|
| 672 |
+
if '--user-base' in args:
|
| 673 |
+
buffer.append(USER_BASE)
|
| 674 |
+
if '--user-site' in args:
|
| 675 |
+
buffer.append(USER_SITE)
|
| 676 |
+
|
| 677 |
+
if buffer:
|
| 678 |
+
print(os.pathsep.join(buffer))
|
| 679 |
+
if ENABLE_USER_SITE:
|
| 680 |
+
sys.exit(0)
|
| 681 |
+
elif ENABLE_USER_SITE is False:
|
| 682 |
+
sys.exit(1)
|
| 683 |
+
elif ENABLE_USER_SITE is None:
|
| 684 |
+
sys.exit(2)
|
| 685 |
+
else:
|
| 686 |
+
sys.exit(3)
|
| 687 |
+
else:
|
| 688 |
+
import textwrap
|
| 689 |
+
print(textwrap.dedent(help % (sys.argv[0], os.pathsep)))
|
| 690 |
+
sys.exit(10)
|
| 691 |
+
|
| 692 |
+
if __name__ == '__main__':
|
| 693 |
+
_script()
|
player/runtime/python/Lib/smtplib.py
ADDED
|
@@ -0,0 +1,1109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
'''SMTP/ESMTP client class.
|
| 4 |
+
|
| 5 |
+
This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
|
| 6 |
+
Authentication) and RFC 2487 (Secure SMTP over TLS).
|
| 7 |
+
|
| 8 |
+
Notes:
|
| 9 |
+
|
| 10 |
+
Please remember, when doing ESMTP, that the names of the SMTP service
|
| 11 |
+
extensions are NOT the same thing as the option keywords for the RCPT
|
| 12 |
+
and MAIL commands!
|
| 13 |
+
|
| 14 |
+
Example:
|
| 15 |
+
|
| 16 |
+
>>> import smtplib
|
| 17 |
+
>>> s=smtplib.SMTP("localhost")
|
| 18 |
+
>>> print(s.help())
|
| 19 |
+
This is Sendmail version 8.8.4
|
| 20 |
+
Topics:
|
| 21 |
+
HELO EHLO MAIL RCPT DATA
|
| 22 |
+
RSET NOOP QUIT HELP VRFY
|
| 23 |
+
EXPN VERB ETRN DSN
|
| 24 |
+
For more info use "HELP <topic>".
|
| 25 |
+
To report bugs in the implementation send email to
|
| 26 |
+
sendmail-bugs@sendmail.org.
|
| 27 |
+
For local information send email to Postmaster at your site.
|
| 28 |
+
End of HELP info
|
| 29 |
+
>>> s.putcmd("vrfy","someone@here")
|
| 30 |
+
>>> s.getreply()
|
| 31 |
+
(250, "Somebody OverHere <somebody@here.my.org>")
|
| 32 |
+
>>> s.quit()
|
| 33 |
+
'''
|
| 34 |
+
|
| 35 |
+
# Author: The Dragon De Monsyne <dragondm@integral.org>
|
| 36 |
+
# ESMTP support, test code and doc fixes added by
|
| 37 |
+
# Eric S. Raymond <esr@thyrsus.com>
|
| 38 |
+
# Better RFC 821 compliance (MAIL and RCPT, and CRLF in data)
|
| 39 |
+
# by Carey Evans <c.evans@clear.net.nz>, for picky mail servers.
|
| 40 |
+
# RFC 2554 (authentication) support by Gerhard Haering <gerhard@bigfoot.de>.
|
| 41 |
+
#
|
| 42 |
+
# This was modified from the Python 1.5 library HTTP lib.
|
| 43 |
+
|
| 44 |
+
import socket
|
| 45 |
+
import io
|
| 46 |
+
import re
|
| 47 |
+
import email.utils
|
| 48 |
+
import email.message
|
| 49 |
+
import email.generator
|
| 50 |
+
import base64
|
| 51 |
+
import hmac
|
| 52 |
+
import copy
|
| 53 |
+
import datetime
|
| 54 |
+
import sys
|
| 55 |
+
from email.base64mime import body_encode as encode_base64
|
| 56 |
+
|
| 57 |
+
__all__ = ["SMTPException", "SMTPNotSupportedError", "SMTPServerDisconnected", "SMTPResponseException",
|
| 58 |
+
"SMTPSenderRefused", "SMTPRecipientsRefused", "SMTPDataError",
|
| 59 |
+
"SMTPConnectError", "SMTPHeloError", "SMTPAuthenticationError",
|
| 60 |
+
"quoteaddr", "quotedata", "SMTP"]
|
| 61 |
+
|
| 62 |
+
SMTP_PORT = 25
|
| 63 |
+
SMTP_SSL_PORT = 465
|
| 64 |
+
CRLF = "\r\n"
|
| 65 |
+
bCRLF = b"\r\n"
|
| 66 |
+
_MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3
|
| 67 |
+
_MAXCHALLENGE = 5 # Maximum number of AUTH challenges sent
|
| 68 |
+
|
| 69 |
+
OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I)
|
| 70 |
+
|
| 71 |
+
# Exception classes used by this module.
|
| 72 |
+
class SMTPException(OSError):
|
| 73 |
+
"""Base class for all exceptions raised by this module."""
|
| 74 |
+
|
| 75 |
+
class SMTPNotSupportedError(SMTPException):
|
| 76 |
+
"""The command or option is not supported by the SMTP server.
|
| 77 |
+
|
| 78 |
+
This exception is raised when an attempt is made to run a command or a
|
| 79 |
+
command with an option which is not supported by the server.
|
| 80 |
+
"""
|
| 81 |
+
|
| 82 |
+
class SMTPServerDisconnected(SMTPException):
|
| 83 |
+
"""Not connected to any SMTP server.
|
| 84 |
+
|
| 85 |
+
This exception is raised when the server unexpectedly disconnects,
|
| 86 |
+
or when an attempt is made to use the SMTP instance before
|
| 87 |
+
connecting it to a server.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
class SMTPResponseException(SMTPException):
|
| 91 |
+
"""Base class for all exceptions that include an SMTP error code.
|
| 92 |
+
|
| 93 |
+
These exceptions are generated in some instances when the SMTP
|
| 94 |
+
server returns an error code. The error code is stored in the
|
| 95 |
+
`smtp_code' attribute of the error, and the `smtp_error' attribute
|
| 96 |
+
is set to the error message.
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
def __init__(self, code, msg):
|
| 100 |
+
self.smtp_code = code
|
| 101 |
+
self.smtp_error = msg
|
| 102 |
+
self.args = (code, msg)
|
| 103 |
+
|
| 104 |
+
class SMTPSenderRefused(SMTPResponseException):
|
| 105 |
+
"""Sender address refused.
|
| 106 |
+
|
| 107 |
+
In addition to the attributes set by on all SMTPResponseException
|
| 108 |
+
exceptions, this sets `sender' to the string that the SMTP refused.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
def __init__(self, code, msg, sender):
|
| 112 |
+
self.smtp_code = code
|
| 113 |
+
self.smtp_error = msg
|
| 114 |
+
self.sender = sender
|
| 115 |
+
self.args = (code, msg, sender)
|
| 116 |
+
|
| 117 |
+
class SMTPRecipientsRefused(SMTPException):
|
| 118 |
+
"""All recipient addresses refused.
|
| 119 |
+
|
| 120 |
+
The errors for each recipient are accessible through the attribute
|
| 121 |
+
'recipients', which is a dictionary of exactly the same sort as
|
| 122 |
+
SMTP.sendmail() returns.
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
def __init__(self, recipients):
|
| 126 |
+
self.recipients = recipients
|
| 127 |
+
self.args = (recipients,)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class SMTPDataError(SMTPResponseException):
|
| 131 |
+
"""The SMTP server didn't accept the data."""
|
| 132 |
+
|
| 133 |
+
class SMTPConnectError(SMTPResponseException):
|
| 134 |
+
"""Error during connection establishment."""
|
| 135 |
+
|
| 136 |
+
class SMTPHeloError(SMTPResponseException):
|
| 137 |
+
"""The server refused our HELO reply."""
|
| 138 |
+
|
| 139 |
+
class SMTPAuthenticationError(SMTPResponseException):
|
| 140 |
+
"""Authentication error.
|
| 141 |
+
|
| 142 |
+
Most probably the server didn't accept the username/password
|
| 143 |
+
combination provided.
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
def quoteaddr(addrstring):
|
| 147 |
+
"""Quote a subset of the email addresses defined by RFC 821.
|
| 148 |
+
|
| 149 |
+
Should be able to handle anything email.utils.parseaddr can handle.
|
| 150 |
+
"""
|
| 151 |
+
displayname, addr = email.utils.parseaddr(addrstring)
|
| 152 |
+
if (displayname, addr) == ('', ''):
|
| 153 |
+
# parseaddr couldn't parse it, use it as is and hope for the best.
|
| 154 |
+
if addrstring.strip().startswith('<'):
|
| 155 |
+
return addrstring
|
| 156 |
+
return "<%s>" % addrstring
|
| 157 |
+
return "<%s>" % addr
|
| 158 |
+
|
| 159 |
+
def _addr_only(addrstring):
|
| 160 |
+
displayname, addr = email.utils.parseaddr(addrstring)
|
| 161 |
+
if (displayname, addr) == ('', ''):
|
| 162 |
+
# parseaddr couldn't parse it, so use it as is.
|
| 163 |
+
return addrstring
|
| 164 |
+
return addr
|
| 165 |
+
|
| 166 |
+
# Legacy method kept for backward compatibility.
|
| 167 |
+
def quotedata(data):
|
| 168 |
+
"""Quote data for email.
|
| 169 |
+
|
| 170 |
+
Double leading '.', and change Unix newline '\\n', or Mac '\\r' into
|
| 171 |
+
internet CRLF end-of-line.
|
| 172 |
+
"""
|
| 173 |
+
return re.sub(r'(?m)^\.', '..',
|
| 174 |
+
re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
|
| 175 |
+
|
| 176 |
+
def _quote_periods(bindata):
|
| 177 |
+
return re.sub(br'(?m)^\.', b'..', bindata)
|
| 178 |
+
|
| 179 |
+
def _fix_eols(data):
|
| 180 |
+
return re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)
|
| 181 |
+
|
| 182 |
+
try:
|
| 183 |
+
import ssl
|
| 184 |
+
except ImportError:
|
| 185 |
+
_have_ssl = False
|
| 186 |
+
else:
|
| 187 |
+
_have_ssl = True
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class SMTP:
|
| 191 |
+
"""This class manages a connection to an SMTP or ESMTP server.
|
| 192 |
+
SMTP Objects:
|
| 193 |
+
SMTP objects have the following attributes:
|
| 194 |
+
helo_resp
|
| 195 |
+
This is the message given by the server in response to the
|
| 196 |
+
most recent HELO command.
|
| 197 |
+
|
| 198 |
+
ehlo_resp
|
| 199 |
+
This is the message given by the server in response to the
|
| 200 |
+
most recent EHLO command. This is usually multiline.
|
| 201 |
+
|
| 202 |
+
does_esmtp
|
| 203 |
+
This is a True value _after you do an EHLO command_, if the
|
| 204 |
+
server supports ESMTP.
|
| 205 |
+
|
| 206 |
+
esmtp_features
|
| 207 |
+
This is a dictionary, which, if the server supports ESMTP,
|
| 208 |
+
will _after you do an EHLO command_, contain the names of the
|
| 209 |
+
SMTP service extensions this server supports, and their
|
| 210 |
+
parameters (if any).
|
| 211 |
+
|
| 212 |
+
Note, all extension names are mapped to lower case in the
|
| 213 |
+
dictionary.
|
| 214 |
+
|
| 215 |
+
See each method's docstrings for details. In general, there is a
|
| 216 |
+
method of the same name to perform each SMTP command. There is also a
|
| 217 |
+
method called 'sendmail' that will do an entire mail transaction.
|
| 218 |
+
"""
|
| 219 |
+
debuglevel = 0
|
| 220 |
+
|
| 221 |
+
sock = None
|
| 222 |
+
file = None
|
| 223 |
+
helo_resp = None
|
| 224 |
+
ehlo_msg = "ehlo"
|
| 225 |
+
ehlo_resp = None
|
| 226 |
+
does_esmtp = False
|
| 227 |
+
default_port = SMTP_PORT
|
| 228 |
+
|
| 229 |
+
def __init__(self, host='', port=0, local_hostname=None,
|
| 230 |
+
timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
| 231 |
+
source_address=None):
|
| 232 |
+
"""Initialize a new instance.
|
| 233 |
+
|
| 234 |
+
If specified, `host` is the name of the remote host to which to
|
| 235 |
+
connect. If specified, `port` specifies the port to which to connect.
|
| 236 |
+
By default, smtplib.SMTP_PORT is used. If a host is specified the
|
| 237 |
+
connect method is called, and if it returns anything other than a
|
| 238 |
+
success code an SMTPConnectError is raised. If specified,
|
| 239 |
+
`local_hostname` is used as the FQDN of the local host in the HELO/EHLO
|
| 240 |
+
command. Otherwise, the local hostname is found using
|
| 241 |
+
socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
|
| 242 |
+
port) for the socket to bind to as its source address before
|
| 243 |
+
connecting. If the host is '' and port is 0, the OS default behavior
|
| 244 |
+
will be used.
|
| 245 |
+
|
| 246 |
+
"""
|
| 247 |
+
self._host = host
|
| 248 |
+
self.timeout = timeout
|
| 249 |
+
self.esmtp_features = {}
|
| 250 |
+
self.command_encoding = 'ascii'
|
| 251 |
+
self.source_address = source_address
|
| 252 |
+
self._auth_challenge_count = 0
|
| 253 |
+
|
| 254 |
+
if host:
|
| 255 |
+
(code, msg) = self.connect(host, port)
|
| 256 |
+
if code != 220:
|
| 257 |
+
self.close()
|
| 258 |
+
raise SMTPConnectError(code, msg)
|
| 259 |
+
if local_hostname is not None:
|
| 260 |
+
self.local_hostname = local_hostname
|
| 261 |
+
else:
|
| 262 |
+
# RFC 2821 says we should use the fqdn in the EHLO/HELO verb, and
|
| 263 |
+
# if that can't be calculated, that we should use a domain literal
|
| 264 |
+
# instead (essentially an encoded IP address like [A.B.C.D]).
|
| 265 |
+
fqdn = socket.getfqdn()
|
| 266 |
+
if '.' in fqdn:
|
| 267 |
+
self.local_hostname = fqdn
|
| 268 |
+
else:
|
| 269 |
+
# We can't find an fqdn hostname, so use a domain literal
|
| 270 |
+
addr = '127.0.0.1'
|
| 271 |
+
try:
|
| 272 |
+
addr = socket.gethostbyname(socket.gethostname())
|
| 273 |
+
except socket.gaierror:
|
| 274 |
+
pass
|
| 275 |
+
self.local_hostname = '[%s]' % addr
|
| 276 |
+
|
| 277 |
+
def __enter__(self):
|
| 278 |
+
return self
|
| 279 |
+
|
| 280 |
+
def __exit__(self, *args):
|
| 281 |
+
try:
|
| 282 |
+
code, message = self.docmd("QUIT")
|
| 283 |
+
if code != 221:
|
| 284 |
+
raise SMTPResponseException(code, message)
|
| 285 |
+
except SMTPServerDisconnected:
|
| 286 |
+
pass
|
| 287 |
+
finally:
|
| 288 |
+
self.close()
|
| 289 |
+
|
| 290 |
+
def set_debuglevel(self, debuglevel):
|
| 291 |
+
"""Set the debug output level.
|
| 292 |
+
|
| 293 |
+
A non-false value results in debug messages for connection and for all
|
| 294 |
+
messages sent to and received from the server.
|
| 295 |
+
|
| 296 |
+
"""
|
| 297 |
+
self.debuglevel = debuglevel
|
| 298 |
+
|
| 299 |
+
def _print_debug(self, *args):
|
| 300 |
+
if self.debuglevel > 1:
|
| 301 |
+
print(datetime.datetime.now().time(), *args, file=sys.stderr)
|
| 302 |
+
else:
|
| 303 |
+
print(*args, file=sys.stderr)
|
| 304 |
+
|
| 305 |
+
def _get_socket(self, host, port, timeout):
|
| 306 |
+
# This makes it simpler for SMTP_SSL to use the SMTP connect code
|
| 307 |
+
# and just alter the socket connection bit.
|
| 308 |
+
if timeout is not None and not timeout:
|
| 309 |
+
raise ValueError('Non-blocking socket (timeout=0) is not supported')
|
| 310 |
+
if self.debuglevel > 0:
|
| 311 |
+
self._print_debug('connect: to', (host, port), self.source_address)
|
| 312 |
+
return socket.create_connection((host, port), timeout,
|
| 313 |
+
self.source_address)
|
| 314 |
+
|
| 315 |
+
def connect(self, host='localhost', port=0, source_address=None):
|
| 316 |
+
"""Connect to a host on a given port.
|
| 317 |
+
|
| 318 |
+
If the hostname ends with a colon (`:') followed by a number, and
|
| 319 |
+
there is no port specified, that suffix will be stripped off and the
|
| 320 |
+
number interpreted as the port number to use.
|
| 321 |
+
|
| 322 |
+
Note: This method is automatically invoked by __init__, if a host is
|
| 323 |
+
specified during instantiation.
|
| 324 |
+
|
| 325 |
+
"""
|
| 326 |
+
|
| 327 |
+
if source_address:
|
| 328 |
+
self.source_address = source_address
|
| 329 |
+
|
| 330 |
+
if not port and (host.find(':') == host.rfind(':')):
|
| 331 |
+
i = host.rfind(':')
|
| 332 |
+
if i >= 0:
|
| 333 |
+
host, port = host[:i], host[i + 1:]
|
| 334 |
+
try:
|
| 335 |
+
port = int(port)
|
| 336 |
+
except ValueError:
|
| 337 |
+
raise OSError("nonnumeric port")
|
| 338 |
+
if not port:
|
| 339 |
+
port = self.default_port
|
| 340 |
+
sys.audit("smtplib.connect", self, host, port)
|
| 341 |
+
self.sock = self._get_socket(host, port, self.timeout)
|
| 342 |
+
self.file = None
|
| 343 |
+
(code, msg) = self.getreply()
|
| 344 |
+
if self.debuglevel > 0:
|
| 345 |
+
self._print_debug('connect:', repr(msg))
|
| 346 |
+
return (code, msg)
|
| 347 |
+
|
| 348 |
+
def send(self, s):
|
| 349 |
+
"""Send `s' to the server."""
|
| 350 |
+
if self.debuglevel > 0:
|
| 351 |
+
self._print_debug('send:', repr(s))
|
| 352 |
+
if self.sock:
|
| 353 |
+
if isinstance(s, str):
|
| 354 |
+
# send is used by the 'data' command, where command_encoding
|
| 355 |
+
# should not be used, but 'data' needs to convert the string to
|
| 356 |
+
# binary itself anyway, so that's not a problem.
|
| 357 |
+
s = s.encode(self.command_encoding)
|
| 358 |
+
sys.audit("smtplib.send", self, s)
|
| 359 |
+
try:
|
| 360 |
+
self.sock.sendall(s)
|
| 361 |
+
except OSError:
|
| 362 |
+
self.close()
|
| 363 |
+
raise SMTPServerDisconnected('Server not connected')
|
| 364 |
+
else:
|
| 365 |
+
raise SMTPServerDisconnected('please run connect() first')
|
| 366 |
+
|
| 367 |
+
def putcmd(self, cmd, args=""):
|
| 368 |
+
"""Send a command to the server."""
|
| 369 |
+
if args == "":
|
| 370 |
+
s = cmd
|
| 371 |
+
else:
|
| 372 |
+
s = f'{cmd} {args}'
|
| 373 |
+
if '\r' in s or '\n' in s:
|
| 374 |
+
s = s.replace('\n', '\\n').replace('\r', '\\r')
|
| 375 |
+
raise ValueError(
|
| 376 |
+
f'command and arguments contain prohibited newline characters: {s}'
|
| 377 |
+
)
|
| 378 |
+
self.send(f'{s}{CRLF}')
|
| 379 |
+
|
| 380 |
+
def getreply(self):
|
| 381 |
+
"""Get a reply from the server.
|
| 382 |
+
|
| 383 |
+
Returns a tuple consisting of:
|
| 384 |
+
|
| 385 |
+
- server response code (e.g. '250', or such, if all goes well)
|
| 386 |
+
Note: returns -1 if it can't read response code.
|
| 387 |
+
|
| 388 |
+
- server response string corresponding to response code (multiline
|
| 389 |
+
responses are converted to a single, multiline string).
|
| 390 |
+
|
| 391 |
+
Raises SMTPServerDisconnected if end-of-file is reached.
|
| 392 |
+
"""
|
| 393 |
+
resp = []
|
| 394 |
+
if self.file is None:
|
| 395 |
+
self.file = self.sock.makefile('rb')
|
| 396 |
+
while 1:
|
| 397 |
+
try:
|
| 398 |
+
line = self.file.readline(_MAXLINE + 1)
|
| 399 |
+
except OSError as e:
|
| 400 |
+
self.close()
|
| 401 |
+
raise SMTPServerDisconnected("Connection unexpectedly closed: "
|
| 402 |
+
+ str(e))
|
| 403 |
+
if not line:
|
| 404 |
+
self.close()
|
| 405 |
+
raise SMTPServerDisconnected("Connection unexpectedly closed")
|
| 406 |
+
if self.debuglevel > 0:
|
| 407 |
+
self._print_debug('reply:', repr(line))
|
| 408 |
+
if len(line) > _MAXLINE:
|
| 409 |
+
self.close()
|
| 410 |
+
raise SMTPResponseException(500, "Line too long.")
|
| 411 |
+
resp.append(line[4:].strip(b' \t\r\n'))
|
| 412 |
+
code = line[:3]
|
| 413 |
+
# Check that the error code is syntactically correct.
|
| 414 |
+
# Don't attempt to read a continuation line if it is broken.
|
| 415 |
+
try:
|
| 416 |
+
errcode = int(code)
|
| 417 |
+
except ValueError:
|
| 418 |
+
errcode = -1
|
| 419 |
+
break
|
| 420 |
+
# Check if multiline response.
|
| 421 |
+
if line[3:4] != b"-":
|
| 422 |
+
break
|
| 423 |
+
|
| 424 |
+
errmsg = b"\n".join(resp)
|
| 425 |
+
if self.debuglevel > 0:
|
| 426 |
+
self._print_debug('reply: retcode (%s); Msg: %a' % (errcode, errmsg))
|
| 427 |
+
return errcode, errmsg
|
| 428 |
+
|
| 429 |
+
def docmd(self, cmd, args=""):
|
| 430 |
+
"""Send a command, and return its response code."""
|
| 431 |
+
self.putcmd(cmd, args)
|
| 432 |
+
return self.getreply()
|
| 433 |
+
|
| 434 |
+
# std smtp commands
|
| 435 |
+
def helo(self, name=''):
|
| 436 |
+
"""SMTP 'helo' command.
|
| 437 |
+
Hostname to send for this command defaults to the FQDN of the local
|
| 438 |
+
host.
|
| 439 |
+
"""
|
| 440 |
+
self.putcmd("helo", name or self.local_hostname)
|
| 441 |
+
(code, msg) = self.getreply()
|
| 442 |
+
self.helo_resp = msg
|
| 443 |
+
return (code, msg)
|
| 444 |
+
|
| 445 |
+
def ehlo(self, name=''):
|
| 446 |
+
""" SMTP 'ehlo' command.
|
| 447 |
+
Hostname to send for this command defaults to the FQDN of the local
|
| 448 |
+
host.
|
| 449 |
+
"""
|
| 450 |
+
self.esmtp_features = {}
|
| 451 |
+
self.putcmd(self.ehlo_msg, name or self.local_hostname)
|
| 452 |
+
(code, msg) = self.getreply()
|
| 453 |
+
# According to RFC1869 some (badly written)
|
| 454 |
+
# MTA's will disconnect on an ehlo. Toss an exception if
|
| 455 |
+
# that happens -ddm
|
| 456 |
+
if code == -1 and len(msg) == 0:
|
| 457 |
+
self.close()
|
| 458 |
+
raise SMTPServerDisconnected("Server not connected")
|
| 459 |
+
self.ehlo_resp = msg
|
| 460 |
+
if code != 250:
|
| 461 |
+
return (code, msg)
|
| 462 |
+
self.does_esmtp = True
|
| 463 |
+
#parse the ehlo response -ddm
|
| 464 |
+
assert isinstance(self.ehlo_resp, bytes), repr(self.ehlo_resp)
|
| 465 |
+
resp = self.ehlo_resp.decode("latin-1").split('\n')
|
| 466 |
+
del resp[0]
|
| 467 |
+
for each in resp:
|
| 468 |
+
# To be able to communicate with as many SMTP servers as possible,
|
| 469 |
+
# we have to take the old-style auth advertisement into account,
|
| 470 |
+
# because:
|
| 471 |
+
# 1) Else our SMTP feature parser gets confused.
|
| 472 |
+
# 2) There are some servers that only advertise the auth methods we
|
| 473 |
+
# support using the old style.
|
| 474 |
+
auth_match = OLDSTYLE_AUTH.match(each)
|
| 475 |
+
if auth_match:
|
| 476 |
+
# This doesn't remove duplicates, but that's no problem
|
| 477 |
+
self.esmtp_features["auth"] = self.esmtp_features.get("auth", "") \
|
| 478 |
+
+ " " + auth_match.groups(0)[0]
|
| 479 |
+
continue
|
| 480 |
+
|
| 481 |
+
# RFC 1869 requires a space between ehlo keyword and parameters.
|
| 482 |
+
# It's actually stricter, in that only spaces are allowed between
|
| 483 |
+
# parameters, but were not going to check for that here. Note
|
| 484 |
+
# that the space isn't present if there are no parameters.
|
| 485 |
+
m = re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?', each)
|
| 486 |
+
if m:
|
| 487 |
+
feature = m.group("feature").lower()
|
| 488 |
+
params = m.string[m.end("feature"):].strip()
|
| 489 |
+
if feature == "auth":
|
| 490 |
+
self.esmtp_features[feature] = self.esmtp_features.get(feature, "") \
|
| 491 |
+
+ " " + params
|
| 492 |
+
else:
|
| 493 |
+
self.esmtp_features[feature] = params
|
| 494 |
+
return (code, msg)
|
| 495 |
+
|
| 496 |
+
def has_extn(self, opt):
|
| 497 |
+
"""Does the server support a given SMTP service extension?"""
|
| 498 |
+
return opt.lower() in self.esmtp_features
|
| 499 |
+
|
| 500 |
+
def help(self, args=''):
|
| 501 |
+
"""SMTP 'help' command.
|
| 502 |
+
Returns help text from server."""
|
| 503 |
+
self.putcmd("help", args)
|
| 504 |
+
return self.getreply()[1]
|
| 505 |
+
|
| 506 |
+
def rset(self):
|
| 507 |
+
"""SMTP 'rset' command -- resets session."""
|
| 508 |
+
self.command_encoding = 'ascii'
|
| 509 |
+
return self.docmd("rset")
|
| 510 |
+
|
| 511 |
+
def _rset(self):
|
| 512 |
+
"""Internal 'rset' command which ignores any SMTPServerDisconnected error.
|
| 513 |
+
|
| 514 |
+
Used internally in the library, since the server disconnected error
|
| 515 |
+
should appear to the application when the *next* command is issued, if
|
| 516 |
+
we are doing an internal "safety" reset.
|
| 517 |
+
"""
|
| 518 |
+
try:
|
| 519 |
+
self.rset()
|
| 520 |
+
except SMTPServerDisconnected:
|
| 521 |
+
pass
|
| 522 |
+
|
| 523 |
+
def noop(self):
|
| 524 |
+
"""SMTP 'noop' command -- doesn't do anything :>"""
|
| 525 |
+
return self.docmd("noop")
|
| 526 |
+
|
| 527 |
+
def mail(self, sender, options=()):
|
| 528 |
+
"""SMTP 'mail' command -- begins mail xfer session.
|
| 529 |
+
|
| 530 |
+
This method may raise the following exceptions:
|
| 531 |
+
|
| 532 |
+
SMTPNotSupportedError The options parameter includes 'SMTPUTF8'
|
| 533 |
+
but the SMTPUTF8 extension is not supported by
|
| 534 |
+
the server.
|
| 535 |
+
"""
|
| 536 |
+
optionlist = ''
|
| 537 |
+
if options and self.does_esmtp:
|
| 538 |
+
if any(x.lower()=='smtputf8' for x in options):
|
| 539 |
+
if self.has_extn('smtputf8'):
|
| 540 |
+
self.command_encoding = 'utf-8'
|
| 541 |
+
else:
|
| 542 |
+
raise SMTPNotSupportedError(
|
| 543 |
+
'SMTPUTF8 not supported by server')
|
| 544 |
+
optionlist = ' ' + ' '.join(options)
|
| 545 |
+
self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender), optionlist))
|
| 546 |
+
return self.getreply()
|
| 547 |
+
|
| 548 |
+
def rcpt(self, recip, options=()):
|
| 549 |
+
"""SMTP 'rcpt' command -- indicates 1 recipient for this mail."""
|
| 550 |
+
optionlist = ''
|
| 551 |
+
if options and self.does_esmtp:
|
| 552 |
+
optionlist = ' ' + ' '.join(options)
|
| 553 |
+
self.putcmd("rcpt", "TO:%s%s" % (quoteaddr(recip), optionlist))
|
| 554 |
+
return self.getreply()
|
| 555 |
+
|
| 556 |
+
def data(self, msg):
|
| 557 |
+
"""SMTP 'DATA' command -- sends message data to server.
|
| 558 |
+
|
| 559 |
+
Automatically quotes lines beginning with a period per rfc821.
|
| 560 |
+
Raises SMTPDataError if there is an unexpected reply to the
|
| 561 |
+
DATA command; the return value from this method is the final
|
| 562 |
+
response code received when the all data is sent. If msg
|
| 563 |
+
is a string, lone '\\r' and '\\n' characters are converted to
|
| 564 |
+
'\\r\\n' characters. If msg is bytes, it is transmitted as is.
|
| 565 |
+
"""
|
| 566 |
+
self.putcmd("data")
|
| 567 |
+
(code, repl) = self.getreply()
|
| 568 |
+
if self.debuglevel > 0:
|
| 569 |
+
self._print_debug('data:', (code, repl))
|
| 570 |
+
if code != 354:
|
| 571 |
+
raise SMTPDataError(code, repl)
|
| 572 |
+
else:
|
| 573 |
+
if isinstance(msg, str):
|
| 574 |
+
msg = _fix_eols(msg).encode('ascii')
|
| 575 |
+
q = _quote_periods(msg)
|
| 576 |
+
if q[-2:] != bCRLF:
|
| 577 |
+
q = q + bCRLF
|
| 578 |
+
q = q + b"." + bCRLF
|
| 579 |
+
self.send(q)
|
| 580 |
+
(code, msg) = self.getreply()
|
| 581 |
+
if self.debuglevel > 0:
|
| 582 |
+
self._print_debug('data:', (code, msg))
|
| 583 |
+
return (code, msg)
|
| 584 |
+
|
| 585 |
+
def verify(self, address):
|
| 586 |
+
"""SMTP 'verify' command -- checks for address validity."""
|
| 587 |
+
self.putcmd("vrfy", _addr_only(address))
|
| 588 |
+
return self.getreply()
|
| 589 |
+
# a.k.a.
|
| 590 |
+
vrfy = verify
|
| 591 |
+
|
| 592 |
+
def expn(self, address):
|
| 593 |
+
"""SMTP 'expn' command -- expands a mailing list."""
|
| 594 |
+
self.putcmd("expn", _addr_only(address))
|
| 595 |
+
return self.getreply()
|
| 596 |
+
|
| 597 |
+
# some useful methods
|
| 598 |
+
|
| 599 |
+
def ehlo_or_helo_if_needed(self):
|
| 600 |
+
"""Call self.ehlo() and/or self.helo() if needed.
|
| 601 |
+
|
| 602 |
+
If there has been no previous EHLO or HELO command this session, this
|
| 603 |
+
method tries ESMTP EHLO first.
|
| 604 |
+
|
| 605 |
+
This method may raise the following exceptions:
|
| 606 |
+
|
| 607 |
+
SMTPHeloError The server didn't reply properly to
|
| 608 |
+
the helo greeting.
|
| 609 |
+
"""
|
| 610 |
+
if self.helo_resp is None and self.ehlo_resp is None:
|
| 611 |
+
if not (200 <= self.ehlo()[0] <= 299):
|
| 612 |
+
(code, resp) = self.helo()
|
| 613 |
+
if not (200 <= code <= 299):
|
| 614 |
+
raise SMTPHeloError(code, resp)
|
| 615 |
+
|
| 616 |
+
def auth(self, mechanism, authobject, *, initial_response_ok=True):
|
| 617 |
+
"""Authentication command - requires response processing.
|
| 618 |
+
|
| 619 |
+
'mechanism' specifies which authentication mechanism is to
|
| 620 |
+
be used - the valid values are those listed in the 'auth'
|
| 621 |
+
element of 'esmtp_features'.
|
| 622 |
+
|
| 623 |
+
'authobject' must be a callable object taking a single argument:
|
| 624 |
+
|
| 625 |
+
data = authobject(challenge)
|
| 626 |
+
|
| 627 |
+
It will be called to process the server's challenge response; the
|
| 628 |
+
challenge argument it is passed will be a bytes. It should return
|
| 629 |
+
an ASCII string that will be base64 encoded and sent to the server.
|
| 630 |
+
|
| 631 |
+
Keyword arguments:
|
| 632 |
+
- initial_response_ok: Allow sending the RFC 4954 initial-response
|
| 633 |
+
to the AUTH command, if the authentication methods supports it.
|
| 634 |
+
"""
|
| 635 |
+
# RFC 4954 allows auth methods to provide an initial response. Not all
|
| 636 |
+
# methods support it. By definition, if they return something other
|
| 637 |
+
# than None when challenge is None, then they do. See issue #15014.
|
| 638 |
+
mechanism = mechanism.upper()
|
| 639 |
+
initial_response = (authobject() if initial_response_ok else None)
|
| 640 |
+
if initial_response is not None:
|
| 641 |
+
response = encode_base64(initial_response.encode('ascii'), eol='')
|
| 642 |
+
(code, resp) = self.docmd("AUTH", mechanism + " " + response)
|
| 643 |
+
self._auth_challenge_count = 1
|
| 644 |
+
else:
|
| 645 |
+
(code, resp) = self.docmd("AUTH", mechanism)
|
| 646 |
+
self._auth_challenge_count = 0
|
| 647 |
+
# If server responds with a challenge, send the response.
|
| 648 |
+
while code == 334:
|
| 649 |
+
self._auth_challenge_count += 1
|
| 650 |
+
challenge = base64.decodebytes(resp)
|
| 651 |
+
response = encode_base64(
|
| 652 |
+
authobject(challenge).encode('ascii'), eol='')
|
| 653 |
+
(code, resp) = self.docmd(response)
|
| 654 |
+
# If server keeps sending challenges, something is wrong.
|
| 655 |
+
if self._auth_challenge_count > _MAXCHALLENGE:
|
| 656 |
+
raise SMTPException(
|
| 657 |
+
"Server AUTH mechanism infinite loop. Last response: "
|
| 658 |
+
+ repr((code, resp))
|
| 659 |
+
)
|
| 660 |
+
if code in (235, 503):
|
| 661 |
+
return (code, resp)
|
| 662 |
+
raise SMTPAuthenticationError(code, resp)
|
| 663 |
+
|
| 664 |
+
def auth_cram_md5(self, challenge=None):
|
| 665 |
+
""" Authobject to use with CRAM-MD5 authentication. Requires self.user
|
| 666 |
+
and self.password to be set."""
|
| 667 |
+
# CRAM-MD5 does not support initial-response.
|
| 668 |
+
if challenge is None:
|
| 669 |
+
return None
|
| 670 |
+
return self.user + " " + hmac.HMAC(
|
| 671 |
+
self.password.encode('ascii'), challenge, 'md5').hexdigest()
|
| 672 |
+
|
| 673 |
+
def auth_plain(self, challenge=None):
|
| 674 |
+
""" Authobject to use with PLAIN authentication. Requires self.user and
|
| 675 |
+
self.password to be set."""
|
| 676 |
+
return "\0%s\0%s" % (self.user, self.password)
|
| 677 |
+
|
| 678 |
+
def auth_login(self, challenge=None):
|
| 679 |
+
""" Authobject to use with LOGIN authentication. Requires self.user and
|
| 680 |
+
self.password to be set."""
|
| 681 |
+
if challenge is None or self._auth_challenge_count < 2:
|
| 682 |
+
return self.user
|
| 683 |
+
else:
|
| 684 |
+
return self.password
|
| 685 |
+
|
| 686 |
+
def login(self, user, password, *, initial_response_ok=True):
|
| 687 |
+
"""Log in on an SMTP server that requires authentication.
|
| 688 |
+
|
| 689 |
+
The arguments are:
|
| 690 |
+
- user: The user name to authenticate with.
|
| 691 |
+
- password: The password for the authentication.
|
| 692 |
+
|
| 693 |
+
Keyword arguments:
|
| 694 |
+
- initial_response_ok: Allow sending the RFC 4954 initial-response
|
| 695 |
+
to the AUTH command, if the authentication methods supports it.
|
| 696 |
+
|
| 697 |
+
If there has been no previous EHLO or HELO command this session, this
|
| 698 |
+
method tries ESMTP EHLO first.
|
| 699 |
+
|
| 700 |
+
This method will return normally if the authentication was successful.
|
| 701 |
+
|
| 702 |
+
This method may raise the following exceptions:
|
| 703 |
+
|
| 704 |
+
SMTPHeloError The server didn't reply properly to
|
| 705 |
+
the helo greeting.
|
| 706 |
+
SMTPAuthenticationError The server didn't accept the username/
|
| 707 |
+
password combination.
|
| 708 |
+
SMTPNotSupportedError The AUTH command is not supported by the
|
| 709 |
+
server.
|
| 710 |
+
SMTPException No suitable authentication method was
|
| 711 |
+
found.
|
| 712 |
+
"""
|
| 713 |
+
|
| 714 |
+
self.ehlo_or_helo_if_needed()
|
| 715 |
+
if not self.has_extn("auth"):
|
| 716 |
+
raise SMTPNotSupportedError(
|
| 717 |
+
"SMTP AUTH extension not supported by server.")
|
| 718 |
+
|
| 719 |
+
# Authentication methods the server claims to support
|
| 720 |
+
advertised_authlist = self.esmtp_features["auth"].split()
|
| 721 |
+
|
| 722 |
+
# Authentication methods we can handle in our preferred order:
|
| 723 |
+
preferred_auths = ['CRAM-MD5', 'PLAIN', 'LOGIN']
|
| 724 |
+
|
| 725 |
+
# We try the supported authentications in our preferred order, if
|
| 726 |
+
# the server supports them.
|
| 727 |
+
authlist = [auth for auth in preferred_auths
|
| 728 |
+
if auth in advertised_authlist]
|
| 729 |
+
if not authlist:
|
| 730 |
+
raise SMTPException("No suitable authentication method found.")
|
| 731 |
+
|
| 732 |
+
# Some servers advertise authentication methods they don't really
|
| 733 |
+
# support, so if authentication fails, we continue until we've tried
|
| 734 |
+
# all methods.
|
| 735 |
+
self.user, self.password = user, password
|
| 736 |
+
for authmethod in authlist:
|
| 737 |
+
method_name = 'auth_' + authmethod.lower().replace('-', '_')
|
| 738 |
+
try:
|
| 739 |
+
(code, resp) = self.auth(
|
| 740 |
+
authmethod, getattr(self, method_name),
|
| 741 |
+
initial_response_ok=initial_response_ok)
|
| 742 |
+
# 235 == 'Authentication successful'
|
| 743 |
+
# 503 == 'Error: already authenticated'
|
| 744 |
+
if code in (235, 503):
|
| 745 |
+
return (code, resp)
|
| 746 |
+
except SMTPAuthenticationError as e:
|
| 747 |
+
last_exception = e
|
| 748 |
+
|
| 749 |
+
# We could not login successfully. Return result of last attempt.
|
| 750 |
+
raise last_exception
|
| 751 |
+
|
| 752 |
+
def starttls(self, *, context=None):
|
| 753 |
+
"""Puts the connection to the SMTP server into TLS mode.
|
| 754 |
+
|
| 755 |
+
If there has been no previous EHLO or HELO command this session, this
|
| 756 |
+
method tries ESMTP EHLO first.
|
| 757 |
+
|
| 758 |
+
If the server supports TLS, this will encrypt the rest of the SMTP
|
| 759 |
+
session. If you provide the context parameter,
|
| 760 |
+
the identity of the SMTP server and client can be checked. This,
|
| 761 |
+
however, depends on whether the socket module really checks the
|
| 762 |
+
certificates.
|
| 763 |
+
|
| 764 |
+
This method may raise the following exceptions:
|
| 765 |
+
|
| 766 |
+
SMTPHeloError The server didn't reply properly to
|
| 767 |
+
the helo greeting.
|
| 768 |
+
"""
|
| 769 |
+
self.ehlo_or_helo_if_needed()
|
| 770 |
+
if not self.has_extn("starttls"):
|
| 771 |
+
raise SMTPNotSupportedError(
|
| 772 |
+
"STARTTLS extension not supported by server.")
|
| 773 |
+
(resp, reply) = self.docmd("STARTTLS")
|
| 774 |
+
if resp == 220:
|
| 775 |
+
if not _have_ssl:
|
| 776 |
+
raise RuntimeError("No SSL support included in this Python")
|
| 777 |
+
if context is None:
|
| 778 |
+
context = ssl._create_stdlib_context()
|
| 779 |
+
self.sock = context.wrap_socket(self.sock,
|
| 780 |
+
server_hostname=self._host)
|
| 781 |
+
self.file = None
|
| 782 |
+
# RFC 3207:
|
| 783 |
+
# The client MUST discard any knowledge obtained from
|
| 784 |
+
# the server, such as the list of SMTP service extensions,
|
| 785 |
+
# which was not obtained from the TLS negotiation itself.
|
| 786 |
+
self.helo_resp = None
|
| 787 |
+
self.ehlo_resp = None
|
| 788 |
+
self.esmtp_features = {}
|
| 789 |
+
self.does_esmtp = False
|
| 790 |
+
else:
|
| 791 |
+
# RFC 3207:
|
| 792 |
+
# 501 Syntax error (no parameters allowed)
|
| 793 |
+
# 454 TLS not available due to temporary reason
|
| 794 |
+
raise SMTPResponseException(resp, reply)
|
| 795 |
+
return (resp, reply)
|
| 796 |
+
|
| 797 |
+
def sendmail(self, from_addr, to_addrs, msg, mail_options=(),
|
| 798 |
+
rcpt_options=()):
|
| 799 |
+
"""This command performs an entire mail transaction.
|
| 800 |
+
|
| 801 |
+
The arguments are:
|
| 802 |
+
- from_addr : The address sending this mail.
|
| 803 |
+
- to_addrs : A list of addresses to send this mail to. A bare
|
| 804 |
+
string will be treated as a list with 1 address.
|
| 805 |
+
- msg : The message to send.
|
| 806 |
+
- mail_options : List of ESMTP options (such as 8bitmime) for the
|
| 807 |
+
mail command.
|
| 808 |
+
- rcpt_options : List of ESMTP options (such as DSN commands) for
|
| 809 |
+
all the rcpt commands.
|
| 810 |
+
|
| 811 |
+
msg may be a string containing characters in the ASCII range, or a byte
|
| 812 |
+
string. A string is encoded to bytes using the ascii codec, and lone
|
| 813 |
+
\\r and \\n characters are converted to \\r\\n characters.
|
| 814 |
+
|
| 815 |
+
If there has been no previous EHLO or HELO command this session, this
|
| 816 |
+
method tries ESMTP EHLO first. If the server does ESMTP, message size
|
| 817 |
+
and each of the specified options will be passed to it. If EHLO
|
| 818 |
+
fails, HELO will be tried and ESMTP options suppressed.
|
| 819 |
+
|
| 820 |
+
This method will return normally if the mail is accepted for at least
|
| 821 |
+
one recipient. It returns a dictionary, with one entry for each
|
| 822 |
+
recipient that was refused. Each entry contains a tuple of the SMTP
|
| 823 |
+
error code and the accompanying error message sent by the server.
|
| 824 |
+
|
| 825 |
+
This method may raise the following exceptions:
|
| 826 |
+
|
| 827 |
+
SMTPHeloError The server didn't reply properly to
|
| 828 |
+
the helo greeting.
|
| 829 |
+
SMTPRecipientsRefused The server rejected ALL recipients
|
| 830 |
+
(no mail was sent).
|
| 831 |
+
SMTPSenderRefused The server didn't accept the from_addr.
|
| 832 |
+
SMTPDataError The server replied with an unexpected
|
| 833 |
+
error code (other than a refusal of
|
| 834 |
+
a recipient).
|
| 835 |
+
SMTPNotSupportedError The mail_options parameter includes 'SMTPUTF8'
|
| 836 |
+
but the SMTPUTF8 extension is not supported by
|
| 837 |
+
the server.
|
| 838 |
+
|
| 839 |
+
Note: the connection will be open even after an exception is raised.
|
| 840 |
+
|
| 841 |
+
Example:
|
| 842 |
+
|
| 843 |
+
>>> import smtplib
|
| 844 |
+
>>> s=smtplib.SMTP("localhost")
|
| 845 |
+
>>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
|
| 846 |
+
>>> msg = '''\\
|
| 847 |
+
... From: Me@my.org
|
| 848 |
+
... Subject: testin'...
|
| 849 |
+
...
|
| 850 |
+
... This is a test '''
|
| 851 |
+
>>> s.sendmail("me@my.org",tolist,msg)
|
| 852 |
+
{ "three@three.org" : ( 550 ,"User unknown" ) }
|
| 853 |
+
>>> s.quit()
|
| 854 |
+
|
| 855 |
+
In the above example, the message was accepted for delivery to three
|
| 856 |
+
of the four addresses, and one was rejected, with the error code
|
| 857 |
+
550. If all addresses are accepted, then the method will return an
|
| 858 |
+
empty dictionary.
|
| 859 |
+
|
| 860 |
+
"""
|
| 861 |
+
self.ehlo_or_helo_if_needed()
|
| 862 |
+
esmtp_opts = []
|
| 863 |
+
if isinstance(msg, str):
|
| 864 |
+
msg = _fix_eols(msg).encode('ascii')
|
| 865 |
+
if self.does_esmtp:
|
| 866 |
+
if self.has_extn('size'):
|
| 867 |
+
esmtp_opts.append("size=%d" % len(msg))
|
| 868 |
+
for option in mail_options:
|
| 869 |
+
esmtp_opts.append(option)
|
| 870 |
+
(code, resp) = self.mail(from_addr, esmtp_opts)
|
| 871 |
+
if code != 250:
|
| 872 |
+
if code == 421:
|
| 873 |
+
self.close()
|
| 874 |
+
else:
|
| 875 |
+
self._rset()
|
| 876 |
+
raise SMTPSenderRefused(code, resp, from_addr)
|
| 877 |
+
senderrs = {}
|
| 878 |
+
if isinstance(to_addrs, str):
|
| 879 |
+
to_addrs = [to_addrs]
|
| 880 |
+
for each in to_addrs:
|
| 881 |
+
(code, resp) = self.rcpt(each, rcpt_options)
|
| 882 |
+
if (code != 250) and (code != 251):
|
| 883 |
+
senderrs[each] = (code, resp)
|
| 884 |
+
if code == 421:
|
| 885 |
+
self.close()
|
| 886 |
+
raise SMTPRecipientsRefused(senderrs)
|
| 887 |
+
if len(senderrs) == len(to_addrs):
|
| 888 |
+
# the server refused all our recipients
|
| 889 |
+
self._rset()
|
| 890 |
+
raise SMTPRecipientsRefused(senderrs)
|
| 891 |
+
(code, resp) = self.data(msg)
|
| 892 |
+
if code != 250:
|
| 893 |
+
if code == 421:
|
| 894 |
+
self.close()
|
| 895 |
+
else:
|
| 896 |
+
self._rset()
|
| 897 |
+
raise SMTPDataError(code, resp)
|
| 898 |
+
#if we got here then somebody got our mail
|
| 899 |
+
return senderrs
|
| 900 |
+
|
| 901 |
+
def send_message(self, msg, from_addr=None, to_addrs=None,
|
| 902 |
+
mail_options=(), rcpt_options=()):
|
| 903 |
+
"""Converts message to a bytestring and passes it to sendmail.
|
| 904 |
+
|
| 905 |
+
The arguments are as for sendmail, except that msg is an
|
| 906 |
+
email.message.Message object. If from_addr is None or to_addrs is
|
| 907 |
+
None, these arguments are taken from the headers of the Message as
|
| 908 |
+
described in RFC 2822 (a ValueError is raised if there is more than
|
| 909 |
+
one set of 'Resent-' headers). Regardless of the values of from_addr and
|
| 910 |
+
to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
|
| 911 |
+
resent) of the Message object won't be transmitted. The Message
|
| 912 |
+
object is then serialized using email.generator.BytesGenerator and
|
| 913 |
+
sendmail is called to transmit the message. If the sender or any of
|
| 914 |
+
the recipient addresses contain non-ASCII and the server advertises the
|
| 915 |
+
SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
|
| 916 |
+
serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
|
| 917 |
+
If the server does not support SMTPUTF8, an SMTPNotSupported error is
|
| 918 |
+
raised. Otherwise the generator is called without modifying the
|
| 919 |
+
policy.
|
| 920 |
+
|
| 921 |
+
"""
|
| 922 |
+
# 'Resent-Date' is a mandatory field if the Message is resent (RFC 2822
|
| 923 |
+
# Section 3.6.6). In such a case, we use the 'Resent-*' fields. However,
|
| 924 |
+
# if there is more than one 'Resent-' block there's no way to
|
| 925 |
+
# unambiguously determine which one is the most recent in all cases,
|
| 926 |
+
# so rather than guess we raise a ValueError in that case.
|
| 927 |
+
#
|
| 928 |
+
# TODO implement heuristics to guess the correct Resent-* block with an
|
| 929 |
+
# option allowing the user to enable the heuristics. (It should be
|
| 930 |
+
# possible to guess correctly almost all of the time.)
|
| 931 |
+
|
| 932 |
+
self.ehlo_or_helo_if_needed()
|
| 933 |
+
resent = msg.get_all('Resent-Date')
|
| 934 |
+
if resent is None:
|
| 935 |
+
header_prefix = ''
|
| 936 |
+
elif len(resent) == 1:
|
| 937 |
+
header_prefix = 'Resent-'
|
| 938 |
+
else:
|
| 939 |
+
raise ValueError("message has more than one 'Resent-' header block")
|
| 940 |
+
if from_addr is None:
|
| 941 |
+
# Prefer the sender field per RFC 2822:3.6.2.
|
| 942 |
+
from_addr = (msg[header_prefix + 'Sender']
|
| 943 |
+
if (header_prefix + 'Sender') in msg
|
| 944 |
+
else msg[header_prefix + 'From'])
|
| 945 |
+
from_addr = email.utils.getaddresses([from_addr])[0][1]
|
| 946 |
+
if to_addrs is None:
|
| 947 |
+
addr_fields = [f for f in (msg[header_prefix + 'To'],
|
| 948 |
+
msg[header_prefix + 'Bcc'],
|
| 949 |
+
msg[header_prefix + 'Cc'])
|
| 950 |
+
if f is not None]
|
| 951 |
+
to_addrs = [a[1] for a in email.utils.getaddresses(addr_fields)]
|
| 952 |
+
# Make a local copy so we can delete the bcc headers.
|
| 953 |
+
msg_copy = copy.copy(msg)
|
| 954 |
+
del msg_copy['Bcc']
|
| 955 |
+
del msg_copy['Resent-Bcc']
|
| 956 |
+
international = False
|
| 957 |
+
try:
|
| 958 |
+
''.join([from_addr, *to_addrs]).encode('ascii')
|
| 959 |
+
except UnicodeEncodeError:
|
| 960 |
+
if not self.has_extn('smtputf8'):
|
| 961 |
+
raise SMTPNotSupportedError(
|
| 962 |
+
"One or more source or delivery addresses require"
|
| 963 |
+
" internationalized email support, but the server"
|
| 964 |
+
" does not advertise the required SMTPUTF8 capability")
|
| 965 |
+
international = True
|
| 966 |
+
with io.BytesIO() as bytesmsg:
|
| 967 |
+
if international:
|
| 968 |
+
g = email.generator.BytesGenerator(
|
| 969 |
+
bytesmsg, policy=msg.policy.clone(utf8=True))
|
| 970 |
+
mail_options = (*mail_options, 'SMTPUTF8', 'BODY=8BITMIME')
|
| 971 |
+
else:
|
| 972 |
+
g = email.generator.BytesGenerator(bytesmsg)
|
| 973 |
+
g.flatten(msg_copy, linesep='\r\n')
|
| 974 |
+
flatmsg = bytesmsg.getvalue()
|
| 975 |
+
return self.sendmail(from_addr, to_addrs, flatmsg, mail_options,
|
| 976 |
+
rcpt_options)
|
| 977 |
+
|
| 978 |
+
def close(self):
|
| 979 |
+
"""Close the connection to the SMTP server."""
|
| 980 |
+
try:
|
| 981 |
+
file = self.file
|
| 982 |
+
self.file = None
|
| 983 |
+
if file:
|
| 984 |
+
file.close()
|
| 985 |
+
finally:
|
| 986 |
+
sock = self.sock
|
| 987 |
+
self.sock = None
|
| 988 |
+
if sock:
|
| 989 |
+
sock.close()
|
| 990 |
+
|
| 991 |
+
def quit(self):
|
| 992 |
+
"""Terminate the SMTP session."""
|
| 993 |
+
res = self.docmd("quit")
|
| 994 |
+
# A new EHLO is required after reconnecting with connect()
|
| 995 |
+
self.ehlo_resp = self.helo_resp = None
|
| 996 |
+
self.esmtp_features = {}
|
| 997 |
+
self.does_esmtp = False
|
| 998 |
+
self.close()
|
| 999 |
+
return res
|
| 1000 |
+
|
| 1001 |
+
if _have_ssl:
|
| 1002 |
+
|
| 1003 |
+
class SMTP_SSL(SMTP):
|
| 1004 |
+
""" This is a subclass derived from SMTP that connects over an SSL
|
| 1005 |
+
encrypted socket (to use this class you need a socket module that was
|
| 1006 |
+
compiled with SSL support). If host is not specified, '' (the local
|
| 1007 |
+
host) is used. If port is omitted, the standard SMTP-over-SSL port
|
| 1008 |
+
(465) is used. local_hostname and source_address have the same meaning
|
| 1009 |
+
as they do in the SMTP class. context also optional, can contain a
|
| 1010 |
+
SSLContext.
|
| 1011 |
+
|
| 1012 |
+
"""
|
| 1013 |
+
|
| 1014 |
+
default_port = SMTP_SSL_PORT
|
| 1015 |
+
|
| 1016 |
+
def __init__(self, host='', port=0, local_hostname=None,
|
| 1017 |
+
*, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
| 1018 |
+
source_address=None, context=None):
|
| 1019 |
+
if context is None:
|
| 1020 |
+
context = ssl._create_stdlib_context()
|
| 1021 |
+
self.context = context
|
| 1022 |
+
SMTP.__init__(self, host, port, local_hostname, timeout,
|
| 1023 |
+
source_address)
|
| 1024 |
+
|
| 1025 |
+
def _get_socket(self, host, port, timeout):
|
| 1026 |
+
if self.debuglevel > 0:
|
| 1027 |
+
self._print_debug('connect:', (host, port))
|
| 1028 |
+
new_socket = super()._get_socket(host, port, timeout)
|
| 1029 |
+
new_socket = self.context.wrap_socket(new_socket,
|
| 1030 |
+
server_hostname=self._host)
|
| 1031 |
+
return new_socket
|
| 1032 |
+
|
| 1033 |
+
__all__.append("SMTP_SSL")
|
| 1034 |
+
|
| 1035 |
+
#
|
| 1036 |
+
# LMTP extension
|
| 1037 |
+
#
|
| 1038 |
+
LMTP_PORT = 2003
|
| 1039 |
+
|
| 1040 |
+
class LMTP(SMTP):
|
| 1041 |
+
"""LMTP - Local Mail Transfer Protocol
|
| 1042 |
+
|
| 1043 |
+
The LMTP protocol, which is very similar to ESMTP, is heavily based
|
| 1044 |
+
on the standard SMTP client. It's common to use Unix sockets for
|
| 1045 |
+
LMTP, so our connect() method must support that as well as a regular
|
| 1046 |
+
host:port server. local_hostname and source_address have the same
|
| 1047 |
+
meaning as they do in the SMTP class. To specify a Unix socket,
|
| 1048 |
+
you must use an absolute path as the host, starting with a '/'.
|
| 1049 |
+
|
| 1050 |
+
Authentication is supported, using the regular SMTP mechanism. When
|
| 1051 |
+
using a Unix socket, LMTP generally don't support or require any
|
| 1052 |
+
authentication, but your mileage might vary."""
|
| 1053 |
+
|
| 1054 |
+
ehlo_msg = "lhlo"
|
| 1055 |
+
|
| 1056 |
+
def __init__(self, host='', port=LMTP_PORT, local_hostname=None,
|
| 1057 |
+
source_address=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
|
| 1058 |
+
"""Initialize a new instance."""
|
| 1059 |
+
super().__init__(host, port, local_hostname=local_hostname,
|
| 1060 |
+
source_address=source_address, timeout=timeout)
|
| 1061 |
+
|
| 1062 |
+
def connect(self, host='localhost', port=0, source_address=None):
|
| 1063 |
+
"""Connect to the LMTP daemon, on either a Unix or a TCP socket."""
|
| 1064 |
+
if host[0] != '/':
|
| 1065 |
+
return super().connect(host, port, source_address=source_address)
|
| 1066 |
+
|
| 1067 |
+
if self.timeout is not None and not self.timeout:
|
| 1068 |
+
raise ValueError('Non-blocking socket (timeout=0) is not supported')
|
| 1069 |
+
|
| 1070 |
+
# Handle Unix-domain sockets.
|
| 1071 |
+
try:
|
| 1072 |
+
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
| 1073 |
+
if self.timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
|
| 1074 |
+
self.sock.settimeout(self.timeout)
|
| 1075 |
+
self.file = None
|
| 1076 |
+
self.sock.connect(host)
|
| 1077 |
+
except OSError:
|
| 1078 |
+
if self.debuglevel > 0:
|
| 1079 |
+
self._print_debug('connect fail:', host)
|
| 1080 |
+
if self.sock:
|
| 1081 |
+
self.sock.close()
|
| 1082 |
+
self.sock = None
|
| 1083 |
+
raise
|
| 1084 |
+
(code, msg) = self.getreply()
|
| 1085 |
+
if self.debuglevel > 0:
|
| 1086 |
+
self._print_debug('connect:', msg)
|
| 1087 |
+
return (code, msg)
|
| 1088 |
+
|
| 1089 |
+
|
| 1090 |
+
# Test the sendmail method, which tests most of the others.
|
| 1091 |
+
# Note: This always sends to localhost.
|
| 1092 |
+
if __name__ == '__main__':
|
| 1093 |
+
def prompt(prompt):
|
| 1094 |
+
sys.stdout.write(prompt + ": ")
|
| 1095 |
+
sys.stdout.flush()
|
| 1096 |
+
return sys.stdin.readline().strip()
|
| 1097 |
+
|
| 1098 |
+
fromaddr = prompt("From")
|
| 1099 |
+
toaddrs = prompt("To").split(',')
|
| 1100 |
+
print("Enter message, end with ^D:")
|
| 1101 |
+
msg = ''
|
| 1102 |
+
while line := sys.stdin.readline():
|
| 1103 |
+
msg = msg + line
|
| 1104 |
+
print("Message length is %d" % len(msg))
|
| 1105 |
+
|
| 1106 |
+
server = SMTP('localhost')
|
| 1107 |
+
server.set_debuglevel(1)
|
| 1108 |
+
server.sendmail(fromaddr, toaddrs, msg)
|
| 1109 |
+
server.quit()
|
player/runtime/python/Lib/sndhdr.py
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Routines to help recognizing sound files.
|
| 2 |
+
|
| 3 |
+
Function whathdr() recognizes various types of sound file headers.
|
| 4 |
+
It understands almost all headers that SOX can decode.
|
| 5 |
+
|
| 6 |
+
The return tuple contains the following items, in this order:
|
| 7 |
+
- file type (as SOX understands it)
|
| 8 |
+
- sampling rate (0 if unknown or hard to decode)
|
| 9 |
+
- number of channels (0 if unknown or hard to decode)
|
| 10 |
+
- number of frames in the file (-1 if unknown or hard to decode)
|
| 11 |
+
- number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW
|
| 12 |
+
|
| 13 |
+
If the file doesn't have a recognizable type, it returns None.
|
| 14 |
+
If the file can't be opened, OSError is raised.
|
| 15 |
+
|
| 16 |
+
To compute the total time, divide the number of frames by the
|
| 17 |
+
sampling rate (a frame contains a sample for each channel).
|
| 18 |
+
|
| 19 |
+
Function what() calls whathdr(). (It used to also use some
|
| 20 |
+
heuristics for raw data, but this doesn't work very well.)
|
| 21 |
+
|
| 22 |
+
Finally, the function test() is a simple main program that calls
|
| 23 |
+
what() for all files mentioned on the argument list. For directory
|
| 24 |
+
arguments it calls what() for all files in that directory. Default
|
| 25 |
+
argument is "." (testing all files in the current directory). The
|
| 26 |
+
option -r tells it to recurse down directories found inside
|
| 27 |
+
explicitly given directories.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
import warnings
|
| 31 |
+
|
| 32 |
+
warnings._deprecated(__name__, remove=(3, 13))
|
| 33 |
+
|
| 34 |
+
# The file structure is top-down except that the test program and its
|
| 35 |
+
# subroutine come last.
|
| 36 |
+
|
| 37 |
+
__all__ = ['what', 'whathdr']
|
| 38 |
+
|
| 39 |
+
from collections import namedtuple
|
| 40 |
+
|
| 41 |
+
SndHeaders = namedtuple('SndHeaders',
|
| 42 |
+
'filetype framerate nchannels nframes sampwidth')
|
| 43 |
+
|
| 44 |
+
SndHeaders.filetype.__doc__ = ("""The value for type indicates the data type
|
| 45 |
+
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
|
| 46 |
+
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.""")
|
| 47 |
+
SndHeaders.framerate.__doc__ = ("""The sampling_rate will be either the actual
|
| 48 |
+
value or 0 if unknown or difficult to decode.""")
|
| 49 |
+
SndHeaders.nchannels.__doc__ = ("""The number of channels or 0 if it cannot be
|
| 50 |
+
determined or if the value is difficult to decode.""")
|
| 51 |
+
SndHeaders.nframes.__doc__ = ("""The value for frames will be either the number
|
| 52 |
+
of frames or -1.""")
|
| 53 |
+
SndHeaders.sampwidth.__doc__ = ("""Either the sample size in bits or
|
| 54 |
+
'A' for A-LAW or 'U' for u-LAW.""")
|
| 55 |
+
|
| 56 |
+
def what(filename):
|
| 57 |
+
"""Guess the type of a sound file."""
|
| 58 |
+
res = whathdr(filename)
|
| 59 |
+
return res
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def whathdr(filename):
|
| 63 |
+
"""Recognize sound headers."""
|
| 64 |
+
with open(filename, 'rb') as f:
|
| 65 |
+
h = f.read(512)
|
| 66 |
+
for tf in tests:
|
| 67 |
+
res = tf(h, f)
|
| 68 |
+
if res:
|
| 69 |
+
return SndHeaders(*res)
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
#-----------------------------------#
|
| 74 |
+
# Subroutines per sound header type #
|
| 75 |
+
#-----------------------------------#
|
| 76 |
+
|
| 77 |
+
tests = []
|
| 78 |
+
|
| 79 |
+
def test_aifc(h, f):
|
| 80 |
+
"""AIFC and AIFF files"""
|
| 81 |
+
with warnings.catch_warnings():
|
| 82 |
+
warnings.simplefilter('ignore', category=DeprecationWarning)
|
| 83 |
+
import aifc
|
| 84 |
+
if not h.startswith(b'FORM'):
|
| 85 |
+
return None
|
| 86 |
+
if h[8:12] == b'AIFC':
|
| 87 |
+
fmt = 'aifc'
|
| 88 |
+
elif h[8:12] == b'AIFF':
|
| 89 |
+
fmt = 'aiff'
|
| 90 |
+
else:
|
| 91 |
+
return None
|
| 92 |
+
f.seek(0)
|
| 93 |
+
try:
|
| 94 |
+
a = aifc.open(f, 'r')
|
| 95 |
+
except (EOFError, aifc.Error):
|
| 96 |
+
return None
|
| 97 |
+
return (fmt, a.getframerate(), a.getnchannels(),
|
| 98 |
+
a.getnframes(), 8 * a.getsampwidth())
|
| 99 |
+
|
| 100 |
+
tests.append(test_aifc)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def test_au(h, f):
|
| 104 |
+
"""AU and SND files"""
|
| 105 |
+
if h.startswith(b'.snd'):
|
| 106 |
+
func = get_long_be
|
| 107 |
+
elif h[:4] in (b'\0ds.', b'dns.'):
|
| 108 |
+
func = get_long_le
|
| 109 |
+
else:
|
| 110 |
+
return None
|
| 111 |
+
filetype = 'au'
|
| 112 |
+
hdr_size = func(h[4:8])
|
| 113 |
+
data_size = func(h[8:12])
|
| 114 |
+
encoding = func(h[12:16])
|
| 115 |
+
rate = func(h[16:20])
|
| 116 |
+
nchannels = func(h[20:24])
|
| 117 |
+
sample_size = 1 # default
|
| 118 |
+
if encoding == 1:
|
| 119 |
+
sample_bits = 'U'
|
| 120 |
+
elif encoding == 2:
|
| 121 |
+
sample_bits = 8
|
| 122 |
+
elif encoding == 3:
|
| 123 |
+
sample_bits = 16
|
| 124 |
+
sample_size = 2
|
| 125 |
+
else:
|
| 126 |
+
sample_bits = '?'
|
| 127 |
+
frame_size = sample_size * nchannels
|
| 128 |
+
if frame_size:
|
| 129 |
+
nframe = data_size / frame_size
|
| 130 |
+
else:
|
| 131 |
+
nframe = -1
|
| 132 |
+
return filetype, rate, nchannels, nframe, sample_bits
|
| 133 |
+
|
| 134 |
+
tests.append(test_au)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def test_hcom(h, f):
|
| 138 |
+
"""HCOM file"""
|
| 139 |
+
if h[65:69] != b'FSSD' or h[128:132] != b'HCOM':
|
| 140 |
+
return None
|
| 141 |
+
divisor = get_long_be(h[144:148])
|
| 142 |
+
if divisor:
|
| 143 |
+
rate = 22050 / divisor
|
| 144 |
+
else:
|
| 145 |
+
rate = 0
|
| 146 |
+
return 'hcom', rate, 1, -1, 8
|
| 147 |
+
|
| 148 |
+
tests.append(test_hcom)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def test_voc(h, f):
|
| 152 |
+
"""VOC file"""
|
| 153 |
+
if not h.startswith(b'Creative Voice File\032'):
|
| 154 |
+
return None
|
| 155 |
+
sbseek = get_short_le(h[20:22])
|
| 156 |
+
rate = 0
|
| 157 |
+
if 0 <= sbseek < 500 and h[sbseek] == 1:
|
| 158 |
+
ratecode = 256 - h[sbseek+4]
|
| 159 |
+
if ratecode:
|
| 160 |
+
rate = int(1000000.0 / ratecode)
|
| 161 |
+
return 'voc', rate, 1, -1, 8
|
| 162 |
+
|
| 163 |
+
tests.append(test_voc)
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def test_wav(h, f):
|
| 167 |
+
"""WAV file"""
|
| 168 |
+
import wave
|
| 169 |
+
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
|
| 170 |
+
if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ':
|
| 171 |
+
return None
|
| 172 |
+
f.seek(0)
|
| 173 |
+
try:
|
| 174 |
+
w = wave.open(f, 'r')
|
| 175 |
+
except (EOFError, wave.Error):
|
| 176 |
+
return None
|
| 177 |
+
return ('wav', w.getframerate(), w.getnchannels(),
|
| 178 |
+
w.getnframes(), 8*w.getsampwidth())
|
| 179 |
+
|
| 180 |
+
tests.append(test_wav)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def test_8svx(h, f):
|
| 184 |
+
"""8SVX file"""
|
| 185 |
+
if not h.startswith(b'FORM') or h[8:12] != b'8SVX':
|
| 186 |
+
return None
|
| 187 |
+
# Should decode it to get #channels -- assume always 1
|
| 188 |
+
return '8svx', 0, 1, 0, 8
|
| 189 |
+
|
| 190 |
+
tests.append(test_8svx)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def test_sndt(h, f):
|
| 194 |
+
"""SNDT file"""
|
| 195 |
+
if h.startswith(b'SOUND'):
|
| 196 |
+
nsamples = get_long_le(h[8:12])
|
| 197 |
+
rate = get_short_le(h[20:22])
|
| 198 |
+
return 'sndt', rate, 1, nsamples, 8
|
| 199 |
+
|
| 200 |
+
tests.append(test_sndt)
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def test_sndr(h, f):
|
| 204 |
+
"""SNDR file"""
|
| 205 |
+
if h.startswith(b'\0\0'):
|
| 206 |
+
rate = get_short_le(h[2:4])
|
| 207 |
+
if 4000 <= rate <= 25000:
|
| 208 |
+
return 'sndr', rate, 1, -1, 8
|
| 209 |
+
|
| 210 |
+
tests.append(test_sndr)
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
#-------------------------------------------#
|
| 214 |
+
# Subroutines to extract numbers from bytes #
|
| 215 |
+
#-------------------------------------------#
|
| 216 |
+
|
| 217 |
+
def get_long_be(b):
|
| 218 |
+
return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]
|
| 219 |
+
|
| 220 |
+
def get_long_le(b):
|
| 221 |
+
return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]
|
| 222 |
+
|
| 223 |
+
def get_short_be(b):
|
| 224 |
+
return (b[0] << 8) | b[1]
|
| 225 |
+
|
| 226 |
+
def get_short_le(b):
|
| 227 |
+
return (b[1] << 8) | b[0]
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
#--------------------#
|
| 231 |
+
# Small test program #
|
| 232 |
+
#--------------------#
|
| 233 |
+
|
| 234 |
+
def test():
|
| 235 |
+
import sys
|
| 236 |
+
recursive = 0
|
| 237 |
+
if sys.argv[1:] and sys.argv[1] == '-r':
|
| 238 |
+
del sys.argv[1:2]
|
| 239 |
+
recursive = 1
|
| 240 |
+
try:
|
| 241 |
+
if sys.argv[1:]:
|
| 242 |
+
testall(sys.argv[1:], recursive, 1)
|
| 243 |
+
else:
|
| 244 |
+
testall(['.'], recursive, 1)
|
| 245 |
+
except KeyboardInterrupt:
|
| 246 |
+
sys.stderr.write('\n[Interrupted]\n')
|
| 247 |
+
sys.exit(1)
|
| 248 |
+
|
| 249 |
+
def testall(list, recursive, toplevel):
|
| 250 |
+
import sys
|
| 251 |
+
import os
|
| 252 |
+
for filename in list:
|
| 253 |
+
if os.path.isdir(filename):
|
| 254 |
+
print(filename + '/:', end=' ')
|
| 255 |
+
if recursive or toplevel:
|
| 256 |
+
print('recursing down:')
|
| 257 |
+
import glob
|
| 258 |
+
names = glob.glob(os.path.join(glob.escape(filename), '*'))
|
| 259 |
+
testall(names, recursive, 0)
|
| 260 |
+
else:
|
| 261 |
+
print('*** directory (use -r) ***')
|
| 262 |
+
else:
|
| 263 |
+
print(filename + ':', end=' ')
|
| 264 |
+
sys.stdout.flush()
|
| 265 |
+
try:
|
| 266 |
+
print(what(filename))
|
| 267 |
+
except OSError:
|
| 268 |
+
print('*** not found ***')
|
| 269 |
+
|
| 270 |
+
if __name__ == '__main__':
|
| 271 |
+
test()
|
player/runtime/python/Lib/socket.py
ADDED
|
@@ -0,0 +1,983 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Wrapper module for _socket, providing some additional facilities
|
| 2 |
+
# implemented in Python.
|
| 3 |
+
|
| 4 |
+
"""\
|
| 5 |
+
This module provides socket operations and some related functions.
|
| 6 |
+
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
|
| 7 |
+
On other systems, it only supports IP. Functions specific for a
|
| 8 |
+
socket are available as methods of the socket object.
|
| 9 |
+
|
| 10 |
+
Functions:
|
| 11 |
+
|
| 12 |
+
socket() -- create a new socket object
|
| 13 |
+
socketpair() -- create a pair of new socket objects [*]
|
| 14 |
+
fromfd() -- create a socket object from an open file descriptor [*]
|
| 15 |
+
send_fds() -- Send file descriptor to the socket.
|
| 16 |
+
recv_fds() -- Receive file descriptors from the socket.
|
| 17 |
+
fromshare() -- create a socket object from data received from socket.share() [*]
|
| 18 |
+
gethostname() -- return the current hostname
|
| 19 |
+
gethostbyname() -- map a hostname to its IP number
|
| 20 |
+
gethostbyaddr() -- map an IP number or hostname to DNS info
|
| 21 |
+
getservbyname() -- map a service name and a protocol name to a port number
|
| 22 |
+
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
|
| 23 |
+
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
|
| 24 |
+
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
|
| 25 |
+
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
|
| 26 |
+
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
|
| 27 |
+
socket.getdefaulttimeout() -- get the default timeout value
|
| 28 |
+
socket.setdefaulttimeout() -- set the default timeout value
|
| 29 |
+
create_connection() -- connects to an address, with an optional timeout and
|
| 30 |
+
optional source address.
|
| 31 |
+
create_server() -- create a TCP socket and bind it to a specified address.
|
| 32 |
+
|
| 33 |
+
[*] not available on all platforms!
|
| 34 |
+
|
| 35 |
+
Special objects:
|
| 36 |
+
|
| 37 |
+
SocketType -- type object for socket objects
|
| 38 |
+
error -- exception raised for I/O errors
|
| 39 |
+
has_ipv6 -- boolean value indicating if IPv6 is supported
|
| 40 |
+
|
| 41 |
+
IntEnum constants:
|
| 42 |
+
|
| 43 |
+
AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
|
| 44 |
+
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
|
| 45 |
+
|
| 46 |
+
Integer constants:
|
| 47 |
+
|
| 48 |
+
Many other constants may be defined; these may be used in calls to
|
| 49 |
+
the setsockopt() and getsockopt() methods.
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
import _socket
|
| 53 |
+
from _socket import *
|
| 54 |
+
|
| 55 |
+
import os, sys, io, selectors
|
| 56 |
+
from enum import IntEnum, IntFlag
|
| 57 |
+
|
| 58 |
+
try:
|
| 59 |
+
import errno
|
| 60 |
+
except ImportError:
|
| 61 |
+
errno = None
|
| 62 |
+
EBADF = getattr(errno, 'EBADF', 9)
|
| 63 |
+
EAGAIN = getattr(errno, 'EAGAIN', 11)
|
| 64 |
+
EWOULDBLOCK = getattr(errno, 'EWOULDBLOCK', 11)
|
| 65 |
+
|
| 66 |
+
__all__ = ["fromfd", "getfqdn", "create_connection", "create_server",
|
| 67 |
+
"has_dualstack_ipv6", "AddressFamily", "SocketKind"]
|
| 68 |
+
__all__.extend(os._get_exports_list(_socket))
|
| 69 |
+
|
| 70 |
+
# Set up the socket.AF_* socket.SOCK_* constants as members of IntEnums for
|
| 71 |
+
# nicer string representations.
|
| 72 |
+
# Note that _socket only knows about the integer values. The public interface
|
| 73 |
+
# in this module understands the enums and translates them back from integers
|
| 74 |
+
# where needed (e.g. .family property of a socket object).
|
| 75 |
+
|
| 76 |
+
IntEnum._convert_(
|
| 77 |
+
'AddressFamily',
|
| 78 |
+
__name__,
|
| 79 |
+
lambda C: C.isupper() and C.startswith('AF_'))
|
| 80 |
+
|
| 81 |
+
IntEnum._convert_(
|
| 82 |
+
'SocketKind',
|
| 83 |
+
__name__,
|
| 84 |
+
lambda C: C.isupper() and C.startswith('SOCK_'))
|
| 85 |
+
|
| 86 |
+
IntFlag._convert_(
|
| 87 |
+
'MsgFlag',
|
| 88 |
+
__name__,
|
| 89 |
+
lambda C: C.isupper() and C.startswith('MSG_'))
|
| 90 |
+
|
| 91 |
+
IntFlag._convert_(
|
| 92 |
+
'AddressInfo',
|
| 93 |
+
__name__,
|
| 94 |
+
lambda C: C.isupper() and C.startswith('AI_'))
|
| 95 |
+
|
| 96 |
+
_LOCALHOST = '127.0.0.1'
|
| 97 |
+
_LOCALHOST_V6 = '::1'
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def _intenum_converter(value, enum_klass):
|
| 101 |
+
"""Convert a numeric family value to an IntEnum member.
|
| 102 |
+
|
| 103 |
+
If it's not a known member, return the numeric value itself.
|
| 104 |
+
"""
|
| 105 |
+
try:
|
| 106 |
+
return enum_klass(value)
|
| 107 |
+
except ValueError:
|
| 108 |
+
return value
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# WSA error codes
|
| 112 |
+
if sys.platform.lower().startswith("win"):
|
| 113 |
+
errorTab = {}
|
| 114 |
+
errorTab[6] = "Specified event object handle is invalid."
|
| 115 |
+
errorTab[8] = "Insufficient memory available."
|
| 116 |
+
errorTab[87] = "One or more parameters are invalid."
|
| 117 |
+
errorTab[995] = "Overlapped operation aborted."
|
| 118 |
+
errorTab[996] = "Overlapped I/O event object not in signaled state."
|
| 119 |
+
errorTab[997] = "Overlapped operation will complete later."
|
| 120 |
+
errorTab[10004] = "The operation was interrupted."
|
| 121 |
+
errorTab[10009] = "A bad file handle was passed."
|
| 122 |
+
errorTab[10013] = "Permission denied."
|
| 123 |
+
errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT
|
| 124 |
+
errorTab[10022] = "An invalid operation was attempted."
|
| 125 |
+
errorTab[10024] = "Too many open files."
|
| 126 |
+
errorTab[10035] = "The socket operation would block."
|
| 127 |
+
errorTab[10036] = "A blocking operation is already in progress."
|
| 128 |
+
errorTab[10037] = "Operation already in progress."
|
| 129 |
+
errorTab[10038] = "Socket operation on nonsocket."
|
| 130 |
+
errorTab[10039] = "Destination address required."
|
| 131 |
+
errorTab[10040] = "Message too long."
|
| 132 |
+
errorTab[10041] = "Protocol wrong type for socket."
|
| 133 |
+
errorTab[10042] = "Bad protocol option."
|
| 134 |
+
errorTab[10043] = "Protocol not supported."
|
| 135 |
+
errorTab[10044] = "Socket type not supported."
|
| 136 |
+
errorTab[10045] = "Operation not supported."
|
| 137 |
+
errorTab[10046] = "Protocol family not supported."
|
| 138 |
+
errorTab[10047] = "Address family not supported by protocol family."
|
| 139 |
+
errorTab[10048] = "The network address is in use."
|
| 140 |
+
errorTab[10049] = "Cannot assign requested address."
|
| 141 |
+
errorTab[10050] = "Network is down."
|
| 142 |
+
errorTab[10051] = "Network is unreachable."
|
| 143 |
+
errorTab[10052] = "Network dropped connection on reset."
|
| 144 |
+
errorTab[10053] = "Software caused connection abort."
|
| 145 |
+
errorTab[10054] = "The connection has been reset."
|
| 146 |
+
errorTab[10055] = "No buffer space available."
|
| 147 |
+
errorTab[10056] = "Socket is already connected."
|
| 148 |
+
errorTab[10057] = "Socket is not connected."
|
| 149 |
+
errorTab[10058] = "The network has been shut down."
|
| 150 |
+
errorTab[10059] = "Too many references."
|
| 151 |
+
errorTab[10060] = "The operation timed out."
|
| 152 |
+
errorTab[10061] = "Connection refused."
|
| 153 |
+
errorTab[10062] = "Cannot translate name."
|
| 154 |
+
errorTab[10063] = "The name is too long."
|
| 155 |
+
errorTab[10064] = "The host is down."
|
| 156 |
+
errorTab[10065] = "The host is unreachable."
|
| 157 |
+
errorTab[10066] = "Directory not empty."
|
| 158 |
+
errorTab[10067] = "Too many processes."
|
| 159 |
+
errorTab[10068] = "User quota exceeded."
|
| 160 |
+
errorTab[10069] = "Disk quota exceeded."
|
| 161 |
+
errorTab[10070] = "Stale file handle reference."
|
| 162 |
+
errorTab[10071] = "Item is remote."
|
| 163 |
+
errorTab[10091] = "Network subsystem is unavailable."
|
| 164 |
+
errorTab[10092] = "Winsock.dll version out of range."
|
| 165 |
+
errorTab[10093] = "Successful WSAStartup not yet performed."
|
| 166 |
+
errorTab[10101] = "Graceful shutdown in progress."
|
| 167 |
+
errorTab[10102] = "No more results from WSALookupServiceNext."
|
| 168 |
+
errorTab[10103] = "Call has been canceled."
|
| 169 |
+
errorTab[10104] = "Procedure call table is invalid."
|
| 170 |
+
errorTab[10105] = "Service provider is invalid."
|
| 171 |
+
errorTab[10106] = "Service provider failed to initialize."
|
| 172 |
+
errorTab[10107] = "System call failure."
|
| 173 |
+
errorTab[10108] = "Service not found."
|
| 174 |
+
errorTab[10109] = "Class type not found."
|
| 175 |
+
errorTab[10110] = "No more results from WSALookupServiceNext."
|
| 176 |
+
errorTab[10111] = "Call was canceled."
|
| 177 |
+
errorTab[10112] = "Database query was refused."
|
| 178 |
+
errorTab[11001] = "Host not found."
|
| 179 |
+
errorTab[11002] = "Nonauthoritative host not found."
|
| 180 |
+
errorTab[11003] = "This is a nonrecoverable error."
|
| 181 |
+
errorTab[11004] = "Valid name, no data record requested type."
|
| 182 |
+
errorTab[11005] = "QoS receivers."
|
| 183 |
+
errorTab[11006] = "QoS senders."
|
| 184 |
+
errorTab[11007] = "No QoS senders."
|
| 185 |
+
errorTab[11008] = "QoS no receivers."
|
| 186 |
+
errorTab[11009] = "QoS request confirmed."
|
| 187 |
+
errorTab[11010] = "QoS admission error."
|
| 188 |
+
errorTab[11011] = "QoS policy failure."
|
| 189 |
+
errorTab[11012] = "QoS bad style."
|
| 190 |
+
errorTab[11013] = "QoS bad object."
|
| 191 |
+
errorTab[11014] = "QoS traffic control error."
|
| 192 |
+
errorTab[11015] = "QoS generic error."
|
| 193 |
+
errorTab[11016] = "QoS service type error."
|
| 194 |
+
errorTab[11017] = "QoS flowspec error."
|
| 195 |
+
errorTab[11018] = "Invalid QoS provider buffer."
|
| 196 |
+
errorTab[11019] = "Invalid QoS filter style."
|
| 197 |
+
errorTab[11020] = "Invalid QoS filter style."
|
| 198 |
+
errorTab[11021] = "Incorrect QoS filter count."
|
| 199 |
+
errorTab[11022] = "Invalid QoS object length."
|
| 200 |
+
errorTab[11023] = "Incorrect QoS flow count."
|
| 201 |
+
errorTab[11024] = "Unrecognized QoS object."
|
| 202 |
+
errorTab[11025] = "Invalid QoS policy object."
|
| 203 |
+
errorTab[11026] = "Invalid QoS flow descriptor."
|
| 204 |
+
errorTab[11027] = "Invalid QoS provider-specific flowspec."
|
| 205 |
+
errorTab[11028] = "Invalid QoS provider-specific filterspec."
|
| 206 |
+
errorTab[11029] = "Invalid QoS shape discard mode object."
|
| 207 |
+
errorTab[11030] = "Invalid QoS shaping rate object."
|
| 208 |
+
errorTab[11031] = "Reserved policy QoS element type."
|
| 209 |
+
__all__.append("errorTab")
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
class _GiveupOnSendfile(Exception): pass
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class socket(_socket.socket):
|
| 216 |
+
|
| 217 |
+
"""A subclass of _socket.socket adding the makefile() method."""
|
| 218 |
+
|
| 219 |
+
__slots__ = ["__weakref__", "_io_refs", "_closed"]
|
| 220 |
+
|
| 221 |
+
def __init__(self, family=-1, type=-1, proto=-1, fileno=None):
|
| 222 |
+
# For user code address family and type values are IntEnum members, but
|
| 223 |
+
# for the underlying _socket.socket they're just integers. The
|
| 224 |
+
# constructor of _socket.socket converts the given argument to an
|
| 225 |
+
# integer automatically.
|
| 226 |
+
if fileno is None:
|
| 227 |
+
if family == -1:
|
| 228 |
+
family = AF_INET
|
| 229 |
+
if type == -1:
|
| 230 |
+
type = SOCK_STREAM
|
| 231 |
+
if proto == -1:
|
| 232 |
+
proto = 0
|
| 233 |
+
_socket.socket.__init__(self, family, type, proto, fileno)
|
| 234 |
+
self._io_refs = 0
|
| 235 |
+
self._closed = False
|
| 236 |
+
|
| 237 |
+
def __enter__(self):
|
| 238 |
+
return self
|
| 239 |
+
|
| 240 |
+
def __exit__(self, *args):
|
| 241 |
+
if not self._closed:
|
| 242 |
+
self.close()
|
| 243 |
+
|
| 244 |
+
def __repr__(self):
|
| 245 |
+
"""Wrap __repr__() to reveal the real class name and socket
|
| 246 |
+
address(es).
|
| 247 |
+
"""
|
| 248 |
+
closed = getattr(self, '_closed', False)
|
| 249 |
+
s = "<%s.%s%s fd=%i, family=%s, type=%s, proto=%i" \
|
| 250 |
+
% (self.__class__.__module__,
|
| 251 |
+
self.__class__.__qualname__,
|
| 252 |
+
" [closed]" if closed else "",
|
| 253 |
+
self.fileno(),
|
| 254 |
+
self.family,
|
| 255 |
+
self.type,
|
| 256 |
+
self.proto)
|
| 257 |
+
if not closed:
|
| 258 |
+
# getsockname and getpeername may not be available on WASI.
|
| 259 |
+
try:
|
| 260 |
+
laddr = self.getsockname()
|
| 261 |
+
if laddr:
|
| 262 |
+
s += ", laddr=%s" % str(laddr)
|
| 263 |
+
except (error, AttributeError):
|
| 264 |
+
pass
|
| 265 |
+
try:
|
| 266 |
+
raddr = self.getpeername()
|
| 267 |
+
if raddr:
|
| 268 |
+
s += ", raddr=%s" % str(raddr)
|
| 269 |
+
except (error, AttributeError):
|
| 270 |
+
pass
|
| 271 |
+
s += '>'
|
| 272 |
+
return s
|
| 273 |
+
|
| 274 |
+
def __getstate__(self):
|
| 275 |
+
raise TypeError(f"cannot pickle {self.__class__.__name__!r} object")
|
| 276 |
+
|
| 277 |
+
def dup(self):
|
| 278 |
+
"""dup() -> socket object
|
| 279 |
+
|
| 280 |
+
Duplicate the socket. Return a new socket object connected to the same
|
| 281 |
+
system resource. The new socket is non-inheritable.
|
| 282 |
+
"""
|
| 283 |
+
fd = dup(self.fileno())
|
| 284 |
+
sock = self.__class__(self.family, self.type, self.proto, fileno=fd)
|
| 285 |
+
sock.settimeout(self.gettimeout())
|
| 286 |
+
return sock
|
| 287 |
+
|
| 288 |
+
def accept(self):
|
| 289 |
+
"""accept() -> (socket object, address info)
|
| 290 |
+
|
| 291 |
+
Wait for an incoming connection. Return a new socket
|
| 292 |
+
representing the connection, and the address of the client.
|
| 293 |
+
For IP sockets, the address info is a pair (hostaddr, port).
|
| 294 |
+
"""
|
| 295 |
+
fd, addr = self._accept()
|
| 296 |
+
sock = socket(self.family, self.type, self.proto, fileno=fd)
|
| 297 |
+
# Issue #7995: if no default timeout is set and the listening
|
| 298 |
+
# socket had a (non-zero) timeout, force the new socket in blocking
|
| 299 |
+
# mode to override platform-specific socket flags inheritance.
|
| 300 |
+
if getdefaulttimeout() is None and self.gettimeout():
|
| 301 |
+
sock.setblocking(True)
|
| 302 |
+
return sock, addr
|
| 303 |
+
|
| 304 |
+
def makefile(self, mode="r", buffering=None, *,
|
| 305 |
+
encoding=None, errors=None, newline=None):
|
| 306 |
+
"""makefile(...) -> an I/O stream connected to the socket
|
| 307 |
+
|
| 308 |
+
The arguments are as for io.open() after the filename, except the only
|
| 309 |
+
supported mode values are 'r' (default), 'w', 'b', or a combination of
|
| 310 |
+
those.
|
| 311 |
+
"""
|
| 312 |
+
# XXX refactor to share code?
|
| 313 |
+
if not set(mode) <= {"r", "w", "b"}:
|
| 314 |
+
raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
|
| 315 |
+
writing = "w" in mode
|
| 316 |
+
reading = "r" in mode or not writing
|
| 317 |
+
assert reading or writing
|
| 318 |
+
binary = "b" in mode
|
| 319 |
+
rawmode = ""
|
| 320 |
+
if reading:
|
| 321 |
+
rawmode += "r"
|
| 322 |
+
if writing:
|
| 323 |
+
rawmode += "w"
|
| 324 |
+
raw = SocketIO(self, rawmode)
|
| 325 |
+
self._io_refs += 1
|
| 326 |
+
if buffering is None:
|
| 327 |
+
buffering = -1
|
| 328 |
+
if buffering < 0:
|
| 329 |
+
buffering = io.DEFAULT_BUFFER_SIZE
|
| 330 |
+
if buffering == 0:
|
| 331 |
+
if not binary:
|
| 332 |
+
raise ValueError("unbuffered streams must be binary")
|
| 333 |
+
return raw
|
| 334 |
+
if reading and writing:
|
| 335 |
+
buffer = io.BufferedRWPair(raw, raw, buffering)
|
| 336 |
+
elif reading:
|
| 337 |
+
buffer = io.BufferedReader(raw, buffering)
|
| 338 |
+
else:
|
| 339 |
+
assert writing
|
| 340 |
+
buffer = io.BufferedWriter(raw, buffering)
|
| 341 |
+
if binary:
|
| 342 |
+
return buffer
|
| 343 |
+
encoding = io.text_encoding(encoding)
|
| 344 |
+
text = io.TextIOWrapper(buffer, encoding, errors, newline)
|
| 345 |
+
text.mode = mode
|
| 346 |
+
return text
|
| 347 |
+
|
| 348 |
+
if hasattr(os, 'sendfile'):
|
| 349 |
+
|
| 350 |
+
def _sendfile_use_sendfile(self, file, offset=0, count=None):
|
| 351 |
+
self._check_sendfile_params(file, offset, count)
|
| 352 |
+
sockno = self.fileno()
|
| 353 |
+
try:
|
| 354 |
+
fileno = file.fileno()
|
| 355 |
+
except (AttributeError, io.UnsupportedOperation) as err:
|
| 356 |
+
raise _GiveupOnSendfile(err) # not a regular file
|
| 357 |
+
try:
|
| 358 |
+
fsize = os.fstat(fileno).st_size
|
| 359 |
+
except OSError as err:
|
| 360 |
+
raise _GiveupOnSendfile(err) # not a regular file
|
| 361 |
+
if not fsize:
|
| 362 |
+
return 0 # empty file
|
| 363 |
+
# Truncate to 1GiB to avoid OverflowError, see bpo-38319.
|
| 364 |
+
blocksize = min(count or fsize, 2 ** 30)
|
| 365 |
+
timeout = self.gettimeout()
|
| 366 |
+
if timeout == 0:
|
| 367 |
+
raise ValueError("non-blocking sockets are not supported")
|
| 368 |
+
# poll/select have the advantage of not requiring any
|
| 369 |
+
# extra file descriptor, contrarily to epoll/kqueue
|
| 370 |
+
# (also, they require a single syscall).
|
| 371 |
+
if hasattr(selectors, 'PollSelector'):
|
| 372 |
+
selector = selectors.PollSelector()
|
| 373 |
+
else:
|
| 374 |
+
selector = selectors.SelectSelector()
|
| 375 |
+
selector.register(sockno, selectors.EVENT_WRITE)
|
| 376 |
+
|
| 377 |
+
total_sent = 0
|
| 378 |
+
# localize variable access to minimize overhead
|
| 379 |
+
selector_select = selector.select
|
| 380 |
+
os_sendfile = os.sendfile
|
| 381 |
+
try:
|
| 382 |
+
while True:
|
| 383 |
+
if timeout and not selector_select(timeout):
|
| 384 |
+
raise TimeoutError('timed out')
|
| 385 |
+
if count:
|
| 386 |
+
blocksize = min(count - total_sent, blocksize)
|
| 387 |
+
if blocksize <= 0:
|
| 388 |
+
break
|
| 389 |
+
try:
|
| 390 |
+
sent = os_sendfile(sockno, fileno, offset, blocksize)
|
| 391 |
+
except BlockingIOError:
|
| 392 |
+
if not timeout:
|
| 393 |
+
# Block until the socket is ready to send some
|
| 394 |
+
# data; avoids hogging CPU resources.
|
| 395 |
+
selector_select()
|
| 396 |
+
continue
|
| 397 |
+
except OSError as err:
|
| 398 |
+
if total_sent == 0:
|
| 399 |
+
# We can get here for different reasons, the main
|
| 400 |
+
# one being 'file' is not a regular mmap(2)-like
|
| 401 |
+
# file, in which case we'll fall back on using
|
| 402 |
+
# plain send().
|
| 403 |
+
raise _GiveupOnSendfile(err)
|
| 404 |
+
raise err from None
|
| 405 |
+
else:
|
| 406 |
+
if sent == 0:
|
| 407 |
+
break # EOF
|
| 408 |
+
offset += sent
|
| 409 |
+
total_sent += sent
|
| 410 |
+
return total_sent
|
| 411 |
+
finally:
|
| 412 |
+
if total_sent > 0 and hasattr(file, 'seek'):
|
| 413 |
+
file.seek(offset)
|
| 414 |
+
else:
|
| 415 |
+
def _sendfile_use_sendfile(self, file, offset=0, count=None):
|
| 416 |
+
raise _GiveupOnSendfile(
|
| 417 |
+
"os.sendfile() not available on this platform")
|
| 418 |
+
|
| 419 |
+
def _sendfile_use_send(self, file, offset=0, count=None):
|
| 420 |
+
self._check_sendfile_params(file, offset, count)
|
| 421 |
+
if self.gettimeout() == 0:
|
| 422 |
+
raise ValueError("non-blocking sockets are not supported")
|
| 423 |
+
if offset:
|
| 424 |
+
file.seek(offset)
|
| 425 |
+
blocksize = min(count, 8192) if count else 8192
|
| 426 |
+
total_sent = 0
|
| 427 |
+
# localize variable access to minimize overhead
|
| 428 |
+
file_read = file.read
|
| 429 |
+
sock_send = self.send
|
| 430 |
+
try:
|
| 431 |
+
while True:
|
| 432 |
+
if count:
|
| 433 |
+
blocksize = min(count - total_sent, blocksize)
|
| 434 |
+
if blocksize <= 0:
|
| 435 |
+
break
|
| 436 |
+
data = memoryview(file_read(blocksize))
|
| 437 |
+
if not data:
|
| 438 |
+
break # EOF
|
| 439 |
+
while True:
|
| 440 |
+
try:
|
| 441 |
+
sent = sock_send(data)
|
| 442 |
+
except BlockingIOError:
|
| 443 |
+
continue
|
| 444 |
+
else:
|
| 445 |
+
total_sent += sent
|
| 446 |
+
if sent < len(data):
|
| 447 |
+
data = data[sent:]
|
| 448 |
+
else:
|
| 449 |
+
break
|
| 450 |
+
return total_sent
|
| 451 |
+
finally:
|
| 452 |
+
if total_sent > 0 and hasattr(file, 'seek'):
|
| 453 |
+
file.seek(offset + total_sent)
|
| 454 |
+
|
| 455 |
+
def _check_sendfile_params(self, file, offset, count):
|
| 456 |
+
if 'b' not in getattr(file, 'mode', 'b'):
|
| 457 |
+
raise ValueError("file should be opened in binary mode")
|
| 458 |
+
if not self.type & SOCK_STREAM:
|
| 459 |
+
raise ValueError("only SOCK_STREAM type sockets are supported")
|
| 460 |
+
if count is not None:
|
| 461 |
+
if not isinstance(count, int):
|
| 462 |
+
raise TypeError(
|
| 463 |
+
"count must be a positive integer (got {!r})".format(count))
|
| 464 |
+
if count <= 0:
|
| 465 |
+
raise ValueError(
|
| 466 |
+
"count must be a positive integer (got {!r})".format(count))
|
| 467 |
+
|
| 468 |
+
def sendfile(self, file, offset=0, count=None):
|
| 469 |
+
"""sendfile(file[, offset[, count]]) -> sent
|
| 470 |
+
|
| 471 |
+
Send a file until EOF is reached by using high-performance
|
| 472 |
+
os.sendfile() and return the total number of bytes which
|
| 473 |
+
were sent.
|
| 474 |
+
*file* must be a regular file object opened in binary mode.
|
| 475 |
+
If os.sendfile() is not available (e.g. Windows) or file is
|
| 476 |
+
not a regular file socket.send() will be used instead.
|
| 477 |
+
*offset* tells from where to start reading the file.
|
| 478 |
+
If specified, *count* is the total number of bytes to transmit
|
| 479 |
+
as opposed to sending the file until EOF is reached.
|
| 480 |
+
File position is updated on return or also in case of error in
|
| 481 |
+
which case file.tell() can be used to figure out the number of
|
| 482 |
+
bytes which were sent.
|
| 483 |
+
The socket must be of SOCK_STREAM type.
|
| 484 |
+
Non-blocking sockets are not supported.
|
| 485 |
+
"""
|
| 486 |
+
try:
|
| 487 |
+
return self._sendfile_use_sendfile(file, offset, count)
|
| 488 |
+
except _GiveupOnSendfile:
|
| 489 |
+
return self._sendfile_use_send(file, offset, count)
|
| 490 |
+
|
| 491 |
+
def _decref_socketios(self):
|
| 492 |
+
if self._io_refs > 0:
|
| 493 |
+
self._io_refs -= 1
|
| 494 |
+
if self._closed:
|
| 495 |
+
self.close()
|
| 496 |
+
|
| 497 |
+
def _real_close(self, _ss=_socket.socket):
|
| 498 |
+
# This function should not reference any globals. See issue #808164.
|
| 499 |
+
_ss.close(self)
|
| 500 |
+
|
| 501 |
+
def close(self):
|
| 502 |
+
# This function should not reference any globals. See issue #808164.
|
| 503 |
+
self._closed = True
|
| 504 |
+
if self._io_refs <= 0:
|
| 505 |
+
self._real_close()
|
| 506 |
+
|
| 507 |
+
def detach(self):
|
| 508 |
+
"""detach() -> file descriptor
|
| 509 |
+
|
| 510 |
+
Close the socket object without closing the underlying file descriptor.
|
| 511 |
+
The object cannot be used after this call, but the file descriptor
|
| 512 |
+
can be reused for other purposes. The file descriptor is returned.
|
| 513 |
+
"""
|
| 514 |
+
self._closed = True
|
| 515 |
+
return super().detach()
|
| 516 |
+
|
| 517 |
+
@property
|
| 518 |
+
def family(self):
|
| 519 |
+
"""Read-only access to the address family for this socket.
|
| 520 |
+
"""
|
| 521 |
+
return _intenum_converter(super().family, AddressFamily)
|
| 522 |
+
|
| 523 |
+
@property
|
| 524 |
+
def type(self):
|
| 525 |
+
"""Read-only access to the socket type.
|
| 526 |
+
"""
|
| 527 |
+
return _intenum_converter(super().type, SocketKind)
|
| 528 |
+
|
| 529 |
+
if os.name == 'nt':
|
| 530 |
+
def get_inheritable(self):
|
| 531 |
+
return os.get_handle_inheritable(self.fileno())
|
| 532 |
+
def set_inheritable(self, inheritable):
|
| 533 |
+
os.set_handle_inheritable(self.fileno(), inheritable)
|
| 534 |
+
else:
|
| 535 |
+
def get_inheritable(self):
|
| 536 |
+
return os.get_inheritable(self.fileno())
|
| 537 |
+
def set_inheritable(self, inheritable):
|
| 538 |
+
os.set_inheritable(self.fileno(), inheritable)
|
| 539 |
+
get_inheritable.__doc__ = "Get the inheritable flag of the socket"
|
| 540 |
+
set_inheritable.__doc__ = "Set the inheritable flag of the socket"
|
| 541 |
+
|
| 542 |
+
def fromfd(fd, family, type, proto=0):
|
| 543 |
+
""" fromfd(fd, family, type[, proto]) -> socket object
|
| 544 |
+
|
| 545 |
+
Create a socket object from a duplicate of the given file
|
| 546 |
+
descriptor. The remaining arguments are the same as for socket().
|
| 547 |
+
"""
|
| 548 |
+
nfd = dup(fd)
|
| 549 |
+
return socket(family, type, proto, nfd)
|
| 550 |
+
|
| 551 |
+
if hasattr(_socket.socket, "sendmsg"):
|
| 552 |
+
import array
|
| 553 |
+
|
| 554 |
+
def send_fds(sock, buffers, fds, flags=0, address=None):
|
| 555 |
+
""" send_fds(sock, buffers, fds[, flags[, address]]) -> integer
|
| 556 |
+
|
| 557 |
+
Send the list of file descriptors fds over an AF_UNIX socket.
|
| 558 |
+
"""
|
| 559 |
+
return sock.sendmsg(buffers, [(_socket.SOL_SOCKET,
|
| 560 |
+
_socket.SCM_RIGHTS, array.array("i", fds))])
|
| 561 |
+
__all__.append("send_fds")
|
| 562 |
+
|
| 563 |
+
if hasattr(_socket.socket, "recvmsg"):
|
| 564 |
+
import array
|
| 565 |
+
|
| 566 |
+
def recv_fds(sock, bufsize, maxfds, flags=0):
|
| 567 |
+
""" recv_fds(sock, bufsize, maxfds[, flags]) -> (data, list of file
|
| 568 |
+
descriptors, msg_flags, address)
|
| 569 |
+
|
| 570 |
+
Receive up to maxfds file descriptors returning the message
|
| 571 |
+
data and a list containing the descriptors.
|
| 572 |
+
"""
|
| 573 |
+
# Array of ints
|
| 574 |
+
fds = array.array("i")
|
| 575 |
+
msg, ancdata, flags, addr = sock.recvmsg(bufsize,
|
| 576 |
+
_socket.CMSG_LEN(maxfds * fds.itemsize))
|
| 577 |
+
for cmsg_level, cmsg_type, cmsg_data in ancdata:
|
| 578 |
+
if (cmsg_level == _socket.SOL_SOCKET and cmsg_type == _socket.SCM_RIGHTS):
|
| 579 |
+
fds.frombytes(cmsg_data[:
|
| 580 |
+
len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
|
| 581 |
+
|
| 582 |
+
return msg, list(fds), flags, addr
|
| 583 |
+
__all__.append("recv_fds")
|
| 584 |
+
|
| 585 |
+
if hasattr(_socket.socket, "share"):
|
| 586 |
+
def fromshare(info):
|
| 587 |
+
""" fromshare(info) -> socket object
|
| 588 |
+
|
| 589 |
+
Create a socket object from the bytes object returned by
|
| 590 |
+
socket.share(pid).
|
| 591 |
+
"""
|
| 592 |
+
return socket(0, 0, 0, info)
|
| 593 |
+
__all__.append("fromshare")
|
| 594 |
+
|
| 595 |
+
# Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain.
|
| 596 |
+
# This is used if _socket doesn't natively provide socketpair. It's
|
| 597 |
+
# always defined so that it can be patched in for testing purposes.
|
| 598 |
+
def _fallback_socketpair(family=AF_INET, type=SOCK_STREAM, proto=0):
|
| 599 |
+
if family == AF_INET:
|
| 600 |
+
host = _LOCALHOST
|
| 601 |
+
elif family == AF_INET6:
|
| 602 |
+
host = _LOCALHOST_V6
|
| 603 |
+
else:
|
| 604 |
+
raise ValueError("Only AF_INET and AF_INET6 socket address families "
|
| 605 |
+
"are supported")
|
| 606 |
+
if type != SOCK_STREAM:
|
| 607 |
+
raise ValueError("Only SOCK_STREAM socket type is supported")
|
| 608 |
+
if proto != 0:
|
| 609 |
+
raise ValueError("Only protocol zero is supported")
|
| 610 |
+
|
| 611 |
+
# We create a connected TCP socket. Note the trick with
|
| 612 |
+
# setblocking(False) that prevents us from having to create a thread.
|
| 613 |
+
lsock = socket(family, type, proto)
|
| 614 |
+
try:
|
| 615 |
+
lsock.bind((host, 0))
|
| 616 |
+
lsock.listen()
|
| 617 |
+
# On IPv6, ignore flow_info and scope_id
|
| 618 |
+
addr, port = lsock.getsockname()[:2]
|
| 619 |
+
csock = socket(family, type, proto)
|
| 620 |
+
try:
|
| 621 |
+
csock.setblocking(False)
|
| 622 |
+
try:
|
| 623 |
+
csock.connect((addr, port))
|
| 624 |
+
except (BlockingIOError, InterruptedError):
|
| 625 |
+
pass
|
| 626 |
+
csock.setblocking(True)
|
| 627 |
+
ssock, _ = lsock.accept()
|
| 628 |
+
except:
|
| 629 |
+
csock.close()
|
| 630 |
+
raise
|
| 631 |
+
finally:
|
| 632 |
+
lsock.close()
|
| 633 |
+
|
| 634 |
+
# Authenticating avoids using a connection from something else
|
| 635 |
+
# able to connect to {host}:{port} instead of us.
|
| 636 |
+
# We expect only AF_INET and AF_INET6 families.
|
| 637 |
+
try:
|
| 638 |
+
if (
|
| 639 |
+
ssock.getsockname() != csock.getpeername()
|
| 640 |
+
or csock.getsockname() != ssock.getpeername()
|
| 641 |
+
):
|
| 642 |
+
raise ConnectionError("Unexpected peer connection")
|
| 643 |
+
except:
|
| 644 |
+
# getsockname() and getpeername() can fail
|
| 645 |
+
# if either socket isn't connected.
|
| 646 |
+
ssock.close()
|
| 647 |
+
csock.close()
|
| 648 |
+
raise
|
| 649 |
+
|
| 650 |
+
return (ssock, csock)
|
| 651 |
+
|
| 652 |
+
if hasattr(_socket, "socketpair"):
|
| 653 |
+
def socketpair(family=None, type=SOCK_STREAM, proto=0):
|
| 654 |
+
if family is None:
|
| 655 |
+
try:
|
| 656 |
+
family = AF_UNIX
|
| 657 |
+
except NameError:
|
| 658 |
+
family = AF_INET
|
| 659 |
+
a, b = _socket.socketpair(family, type, proto)
|
| 660 |
+
a = socket(family, type, proto, a.detach())
|
| 661 |
+
b = socket(family, type, proto, b.detach())
|
| 662 |
+
return a, b
|
| 663 |
+
|
| 664 |
+
else:
|
| 665 |
+
socketpair = _fallback_socketpair
|
| 666 |
+
__all__.append("socketpair")
|
| 667 |
+
|
| 668 |
+
socketpair.__doc__ = """socketpair([family[, type[, proto]]]) -> (socket object, socket object)
|
| 669 |
+
Create a pair of socket objects from the sockets returned by the platform
|
| 670 |
+
socketpair() function.
|
| 671 |
+
The arguments are the same as for socket() except the default family is AF_UNIX
|
| 672 |
+
if defined on the platform; otherwise, the default is AF_INET.
|
| 673 |
+
"""
|
| 674 |
+
|
| 675 |
+
_blocking_errnos = { EAGAIN, EWOULDBLOCK }
|
| 676 |
+
|
| 677 |
+
class SocketIO(io.RawIOBase):
|
| 678 |
+
|
| 679 |
+
"""Raw I/O implementation for stream sockets.
|
| 680 |
+
|
| 681 |
+
This class supports the makefile() method on sockets. It provides
|
| 682 |
+
the raw I/O interface on top of a socket object.
|
| 683 |
+
"""
|
| 684 |
+
|
| 685 |
+
# One might wonder why not let FileIO do the job instead. There are two
|
| 686 |
+
# main reasons why FileIO is not adapted:
|
| 687 |
+
# - it wouldn't work under Windows (where you can't used read() and
|
| 688 |
+
# write() on a socket handle)
|
| 689 |
+
# - it wouldn't work with socket timeouts (FileIO would ignore the
|
| 690 |
+
# timeout and consider the socket non-blocking)
|
| 691 |
+
|
| 692 |
+
# XXX More docs
|
| 693 |
+
|
| 694 |
+
def __init__(self, sock, mode):
|
| 695 |
+
if mode not in ("r", "w", "rw", "rb", "wb", "rwb"):
|
| 696 |
+
raise ValueError("invalid mode: %r" % mode)
|
| 697 |
+
io.RawIOBase.__init__(self)
|
| 698 |
+
self._sock = sock
|
| 699 |
+
if "b" not in mode:
|
| 700 |
+
mode += "b"
|
| 701 |
+
self._mode = mode
|
| 702 |
+
self._reading = "r" in mode
|
| 703 |
+
self._writing = "w" in mode
|
| 704 |
+
self._timeout_occurred = False
|
| 705 |
+
|
| 706 |
+
def readinto(self, b):
|
| 707 |
+
"""Read up to len(b) bytes into the writable buffer *b* and return
|
| 708 |
+
the number of bytes read. If the socket is non-blocking and no bytes
|
| 709 |
+
are available, None is returned.
|
| 710 |
+
|
| 711 |
+
If *b* is non-empty, a 0 return value indicates that the connection
|
| 712 |
+
was shutdown at the other end.
|
| 713 |
+
"""
|
| 714 |
+
self._checkClosed()
|
| 715 |
+
self._checkReadable()
|
| 716 |
+
if self._timeout_occurred:
|
| 717 |
+
raise OSError("cannot read from timed out object")
|
| 718 |
+
while True:
|
| 719 |
+
try:
|
| 720 |
+
return self._sock.recv_into(b)
|
| 721 |
+
except timeout:
|
| 722 |
+
self._timeout_occurred = True
|
| 723 |
+
raise
|
| 724 |
+
except error as e:
|
| 725 |
+
if e.errno in _blocking_errnos:
|
| 726 |
+
return None
|
| 727 |
+
raise
|
| 728 |
+
|
| 729 |
+
def write(self, b):
|
| 730 |
+
"""Write the given bytes or bytearray object *b* to the socket
|
| 731 |
+
and return the number of bytes written. This can be less than
|
| 732 |
+
len(b) if not all data could be written. If the socket is
|
| 733 |
+
non-blocking and no bytes could be written None is returned.
|
| 734 |
+
"""
|
| 735 |
+
self._checkClosed()
|
| 736 |
+
self._checkWritable()
|
| 737 |
+
try:
|
| 738 |
+
return self._sock.send(b)
|
| 739 |
+
except error as e:
|
| 740 |
+
# XXX what about EINTR?
|
| 741 |
+
if e.errno in _blocking_errnos:
|
| 742 |
+
return None
|
| 743 |
+
raise
|
| 744 |
+
|
| 745 |
+
def readable(self):
|
| 746 |
+
"""True if the SocketIO is open for reading.
|
| 747 |
+
"""
|
| 748 |
+
if self.closed:
|
| 749 |
+
raise ValueError("I/O operation on closed socket.")
|
| 750 |
+
return self._reading
|
| 751 |
+
|
| 752 |
+
def writable(self):
|
| 753 |
+
"""True if the SocketIO is open for writing.
|
| 754 |
+
"""
|
| 755 |
+
if self.closed:
|
| 756 |
+
raise ValueError("I/O operation on closed socket.")
|
| 757 |
+
return self._writing
|
| 758 |
+
|
| 759 |
+
def seekable(self):
|
| 760 |
+
"""True if the SocketIO is open for seeking.
|
| 761 |
+
"""
|
| 762 |
+
if self.closed:
|
| 763 |
+
raise ValueError("I/O operation on closed socket.")
|
| 764 |
+
return super().seekable()
|
| 765 |
+
|
| 766 |
+
def fileno(self):
|
| 767 |
+
"""Return the file descriptor of the underlying socket.
|
| 768 |
+
"""
|
| 769 |
+
self._checkClosed()
|
| 770 |
+
return self._sock.fileno()
|
| 771 |
+
|
| 772 |
+
@property
|
| 773 |
+
def name(self):
|
| 774 |
+
if not self.closed:
|
| 775 |
+
return self.fileno()
|
| 776 |
+
else:
|
| 777 |
+
return -1
|
| 778 |
+
|
| 779 |
+
@property
|
| 780 |
+
def mode(self):
|
| 781 |
+
return self._mode
|
| 782 |
+
|
| 783 |
+
def close(self):
|
| 784 |
+
"""Close the SocketIO object. This doesn't close the underlying
|
| 785 |
+
socket, except if all references to it have disappeared.
|
| 786 |
+
"""
|
| 787 |
+
if self.closed:
|
| 788 |
+
return
|
| 789 |
+
io.RawIOBase.close(self)
|
| 790 |
+
self._sock._decref_socketios()
|
| 791 |
+
self._sock = None
|
| 792 |
+
|
| 793 |
+
|
| 794 |
+
def getfqdn(name=''):
|
| 795 |
+
"""Get fully qualified domain name from name.
|
| 796 |
+
|
| 797 |
+
An empty argument is interpreted as meaning the local host.
|
| 798 |
+
|
| 799 |
+
First the hostname returned by gethostbyaddr() is checked, then
|
| 800 |
+
possibly existing aliases. In case no FQDN is available and `name`
|
| 801 |
+
was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::',
|
| 802 |
+
hostname from gethostname() is returned.
|
| 803 |
+
"""
|
| 804 |
+
name = name.strip()
|
| 805 |
+
if not name or name in ('0.0.0.0', '::'):
|
| 806 |
+
name = gethostname()
|
| 807 |
+
try:
|
| 808 |
+
hostname, aliases, ipaddrs = gethostbyaddr(name)
|
| 809 |
+
except error:
|
| 810 |
+
pass
|
| 811 |
+
else:
|
| 812 |
+
aliases.insert(0, hostname)
|
| 813 |
+
for name in aliases:
|
| 814 |
+
if '.' in name:
|
| 815 |
+
break
|
| 816 |
+
else:
|
| 817 |
+
name = hostname
|
| 818 |
+
return name
|
| 819 |
+
|
| 820 |
+
|
| 821 |
+
_GLOBAL_DEFAULT_TIMEOUT = object()
|
| 822 |
+
|
| 823 |
+
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
|
| 824 |
+
source_address=None, *, all_errors=False):
|
| 825 |
+
"""Connect to *address* and return the socket object.
|
| 826 |
+
|
| 827 |
+
Convenience function. Connect to *address* (a 2-tuple ``(host,
|
| 828 |
+
port)``) and return the socket object. Passing the optional
|
| 829 |
+
*timeout* parameter will set the timeout on the socket instance
|
| 830 |
+
before attempting to connect. If no *timeout* is supplied, the
|
| 831 |
+
global default timeout setting returned by :func:`getdefaulttimeout`
|
| 832 |
+
is used. If *source_address* is set it must be a tuple of (host, port)
|
| 833 |
+
for the socket to bind as a source address before making the connection.
|
| 834 |
+
A host of '' or port 0 tells the OS to use the default. When a connection
|
| 835 |
+
cannot be created, raises the last error if *all_errors* is False,
|
| 836 |
+
and an ExceptionGroup of all errors if *all_errors* is True.
|
| 837 |
+
"""
|
| 838 |
+
|
| 839 |
+
host, port = address
|
| 840 |
+
exceptions = []
|
| 841 |
+
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
|
| 842 |
+
af, socktype, proto, canonname, sa = res
|
| 843 |
+
sock = None
|
| 844 |
+
try:
|
| 845 |
+
sock = socket(af, socktype, proto)
|
| 846 |
+
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
|
| 847 |
+
sock.settimeout(timeout)
|
| 848 |
+
if source_address:
|
| 849 |
+
sock.bind(source_address)
|
| 850 |
+
sock.connect(sa)
|
| 851 |
+
# Break explicitly a reference cycle
|
| 852 |
+
exceptions.clear()
|
| 853 |
+
return sock
|
| 854 |
+
|
| 855 |
+
except error as exc:
|
| 856 |
+
if not all_errors:
|
| 857 |
+
exceptions.clear() # raise only the last error
|
| 858 |
+
exceptions.append(exc)
|
| 859 |
+
if sock is not None:
|
| 860 |
+
sock.close()
|
| 861 |
+
|
| 862 |
+
if len(exceptions):
|
| 863 |
+
try:
|
| 864 |
+
if not all_errors:
|
| 865 |
+
raise exceptions[0]
|
| 866 |
+
raise ExceptionGroup("create_connection failed", exceptions)
|
| 867 |
+
finally:
|
| 868 |
+
# Break explicitly a reference cycle
|
| 869 |
+
exceptions.clear()
|
| 870 |
+
else:
|
| 871 |
+
raise error("getaddrinfo returns an empty list")
|
| 872 |
+
|
| 873 |
+
|
| 874 |
+
def has_dualstack_ipv6():
|
| 875 |
+
"""Return True if the platform supports creating a SOCK_STREAM socket
|
| 876 |
+
which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
|
| 877 |
+
"""
|
| 878 |
+
if not has_ipv6 \
|
| 879 |
+
or not hasattr(_socket, 'IPPROTO_IPV6') \
|
| 880 |
+
or not hasattr(_socket, 'IPV6_V6ONLY'):
|
| 881 |
+
return False
|
| 882 |
+
try:
|
| 883 |
+
with socket(AF_INET6, SOCK_STREAM) as sock:
|
| 884 |
+
sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
|
| 885 |
+
return True
|
| 886 |
+
except error:
|
| 887 |
+
return False
|
| 888 |
+
|
| 889 |
+
|
| 890 |
+
def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,
|
| 891 |
+
dualstack_ipv6=False):
|
| 892 |
+
"""Convenience function which creates a SOCK_STREAM type socket
|
| 893 |
+
bound to *address* (a 2-tuple (host, port)) and return the socket
|
| 894 |
+
object.
|
| 895 |
+
|
| 896 |
+
*family* should be either AF_INET or AF_INET6.
|
| 897 |
+
*backlog* is the queue size passed to socket.listen().
|
| 898 |
+
*reuse_port* dictates whether to use the SO_REUSEPORT socket option.
|
| 899 |
+
*dualstack_ipv6*: if true and the platform supports it, it will
|
| 900 |
+
create an AF_INET6 socket able to accept both IPv4 or IPv6
|
| 901 |
+
connections. When false it will explicitly disable this option on
|
| 902 |
+
platforms that enable it by default (e.g. Linux).
|
| 903 |
+
|
| 904 |
+
>>> with create_server(('', 8000)) as server:
|
| 905 |
+
... while True:
|
| 906 |
+
... conn, addr = server.accept()
|
| 907 |
+
... # handle new connection
|
| 908 |
+
"""
|
| 909 |
+
if reuse_port and not hasattr(_socket, "SO_REUSEPORT"):
|
| 910 |
+
raise ValueError("SO_REUSEPORT not supported on this platform")
|
| 911 |
+
if dualstack_ipv6:
|
| 912 |
+
if not has_dualstack_ipv6():
|
| 913 |
+
raise ValueError("dualstack_ipv6 not supported on this platform")
|
| 914 |
+
if family != AF_INET6:
|
| 915 |
+
raise ValueError("dualstack_ipv6 requires AF_INET6 family")
|
| 916 |
+
sock = socket(family, SOCK_STREAM)
|
| 917 |
+
try:
|
| 918 |
+
# Note about Windows. We don't set SO_REUSEADDR because:
|
| 919 |
+
# 1) It's unnecessary: bind() will succeed even in case of a
|
| 920 |
+
# previous closed socket on the same address and still in
|
| 921 |
+
# TIME_WAIT state.
|
| 922 |
+
# 2) If set, another socket is free to bind() on the same
|
| 923 |
+
# address, effectively preventing this one from accepting
|
| 924 |
+
# connections. Also, it may set the process in a state where
|
| 925 |
+
# it'll no longer respond to any signals or graceful kills.
|
| 926 |
+
# See: https://learn.microsoft.com/windows/win32/winsock/using-so-reuseaddr-and-so-exclusiveaddruse
|
| 927 |
+
if os.name not in ('nt', 'cygwin') and \
|
| 928 |
+
hasattr(_socket, 'SO_REUSEADDR'):
|
| 929 |
+
try:
|
| 930 |
+
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
|
| 931 |
+
except error:
|
| 932 |
+
# Fail later on bind(), for platforms which may not
|
| 933 |
+
# support this option.
|
| 934 |
+
pass
|
| 935 |
+
# Since Linux 6.12.9, SO_REUSEPORT is not allowed
|
| 936 |
+
# on other address families than AF_INET/AF_INET6.
|
| 937 |
+
if reuse_port and family in (AF_INET, AF_INET6):
|
| 938 |
+
sock.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
|
| 939 |
+
if has_ipv6 and family == AF_INET6:
|
| 940 |
+
if dualstack_ipv6:
|
| 941 |
+
sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
|
| 942 |
+
elif hasattr(_socket, "IPV6_V6ONLY") and \
|
| 943 |
+
hasattr(_socket, "IPPROTO_IPV6"):
|
| 944 |
+
sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 1)
|
| 945 |
+
try:
|
| 946 |
+
sock.bind(address)
|
| 947 |
+
except error as err:
|
| 948 |
+
msg = '%s (while attempting to bind on address %r)' % \
|
| 949 |
+
(err.strerror, address)
|
| 950 |
+
raise error(err.errno, msg) from None
|
| 951 |
+
if backlog is None:
|
| 952 |
+
sock.listen()
|
| 953 |
+
else:
|
| 954 |
+
sock.listen(backlog)
|
| 955 |
+
return sock
|
| 956 |
+
except error:
|
| 957 |
+
sock.close()
|
| 958 |
+
raise
|
| 959 |
+
|
| 960 |
+
|
| 961 |
+
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
|
| 962 |
+
"""Resolve host and port into list of address info entries.
|
| 963 |
+
|
| 964 |
+
Translate the host/port argument into a sequence of 5-tuples that contain
|
| 965 |
+
all the necessary arguments for creating a socket connected to that service.
|
| 966 |
+
host is a domain name, a string representation of an IPv4/v6 address or
|
| 967 |
+
None. port is a string service name such as 'http', a numeric port number or
|
| 968 |
+
None. By passing None as the value of host and port, you can pass NULL to
|
| 969 |
+
the underlying C API.
|
| 970 |
+
|
| 971 |
+
The family, type and proto arguments can be optionally specified in order to
|
| 972 |
+
narrow the list of addresses returned. Passing zero as a value for each of
|
| 973 |
+
these arguments selects the full range of results.
|
| 974 |
+
"""
|
| 975 |
+
# We override this function since we want to translate the numeric family
|
| 976 |
+
# and socket type values to enum constants.
|
| 977 |
+
addrlist = []
|
| 978 |
+
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
|
| 979 |
+
af, socktype, proto, canonname, sa = res
|
| 980 |
+
addrlist.append((_intenum_converter(af, AddressFamily),
|
| 981 |
+
_intenum_converter(socktype, SocketKind),
|
| 982 |
+
proto, canonname, sa))
|
| 983 |
+
return addrlist
|
player/runtime/python/Lib/socketserver.py
ADDED
|
@@ -0,0 +1,863 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 6 |
+
|
| 7 |
+
- address family:
|
| 8 |
+
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
|
| 9 |
+
- AF_UNIX: Unix domain sockets
|
| 10 |
+
- others, e.g. AF_DECNET are conceivable (see <socket.h>
|
| 11 |
+
- socket type:
|
| 12 |
+
- SOCK_STREAM (reliable stream, e.g. TCP)
|
| 13 |
+
- SOCK_DGRAM (datagrams, e.g. UDP)
|
| 14 |
+
|
| 15 |
+
For request-based servers (including socket-based):
|
| 16 |
+
|
| 17 |
+
- client address verification before further looking at the request
|
| 18 |
+
(This is actually a hook for any processing that needs to look
|
| 19 |
+
at the request before anything else, e.g. logging)
|
| 20 |
+
- how to handle multiple requests:
|
| 21 |
+
- synchronous (one request is handled at a time)
|
| 22 |
+
- forking (each request is handled by a new process)
|
| 23 |
+
- threading (each request is handled by a new thread)
|
| 24 |
+
|
| 25 |
+
The classes in this module favor the server type that is simplest to
|
| 26 |
+
write: a synchronous TCP/IP server. This is bad class design, but
|
| 27 |
+
saves some typing. (There's also the issue that a deep class hierarchy
|
| 28 |
+
slows down method lookups.)
|
| 29 |
+
|
| 30 |
+
There are five classes in an inheritance diagram, four of which represent
|
| 31 |
+
synchronous servers of four types:
|
| 32 |
+
|
| 33 |
+
+------------+
|
| 34 |
+
| BaseServer |
|
| 35 |
+
+------------+
|
| 36 |
+
|
|
| 37 |
+
v
|
| 38 |
+
+-----------+ +------------------+
|
| 39 |
+
| TCPServer |------->| UnixStreamServer |
|
| 40 |
+
+-----------+ +------------------+
|
| 41 |
+
|
|
| 42 |
+
v
|
| 43 |
+
+-----------+ +--------------------+
|
| 44 |
+
| UDPServer |------->| UnixDatagramServer |
|
| 45 |
+
+-----------+ +--------------------+
|
| 46 |
+
|
| 47 |
+
Note that UnixDatagramServer derives from UDPServer, not from
|
| 48 |
+
UnixStreamServer -- the only difference between an IP and a Unix
|
| 49 |
+
stream server is the address family, which is simply repeated in both
|
| 50 |
+
unix server classes.
|
| 51 |
+
|
| 52 |
+
Forking and threading versions of each type of server can be created
|
| 53 |
+
using the ForkingMixIn and ThreadingMixIn mix-in classes. For
|
| 54 |
+
instance, a threading UDP server class is created as follows:
|
| 55 |
+
|
| 56 |
+
class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
|
| 57 |
+
|
| 58 |
+
The Mix-in class must come first, since it overrides a method defined
|
| 59 |
+
in UDPServer! Setting the various member variables also changes
|
| 60 |
+
the behavior of the underlying server mechanism.
|
| 61 |
+
|
| 62 |
+
To implement a service, you must derive a class from
|
| 63 |
+
BaseRequestHandler and redefine its handle() method. You can then run
|
| 64 |
+
various versions of the service by combining one of the server classes
|
| 65 |
+
with your request handler class.
|
| 66 |
+
|
| 67 |
+
The request handler class must be different for datagram or stream
|
| 68 |
+
services. This can be hidden by using the request handler
|
| 69 |
+
subclasses StreamRequestHandler or DatagramRequestHandler.
|
| 70 |
+
|
| 71 |
+
Of course, you still have to use your head!
|
| 72 |
+
|
| 73 |
+
For instance, it makes no sense to use a forking server if the service
|
| 74 |
+
contains state in memory that can be modified by requests (since the
|
| 75 |
+
modifications in the child process would never reach the initial state
|
| 76 |
+
kept in the parent process and passed to each child). In this case,
|
| 77 |
+
you can use a threading server, but you will probably have to use
|
| 78 |
+
locks to avoid two requests that come in nearly simultaneous to apply
|
| 79 |
+
conflicting changes to the server state.
|
| 80 |
+
|
| 81 |
+
On the other hand, if you are building e.g. an HTTP server, where all
|
| 82 |
+
data is stored externally (e.g. in the file system), a synchronous
|
| 83 |
+
class will essentially render the service "deaf" while one request is
|
| 84 |
+
being handled -- which may be for a very long time if a client is slow
|
| 85 |
+
to read all the data it has requested. Here a threading or forking
|
| 86 |
+
server is appropriate.
|
| 87 |
+
|
| 88 |
+
In some cases, it may be appropriate to process part of a request
|
| 89 |
+
synchronously, but to finish processing in a forked child depending on
|
| 90 |
+
the request data. This can be implemented by using a synchronous
|
| 91 |
+
server and doing an explicit fork in the request handler class
|
| 92 |
+
handle() method.
|
| 93 |
+
|
| 94 |
+
Another approach to handling multiple simultaneous requests in an
|
| 95 |
+
environment that supports neither threads nor fork (or where these are
|
| 96 |
+
too expensive or inappropriate for the service) is to maintain an
|
| 97 |
+
explicit table of partially finished requests and to use a selector to
|
| 98 |
+
decide which request to work on next (or whether to handle a new
|
| 99 |
+
incoming request). This is particularly important for stream services
|
| 100 |
+
where each client can potentially be connected for a long time (if
|
| 101 |
+
threads or subprocesses cannot be used).
|
| 102 |
+
|
| 103 |
+
Future work:
|
| 104 |
+
- Standard classes for Sun RPC (which uses either UDP or TCP)
|
| 105 |
+
- Standard mix-in classes to implement various authentication
|
| 106 |
+
and encryption schemes
|
| 107 |
+
|
| 108 |
+
XXX Open problems:
|
| 109 |
+
- What to do with out-of-band data?
|
| 110 |
+
|
| 111 |
+
BaseServer:
|
| 112 |
+
- split generic "request" functionality out into BaseServer class.
|
| 113 |
+
Copyright (C) 2000 Luke Kenneth Casson Leighton <lkcl@samba.org>
|
| 114 |
+
|
| 115 |
+
example: read entries from a SQL database (requires overriding
|
| 116 |
+
get_request() to return a table entry from the database).
|
| 117 |
+
entry is processed by a RequestHandlerClass.
|
| 118 |
+
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
# Author of the BaseServer patch: Luke Kenneth Casson Leighton
|
| 122 |
+
|
| 123 |
+
__version__ = "0.4"
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
import socket
|
| 127 |
+
import selectors
|
| 128 |
+
import os
|
| 129 |
+
import sys
|
| 130 |
+
import threading
|
| 131 |
+
from io import BufferedIOBase
|
| 132 |
+
from time import monotonic as time
|
| 133 |
+
|
| 134 |
+
__all__ = ["BaseServer", "TCPServer", "UDPServer",
|
| 135 |
+
"ThreadingUDPServer", "ThreadingTCPServer",
|
| 136 |
+
"BaseRequestHandler", "StreamRequestHandler",
|
| 137 |
+
"DatagramRequestHandler", "ThreadingMixIn"]
|
| 138 |
+
if hasattr(os, "fork"):
|
| 139 |
+
__all__.extend(["ForkingUDPServer","ForkingTCPServer", "ForkingMixIn"])
|
| 140 |
+
if hasattr(socket, "AF_UNIX"):
|
| 141 |
+
__all__.extend(["UnixStreamServer","UnixDatagramServer",
|
| 142 |
+
"ThreadingUnixStreamServer",
|
| 143 |
+
"ThreadingUnixDatagramServer"])
|
| 144 |
+
if hasattr(os, "fork"):
|
| 145 |
+
__all__.extend(["ForkingUnixStreamServer", "ForkingUnixDatagramServer"])
|
| 146 |
+
|
| 147 |
+
# poll/select have the advantage of not requiring any extra file descriptor,
|
| 148 |
+
# contrarily to epoll/kqueue (also, they require a single syscall).
|
| 149 |
+
if hasattr(selectors, 'PollSelector'):
|
| 150 |
+
_ServerSelector = selectors.PollSelector
|
| 151 |
+
else:
|
| 152 |
+
_ServerSelector = selectors.SelectSelector
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class BaseServer:
|
| 156 |
+
|
| 157 |
+
"""Base class for server classes.
|
| 158 |
+
|
| 159 |
+
Methods for the caller:
|
| 160 |
+
|
| 161 |
+
- __init__(server_address, RequestHandlerClass)
|
| 162 |
+
- serve_forever(poll_interval=0.5)
|
| 163 |
+
- shutdown()
|
| 164 |
+
- handle_request() # if you do not use serve_forever()
|
| 165 |
+
- fileno() -> int # for selector
|
| 166 |
+
|
| 167 |
+
Methods that may be overridden:
|
| 168 |
+
|
| 169 |
+
- server_bind()
|
| 170 |
+
- server_activate()
|
| 171 |
+
- get_request() -> request, client_address
|
| 172 |
+
- handle_timeout()
|
| 173 |
+
- verify_request(request, client_address)
|
| 174 |
+
- server_close()
|
| 175 |
+
- process_request(request, client_address)
|
| 176 |
+
- shutdown_request(request)
|
| 177 |
+
- close_request(request)
|
| 178 |
+
- service_actions()
|
| 179 |
+
- handle_error()
|
| 180 |
+
|
| 181 |
+
Methods for derived classes:
|
| 182 |
+
|
| 183 |
+
- finish_request(request, client_address)
|
| 184 |
+
|
| 185 |
+
Class variables that may be overridden by derived classes or
|
| 186 |
+
instances:
|
| 187 |
+
|
| 188 |
+
- timeout
|
| 189 |
+
- address_family
|
| 190 |
+
- socket_type
|
| 191 |
+
- allow_reuse_address
|
| 192 |
+
- allow_reuse_port
|
| 193 |
+
|
| 194 |
+
Instance variables:
|
| 195 |
+
|
| 196 |
+
- RequestHandlerClass
|
| 197 |
+
- socket
|
| 198 |
+
|
| 199 |
+
"""
|
| 200 |
+
|
| 201 |
+
timeout = None
|
| 202 |
+
|
| 203 |
+
def __init__(self, server_address, RequestHandlerClass):
|
| 204 |
+
"""Constructor. May be extended, do not override."""
|
| 205 |
+
self.server_address = server_address
|
| 206 |
+
self.RequestHandlerClass = RequestHandlerClass
|
| 207 |
+
self.__is_shut_down = threading.Event()
|
| 208 |
+
self.__shutdown_request = False
|
| 209 |
+
|
| 210 |
+
def server_activate(self):
|
| 211 |
+
"""Called by constructor to activate the server.
|
| 212 |
+
|
| 213 |
+
May be overridden.
|
| 214 |
+
|
| 215 |
+
"""
|
| 216 |
+
pass
|
| 217 |
+
|
| 218 |
+
def serve_forever(self, poll_interval=0.5):
|
| 219 |
+
"""Handle one request at a time until shutdown.
|
| 220 |
+
|
| 221 |
+
Polls for shutdown every poll_interval seconds. Ignores
|
| 222 |
+
self.timeout. If you need to do periodic tasks, do them in
|
| 223 |
+
another thread.
|
| 224 |
+
"""
|
| 225 |
+
self.__is_shut_down.clear()
|
| 226 |
+
try:
|
| 227 |
+
# XXX: Consider using another file descriptor or connecting to the
|
| 228 |
+
# socket to wake this up instead of polling. Polling reduces our
|
| 229 |
+
# responsiveness to a shutdown request and wastes cpu at all other
|
| 230 |
+
# times.
|
| 231 |
+
with _ServerSelector() as selector:
|
| 232 |
+
selector.register(self, selectors.EVENT_READ)
|
| 233 |
+
|
| 234 |
+
while not self.__shutdown_request:
|
| 235 |
+
ready = selector.select(poll_interval)
|
| 236 |
+
# bpo-35017: shutdown() called during select(), exit immediately.
|
| 237 |
+
if self.__shutdown_request:
|
| 238 |
+
break
|
| 239 |
+
if ready:
|
| 240 |
+
self._handle_request_noblock()
|
| 241 |
+
|
| 242 |
+
self.service_actions()
|
| 243 |
+
finally:
|
| 244 |
+
self.__shutdown_request = False
|
| 245 |
+
self.__is_shut_down.set()
|
| 246 |
+
|
| 247 |
+
def shutdown(self):
|
| 248 |
+
"""Stops the serve_forever loop.
|
| 249 |
+
|
| 250 |
+
Blocks until the loop has finished. This must be called while
|
| 251 |
+
serve_forever() is running in another thread, or it will
|
| 252 |
+
deadlock.
|
| 253 |
+
"""
|
| 254 |
+
self.__shutdown_request = True
|
| 255 |
+
self.__is_shut_down.wait()
|
| 256 |
+
|
| 257 |
+
def service_actions(self):
|
| 258 |
+
"""Called by the serve_forever() loop.
|
| 259 |
+
|
| 260 |
+
May be overridden by a subclass / Mixin to implement any code that
|
| 261 |
+
needs to be run during the loop.
|
| 262 |
+
"""
|
| 263 |
+
pass
|
| 264 |
+
|
| 265 |
+
# The distinction between handling, getting, processing and finishing a
|
| 266 |
+
# request is fairly arbitrary. Remember:
|
| 267 |
+
#
|
| 268 |
+
# - handle_request() is the top-level call. It calls selector.select(),
|
| 269 |
+
# get_request(), verify_request() and process_request()
|
| 270 |
+
# - get_request() is different for stream or datagram sockets
|
| 271 |
+
# - process_request() is the place that may fork a new process or create a
|
| 272 |
+
# new thread to finish the request
|
| 273 |
+
# - finish_request() instantiates the request handler class; this
|
| 274 |
+
# constructor will handle the request all by itself
|
| 275 |
+
|
| 276 |
+
def handle_request(self):
|
| 277 |
+
"""Handle one request, possibly blocking.
|
| 278 |
+
|
| 279 |
+
Respects self.timeout.
|
| 280 |
+
"""
|
| 281 |
+
# Support people who used socket.settimeout() to escape
|
| 282 |
+
# handle_request before self.timeout was available.
|
| 283 |
+
timeout = self.socket.gettimeout()
|
| 284 |
+
if timeout is None:
|
| 285 |
+
timeout = self.timeout
|
| 286 |
+
elif self.timeout is not None:
|
| 287 |
+
timeout = min(timeout, self.timeout)
|
| 288 |
+
if timeout is not None:
|
| 289 |
+
deadline = time() + timeout
|
| 290 |
+
|
| 291 |
+
# Wait until a request arrives or the timeout expires - the loop is
|
| 292 |
+
# necessary to accommodate early wakeups due to EINTR.
|
| 293 |
+
with _ServerSelector() as selector:
|
| 294 |
+
selector.register(self, selectors.EVENT_READ)
|
| 295 |
+
|
| 296 |
+
while True:
|
| 297 |
+
if selector.select(timeout):
|
| 298 |
+
return self._handle_request_noblock()
|
| 299 |
+
else:
|
| 300 |
+
if timeout is not None:
|
| 301 |
+
timeout = deadline - time()
|
| 302 |
+
if timeout < 0:
|
| 303 |
+
return self.handle_timeout()
|
| 304 |
+
|
| 305 |
+
def _handle_request_noblock(self):
|
| 306 |
+
"""Handle one request, without blocking.
|
| 307 |
+
|
| 308 |
+
I assume that selector.select() has returned that the socket is
|
| 309 |
+
readable before this function was called, so there should be no risk of
|
| 310 |
+
blocking in get_request().
|
| 311 |
+
"""
|
| 312 |
+
try:
|
| 313 |
+
request, client_address = self.get_request()
|
| 314 |
+
except OSError:
|
| 315 |
+
return
|
| 316 |
+
if self.verify_request(request, client_address):
|
| 317 |
+
try:
|
| 318 |
+
self.process_request(request, client_address)
|
| 319 |
+
except Exception:
|
| 320 |
+
self.handle_error(request, client_address)
|
| 321 |
+
self.shutdown_request(request)
|
| 322 |
+
except:
|
| 323 |
+
self.shutdown_request(request)
|
| 324 |
+
raise
|
| 325 |
+
else:
|
| 326 |
+
self.shutdown_request(request)
|
| 327 |
+
|
| 328 |
+
def handle_timeout(self):
|
| 329 |
+
"""Called if no new request arrives within self.timeout.
|
| 330 |
+
|
| 331 |
+
Overridden by ForkingMixIn.
|
| 332 |
+
"""
|
| 333 |
+
pass
|
| 334 |
+
|
| 335 |
+
def verify_request(self, request, client_address):
|
| 336 |
+
"""Verify the request. May be overridden.
|
| 337 |
+
|
| 338 |
+
Return True if we should proceed with this request.
|
| 339 |
+
|
| 340 |
+
"""
|
| 341 |
+
return True
|
| 342 |
+
|
| 343 |
+
def process_request(self, request, client_address):
|
| 344 |
+
"""Call finish_request.
|
| 345 |
+
|
| 346 |
+
Overridden by ForkingMixIn and ThreadingMixIn.
|
| 347 |
+
|
| 348 |
+
"""
|
| 349 |
+
self.finish_request(request, client_address)
|
| 350 |
+
self.shutdown_request(request)
|
| 351 |
+
|
| 352 |
+
def server_close(self):
|
| 353 |
+
"""Called to clean-up the server.
|
| 354 |
+
|
| 355 |
+
May be overridden.
|
| 356 |
+
|
| 357 |
+
"""
|
| 358 |
+
pass
|
| 359 |
+
|
| 360 |
+
def finish_request(self, request, client_address):
|
| 361 |
+
"""Finish one request by instantiating RequestHandlerClass."""
|
| 362 |
+
self.RequestHandlerClass(request, client_address, self)
|
| 363 |
+
|
| 364 |
+
def shutdown_request(self, request):
|
| 365 |
+
"""Called to shutdown and close an individual request."""
|
| 366 |
+
self.close_request(request)
|
| 367 |
+
|
| 368 |
+
def close_request(self, request):
|
| 369 |
+
"""Called to clean up an individual request."""
|
| 370 |
+
pass
|
| 371 |
+
|
| 372 |
+
def handle_error(self, request, client_address):
|
| 373 |
+
"""Handle an error gracefully. May be overridden.
|
| 374 |
+
|
| 375 |
+
The default is to print a traceback and continue.
|
| 376 |
+
|
| 377 |
+
"""
|
| 378 |
+
print('-'*40, file=sys.stderr)
|
| 379 |
+
print('Exception occurred during processing of request from',
|
| 380 |
+
client_address, file=sys.stderr)
|
| 381 |
+
import traceback
|
| 382 |
+
traceback.print_exc()
|
| 383 |
+
print('-'*40, file=sys.stderr)
|
| 384 |
+
|
| 385 |
+
def __enter__(self):
|
| 386 |
+
return self
|
| 387 |
+
|
| 388 |
+
def __exit__(self, *args):
|
| 389 |
+
self.server_close()
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
class TCPServer(BaseServer):
|
| 393 |
+
|
| 394 |
+
"""Base class for various socket-based server classes.
|
| 395 |
+
|
| 396 |
+
Defaults to synchronous IP stream (i.e., TCP).
|
| 397 |
+
|
| 398 |
+
Methods for the caller:
|
| 399 |
+
|
| 400 |
+
- __init__(server_address, RequestHandlerClass, bind_and_activate=True)
|
| 401 |
+
- serve_forever(poll_interval=0.5)
|
| 402 |
+
- shutdown()
|
| 403 |
+
- handle_request() # if you don't use serve_forever()
|
| 404 |
+
- fileno() -> int # for selector
|
| 405 |
+
|
| 406 |
+
Methods that may be overridden:
|
| 407 |
+
|
| 408 |
+
- server_bind()
|
| 409 |
+
- server_activate()
|
| 410 |
+
- get_request() -> request, client_address
|
| 411 |
+
- handle_timeout()
|
| 412 |
+
- verify_request(request, client_address)
|
| 413 |
+
- process_request(request, client_address)
|
| 414 |
+
- shutdown_request(request)
|
| 415 |
+
- close_request(request)
|
| 416 |
+
- handle_error()
|
| 417 |
+
|
| 418 |
+
Methods for derived classes:
|
| 419 |
+
|
| 420 |
+
- finish_request(request, client_address)
|
| 421 |
+
|
| 422 |
+
Class variables that may be overridden by derived classes or
|
| 423 |
+
instances:
|
| 424 |
+
|
| 425 |
+
- timeout
|
| 426 |
+
- address_family
|
| 427 |
+
- socket_type
|
| 428 |
+
- request_queue_size (only for stream sockets)
|
| 429 |
+
- allow_reuse_address
|
| 430 |
+
- allow_reuse_port
|
| 431 |
+
|
| 432 |
+
Instance variables:
|
| 433 |
+
|
| 434 |
+
- server_address
|
| 435 |
+
- RequestHandlerClass
|
| 436 |
+
- socket
|
| 437 |
+
|
| 438 |
+
"""
|
| 439 |
+
|
| 440 |
+
address_family = socket.AF_INET
|
| 441 |
+
|
| 442 |
+
socket_type = socket.SOCK_STREAM
|
| 443 |
+
|
| 444 |
+
request_queue_size = 5
|
| 445 |
+
|
| 446 |
+
allow_reuse_address = False
|
| 447 |
+
|
| 448 |
+
allow_reuse_port = False
|
| 449 |
+
|
| 450 |
+
def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
|
| 451 |
+
"""Constructor. May be extended, do not override."""
|
| 452 |
+
BaseServer.__init__(self, server_address, RequestHandlerClass)
|
| 453 |
+
self.socket = socket.socket(self.address_family,
|
| 454 |
+
self.socket_type)
|
| 455 |
+
if bind_and_activate:
|
| 456 |
+
try:
|
| 457 |
+
self.server_bind()
|
| 458 |
+
self.server_activate()
|
| 459 |
+
except:
|
| 460 |
+
self.server_close()
|
| 461 |
+
raise
|
| 462 |
+
|
| 463 |
+
def server_bind(self):
|
| 464 |
+
"""Called by constructor to bind the socket.
|
| 465 |
+
|
| 466 |
+
May be overridden.
|
| 467 |
+
|
| 468 |
+
"""
|
| 469 |
+
if self.allow_reuse_address and hasattr(socket, "SO_REUSEADDR"):
|
| 470 |
+
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
| 471 |
+
# Since Linux 6.12.9, SO_REUSEPORT is not allowed
|
| 472 |
+
# on other address families than AF_INET/AF_INET6.
|
| 473 |
+
if (
|
| 474 |
+
self.allow_reuse_port and hasattr(socket, "SO_REUSEPORT")
|
| 475 |
+
and self.address_family in (socket.AF_INET, socket.AF_INET6)
|
| 476 |
+
):
|
| 477 |
+
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
| 478 |
+
self.socket.bind(self.server_address)
|
| 479 |
+
self.server_address = self.socket.getsockname()
|
| 480 |
+
|
| 481 |
+
def server_activate(self):
|
| 482 |
+
"""Called by constructor to activate the server.
|
| 483 |
+
|
| 484 |
+
May be overridden.
|
| 485 |
+
|
| 486 |
+
"""
|
| 487 |
+
self.socket.listen(self.request_queue_size)
|
| 488 |
+
|
| 489 |
+
def server_close(self):
|
| 490 |
+
"""Called to clean-up the server.
|
| 491 |
+
|
| 492 |
+
May be overridden.
|
| 493 |
+
|
| 494 |
+
"""
|
| 495 |
+
self.socket.close()
|
| 496 |
+
|
| 497 |
+
def fileno(self):
|
| 498 |
+
"""Return socket file number.
|
| 499 |
+
|
| 500 |
+
Interface required by selector.
|
| 501 |
+
|
| 502 |
+
"""
|
| 503 |
+
return self.socket.fileno()
|
| 504 |
+
|
| 505 |
+
def get_request(self):
|
| 506 |
+
"""Get the request and client address from the socket.
|
| 507 |
+
|
| 508 |
+
May be overridden.
|
| 509 |
+
|
| 510 |
+
"""
|
| 511 |
+
return self.socket.accept()
|
| 512 |
+
|
| 513 |
+
def shutdown_request(self, request):
|
| 514 |
+
"""Called to shutdown and close an individual request."""
|
| 515 |
+
try:
|
| 516 |
+
#explicitly shutdown. socket.close() merely releases
|
| 517 |
+
#the socket and waits for GC to perform the actual close.
|
| 518 |
+
request.shutdown(socket.SHUT_WR)
|
| 519 |
+
except OSError:
|
| 520 |
+
pass #some platforms may raise ENOTCONN here
|
| 521 |
+
self.close_request(request)
|
| 522 |
+
|
| 523 |
+
def close_request(self, request):
|
| 524 |
+
"""Called to clean up an individual request."""
|
| 525 |
+
request.close()
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
class UDPServer(TCPServer):
|
| 529 |
+
|
| 530 |
+
"""UDP server class."""
|
| 531 |
+
|
| 532 |
+
allow_reuse_address = False
|
| 533 |
+
|
| 534 |
+
allow_reuse_port = False
|
| 535 |
+
|
| 536 |
+
socket_type = socket.SOCK_DGRAM
|
| 537 |
+
|
| 538 |
+
max_packet_size = 8192
|
| 539 |
+
|
| 540 |
+
def get_request(self):
|
| 541 |
+
data, client_addr = self.socket.recvfrom(self.max_packet_size)
|
| 542 |
+
return (data, self.socket), client_addr
|
| 543 |
+
|
| 544 |
+
def server_activate(self):
|
| 545 |
+
# No need to call listen() for UDP.
|
| 546 |
+
pass
|
| 547 |
+
|
| 548 |
+
def shutdown_request(self, request):
|
| 549 |
+
# No need to shutdown anything.
|
| 550 |
+
self.close_request(request)
|
| 551 |
+
|
| 552 |
+
def close_request(self, request):
|
| 553 |
+
# No need to close anything.
|
| 554 |
+
pass
|
| 555 |
+
|
| 556 |
+
if hasattr(os, "fork"):
|
| 557 |
+
class ForkingMixIn:
|
| 558 |
+
"""Mix-in class to handle each request in a new process."""
|
| 559 |
+
|
| 560 |
+
timeout = 300
|
| 561 |
+
active_children = None
|
| 562 |
+
max_children = 40
|
| 563 |
+
# If true, server_close() waits until all child processes complete.
|
| 564 |
+
block_on_close = True
|
| 565 |
+
|
| 566 |
+
def collect_children(self, *, blocking=False):
|
| 567 |
+
"""Internal routine to wait for children that have exited."""
|
| 568 |
+
if self.active_children is None:
|
| 569 |
+
return
|
| 570 |
+
|
| 571 |
+
# If we're above the max number of children, wait and reap them until
|
| 572 |
+
# we go back below threshold. Note that we use waitpid(-1) below to be
|
| 573 |
+
# able to collect children in size(<defunct children>) syscalls instead
|
| 574 |
+
# of size(<children>): the downside is that this might reap children
|
| 575 |
+
# which we didn't spawn, which is why we only resort to this when we're
|
| 576 |
+
# above max_children.
|
| 577 |
+
while len(self.active_children) >= self.max_children:
|
| 578 |
+
try:
|
| 579 |
+
pid, _ = os.waitpid(-1, 0)
|
| 580 |
+
self.active_children.discard(pid)
|
| 581 |
+
except ChildProcessError:
|
| 582 |
+
# we don't have any children, we're done
|
| 583 |
+
self.active_children.clear()
|
| 584 |
+
except OSError:
|
| 585 |
+
break
|
| 586 |
+
|
| 587 |
+
# Now reap all defunct children.
|
| 588 |
+
for pid in self.active_children.copy():
|
| 589 |
+
try:
|
| 590 |
+
flags = 0 if blocking else os.WNOHANG
|
| 591 |
+
pid, _ = os.waitpid(pid, flags)
|
| 592 |
+
# if the child hasn't exited yet, pid will be 0 and ignored by
|
| 593 |
+
# discard() below
|
| 594 |
+
self.active_children.discard(pid)
|
| 595 |
+
except ChildProcessError:
|
| 596 |
+
# someone else reaped it
|
| 597 |
+
self.active_children.discard(pid)
|
| 598 |
+
except OSError:
|
| 599 |
+
pass
|
| 600 |
+
|
| 601 |
+
def handle_timeout(self):
|
| 602 |
+
"""Wait for zombies after self.timeout seconds of inactivity.
|
| 603 |
+
|
| 604 |
+
May be extended, do not override.
|
| 605 |
+
"""
|
| 606 |
+
self.collect_children()
|
| 607 |
+
|
| 608 |
+
def service_actions(self):
|
| 609 |
+
"""Collect the zombie child processes regularly in the ForkingMixIn.
|
| 610 |
+
|
| 611 |
+
service_actions is called in the BaseServer's serve_forever loop.
|
| 612 |
+
"""
|
| 613 |
+
self.collect_children()
|
| 614 |
+
|
| 615 |
+
def process_request(self, request, client_address):
|
| 616 |
+
"""Fork a new subprocess to process the request."""
|
| 617 |
+
pid = os.fork()
|
| 618 |
+
if pid:
|
| 619 |
+
# Parent process
|
| 620 |
+
if self.active_children is None:
|
| 621 |
+
self.active_children = set()
|
| 622 |
+
self.active_children.add(pid)
|
| 623 |
+
self.close_request(request)
|
| 624 |
+
return
|
| 625 |
+
else:
|
| 626 |
+
# Child process.
|
| 627 |
+
# This must never return, hence os._exit()!
|
| 628 |
+
status = 1
|
| 629 |
+
try:
|
| 630 |
+
self.finish_request(request, client_address)
|
| 631 |
+
status = 0
|
| 632 |
+
except Exception:
|
| 633 |
+
self.handle_error(request, client_address)
|
| 634 |
+
finally:
|
| 635 |
+
try:
|
| 636 |
+
self.shutdown_request(request)
|
| 637 |
+
finally:
|
| 638 |
+
os._exit(status)
|
| 639 |
+
|
| 640 |
+
def server_close(self):
|
| 641 |
+
super().server_close()
|
| 642 |
+
self.collect_children(blocking=self.block_on_close)
|
| 643 |
+
|
| 644 |
+
|
| 645 |
+
class _Threads(list):
|
| 646 |
+
"""
|
| 647 |
+
Joinable list of all non-daemon threads.
|
| 648 |
+
"""
|
| 649 |
+
def append(self, thread):
|
| 650 |
+
self.reap()
|
| 651 |
+
if thread.daemon:
|
| 652 |
+
return
|
| 653 |
+
super().append(thread)
|
| 654 |
+
|
| 655 |
+
def pop_all(self):
|
| 656 |
+
self[:], result = [], self[:]
|
| 657 |
+
return result
|
| 658 |
+
|
| 659 |
+
def join(self):
|
| 660 |
+
for thread in self.pop_all():
|
| 661 |
+
thread.join()
|
| 662 |
+
|
| 663 |
+
def reap(self):
|
| 664 |
+
self[:] = (thread for thread in self if thread.is_alive())
|
| 665 |
+
|
| 666 |
+
|
| 667 |
+
class _NoThreads:
|
| 668 |
+
"""
|
| 669 |
+
Degenerate version of _Threads.
|
| 670 |
+
"""
|
| 671 |
+
def append(self, thread):
|
| 672 |
+
pass
|
| 673 |
+
|
| 674 |
+
def join(self):
|
| 675 |
+
pass
|
| 676 |
+
|
| 677 |
+
|
| 678 |
+
class ThreadingMixIn:
|
| 679 |
+
"""Mix-in class to handle each request in a new thread."""
|
| 680 |
+
|
| 681 |
+
# Decides how threads will act upon termination of the
|
| 682 |
+
# main process
|
| 683 |
+
daemon_threads = False
|
| 684 |
+
# If true, server_close() waits until all non-daemonic threads terminate.
|
| 685 |
+
block_on_close = True
|
| 686 |
+
# Threads object
|
| 687 |
+
# used by server_close() to wait for all threads completion.
|
| 688 |
+
_threads = _NoThreads()
|
| 689 |
+
|
| 690 |
+
def process_request_thread(self, request, client_address):
|
| 691 |
+
"""Same as in BaseServer but as a thread.
|
| 692 |
+
|
| 693 |
+
In addition, exception handling is done here.
|
| 694 |
+
|
| 695 |
+
"""
|
| 696 |
+
try:
|
| 697 |
+
self.finish_request(request, client_address)
|
| 698 |
+
except Exception:
|
| 699 |
+
self.handle_error(request, client_address)
|
| 700 |
+
finally:
|
| 701 |
+
self.shutdown_request(request)
|
| 702 |
+
|
| 703 |
+
def process_request(self, request, client_address):
|
| 704 |
+
"""Start a new thread to process the request."""
|
| 705 |
+
if self.block_on_close:
|
| 706 |
+
vars(self).setdefault('_threads', _Threads())
|
| 707 |
+
t = threading.Thread(target = self.process_request_thread,
|
| 708 |
+
args = (request, client_address))
|
| 709 |
+
t.daemon = self.daemon_threads
|
| 710 |
+
self._threads.append(t)
|
| 711 |
+
t.start()
|
| 712 |
+
|
| 713 |
+
def server_close(self):
|
| 714 |
+
super().server_close()
|
| 715 |
+
self._threads.join()
|
| 716 |
+
|
| 717 |
+
|
| 718 |
+
if hasattr(os, "fork"):
|
| 719 |
+
class ForkingUDPServer(ForkingMixIn, UDPServer): pass
|
| 720 |
+
class ForkingTCPServer(ForkingMixIn, TCPServer): pass
|
| 721 |
+
|
| 722 |
+
class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
|
| 723 |
+
class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
|
| 724 |
+
|
| 725 |
+
if hasattr(socket, 'AF_UNIX'):
|
| 726 |
+
|
| 727 |
+
class UnixStreamServer(TCPServer):
|
| 728 |
+
address_family = socket.AF_UNIX
|
| 729 |
+
|
| 730 |
+
class UnixDatagramServer(UDPServer):
|
| 731 |
+
address_family = socket.AF_UNIX
|
| 732 |
+
|
| 733 |
+
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
|
| 734 |
+
|
| 735 |
+
class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
|
| 736 |
+
|
| 737 |
+
if hasattr(os, "fork"):
|
| 738 |
+
class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass
|
| 739 |
+
|
| 740 |
+
class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass
|
| 741 |
+
|
| 742 |
+
class BaseRequestHandler:
|
| 743 |
+
|
| 744 |
+
"""Base class for request handler classes.
|
| 745 |
+
|
| 746 |
+
This class is instantiated for each request to be handled. The
|
| 747 |
+
constructor sets the instance variables request, client_address
|
| 748 |
+
and server, and then calls the handle() method. To implement a
|
| 749 |
+
specific service, all you need to do is to derive a class which
|
| 750 |
+
defines a handle() method.
|
| 751 |
+
|
| 752 |
+
The handle() method can find the request as self.request, the
|
| 753 |
+
client address as self.client_address, and the server (in case it
|
| 754 |
+
needs access to per-server information) as self.server. Since a
|
| 755 |
+
separate instance is created for each request, the handle() method
|
| 756 |
+
can define other arbitrary instance variables.
|
| 757 |
+
|
| 758 |
+
"""
|
| 759 |
+
|
| 760 |
+
def __init__(self, request, client_address, server):
|
| 761 |
+
self.request = request
|
| 762 |
+
self.client_address = client_address
|
| 763 |
+
self.server = server
|
| 764 |
+
self.setup()
|
| 765 |
+
try:
|
| 766 |
+
self.handle()
|
| 767 |
+
finally:
|
| 768 |
+
self.finish()
|
| 769 |
+
|
| 770 |
+
def setup(self):
|
| 771 |
+
pass
|
| 772 |
+
|
| 773 |
+
def handle(self):
|
| 774 |
+
pass
|
| 775 |
+
|
| 776 |
+
def finish(self):
|
| 777 |
+
pass
|
| 778 |
+
|
| 779 |
+
|
| 780 |
+
# The following two classes make it possible to use the same service
|
| 781 |
+
# class for stream or datagram servers.
|
| 782 |
+
# Each class sets up these instance variables:
|
| 783 |
+
# - rfile: a file object from which receives the request is read
|
| 784 |
+
# - wfile: a file object to which the reply is written
|
| 785 |
+
# When the handle() method returns, wfile is flushed properly
|
| 786 |
+
|
| 787 |
+
|
| 788 |
+
class StreamRequestHandler(BaseRequestHandler):
|
| 789 |
+
|
| 790 |
+
"""Define self.rfile and self.wfile for stream sockets."""
|
| 791 |
+
|
| 792 |
+
# Default buffer sizes for rfile, wfile.
|
| 793 |
+
# We default rfile to buffered because otherwise it could be
|
| 794 |
+
# really slow for large data (a getc() call per byte); we make
|
| 795 |
+
# wfile unbuffered because (a) often after a write() we want to
|
| 796 |
+
# read and we need to flush the line; (b) big writes to unbuffered
|
| 797 |
+
# files are typically optimized by stdio even when big reads
|
| 798 |
+
# aren't.
|
| 799 |
+
rbufsize = -1
|
| 800 |
+
wbufsize = 0
|
| 801 |
+
|
| 802 |
+
# A timeout to apply to the request socket, if not None.
|
| 803 |
+
timeout = None
|
| 804 |
+
|
| 805 |
+
# Disable nagle algorithm for this socket, if True.
|
| 806 |
+
# Use only when wbufsize != 0, to avoid small packets.
|
| 807 |
+
disable_nagle_algorithm = False
|
| 808 |
+
|
| 809 |
+
def setup(self):
|
| 810 |
+
self.connection = self.request
|
| 811 |
+
if self.timeout is not None:
|
| 812 |
+
self.connection.settimeout(self.timeout)
|
| 813 |
+
if self.disable_nagle_algorithm:
|
| 814 |
+
self.connection.setsockopt(socket.IPPROTO_TCP,
|
| 815 |
+
socket.TCP_NODELAY, True)
|
| 816 |
+
self.rfile = self.connection.makefile('rb', self.rbufsize)
|
| 817 |
+
if self.wbufsize == 0:
|
| 818 |
+
self.wfile = _SocketWriter(self.connection)
|
| 819 |
+
else:
|
| 820 |
+
self.wfile = self.connection.makefile('wb', self.wbufsize)
|
| 821 |
+
|
| 822 |
+
def finish(self):
|
| 823 |
+
if not self.wfile.closed:
|
| 824 |
+
try:
|
| 825 |
+
self.wfile.flush()
|
| 826 |
+
except socket.error:
|
| 827 |
+
# A final socket error may have occurred here, such as
|
| 828 |
+
# the local error ECONNABORTED.
|
| 829 |
+
pass
|
| 830 |
+
self.wfile.close()
|
| 831 |
+
self.rfile.close()
|
| 832 |
+
|
| 833 |
+
class _SocketWriter(BufferedIOBase):
|
| 834 |
+
"""Simple writable BufferedIOBase implementation for a socket
|
| 835 |
+
|
| 836 |
+
Does not hold data in a buffer, avoiding any need to call flush()."""
|
| 837 |
+
|
| 838 |
+
def __init__(self, sock):
|
| 839 |
+
self._sock = sock
|
| 840 |
+
|
| 841 |
+
def writable(self):
|
| 842 |
+
return True
|
| 843 |
+
|
| 844 |
+
def write(self, b):
|
| 845 |
+
self._sock.sendall(b)
|
| 846 |
+
with memoryview(b) as view:
|
| 847 |
+
return view.nbytes
|
| 848 |
+
|
| 849 |
+
def fileno(self):
|
| 850 |
+
return self._sock.fileno()
|
| 851 |
+
|
| 852 |
+
class DatagramRequestHandler(BaseRequestHandler):
|
| 853 |
+
|
| 854 |
+
"""Define self.rfile and self.wfile for datagram sockets."""
|
| 855 |
+
|
| 856 |
+
def setup(self):
|
| 857 |
+
from io import BytesIO
|
| 858 |
+
self.packet, self.socket = self.request
|
| 859 |
+
self.rfile = BytesIO(self.packet)
|
| 860 |
+
self.wfile = BytesIO()
|
| 861 |
+
|
| 862 |
+
def finish(self):
|
| 863 |
+
self.socket.sendto(self.wfile.getvalue(), self.client_address)
|
player/runtime/python/Lib/sqlite3/__init__.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# pysqlite2/__init__.py: the pysqlite2 package.
|
| 2 |
+
#
|
| 3 |
+
# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
|
| 4 |
+
#
|
| 5 |
+
# This file is part of pysqlite.
|
| 6 |
+
#
|
| 7 |
+
# This software is provided 'as-is', without any express or implied
|
| 8 |
+
# warranty. In no event will the authors be held liable for any damages
|
| 9 |
+
# arising from the use of this software.
|
| 10 |
+
#
|
| 11 |
+
# Permission is granted to anyone to use this software for any purpose,
|
| 12 |
+
# including commercial applications, and to alter it and redistribute it
|
| 13 |
+
# freely, subject to the following restrictions:
|
| 14 |
+
#
|
| 15 |
+
# 1. The origin of this software must not be misrepresented; you must not
|
| 16 |
+
# claim that you wrote the original software. If you use this software
|
| 17 |
+
# in a product, an acknowledgment in the product documentation would be
|
| 18 |
+
# appreciated but is not required.
|
| 19 |
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
| 20 |
+
# misrepresented as being the original software.
|
| 21 |
+
# 3. This notice may not be removed or altered from any source distribution.
|
| 22 |
+
|
| 23 |
+
"""
|
| 24 |
+
The sqlite3 extension module provides a DB-API 2.0 (PEP 249) compliant
|
| 25 |
+
interface to the SQLite library, and requires SQLite 3.7.15 or newer.
|
| 26 |
+
|
| 27 |
+
To use the module, start by creating a database Connection object:
|
| 28 |
+
|
| 29 |
+
import sqlite3
|
| 30 |
+
cx = sqlite3.connect("test.db") # test.db will be created or opened
|
| 31 |
+
|
| 32 |
+
The special path name ":memory:" can be provided to connect to a transient
|
| 33 |
+
in-memory database:
|
| 34 |
+
|
| 35 |
+
cx = sqlite3.connect(":memory:") # connect to a database in RAM
|
| 36 |
+
|
| 37 |
+
Once a connection has been established, create a Cursor object and call
|
| 38 |
+
its execute() method to perform SQL queries:
|
| 39 |
+
|
| 40 |
+
cu = cx.cursor()
|
| 41 |
+
|
| 42 |
+
# create a table
|
| 43 |
+
cu.execute("create table lang(name, first_appeared)")
|
| 44 |
+
|
| 45 |
+
# insert values into a table
|
| 46 |
+
cu.execute("insert into lang values (?, ?)", ("C", 1972))
|
| 47 |
+
|
| 48 |
+
# execute a query and iterate over the result
|
| 49 |
+
for row in cu.execute("select * from lang"):
|
| 50 |
+
print(row)
|
| 51 |
+
|
| 52 |
+
cx.close()
|
| 53 |
+
|
| 54 |
+
The sqlite3 module is written by Gerhard Häring <gh@ghaering.de>.
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
from sqlite3.dbapi2 import *
|
| 58 |
+
from sqlite3.dbapi2 import (_deprecated_names,
|
| 59 |
+
_deprecated_version_info,
|
| 60 |
+
_deprecated_version)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def __getattr__(name):
|
| 64 |
+
if name in _deprecated_names:
|
| 65 |
+
from warnings import warn
|
| 66 |
+
|
| 67 |
+
warn(f"{name} is deprecated and will be removed in Python 3.14",
|
| 68 |
+
DeprecationWarning, stacklevel=2)
|
| 69 |
+
return globals()[f"_deprecated_{name}"]
|
| 70 |
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
player/runtime/python/Lib/sqlite3/__main__.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A simple SQLite CLI for the sqlite3 module.
|
| 2 |
+
|
| 3 |
+
Apart from using 'argparse' for the command-line interface,
|
| 4 |
+
this module implements the REPL as a thin wrapper around
|
| 5 |
+
the InteractiveConsole class from the 'code' stdlib module.
|
| 6 |
+
"""
|
| 7 |
+
import sqlite3
|
| 8 |
+
import sys
|
| 9 |
+
|
| 10 |
+
from argparse import ArgumentParser
|
| 11 |
+
from code import InteractiveConsole
|
| 12 |
+
from textwrap import dedent
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def execute(c, sql, suppress_errors=True):
|
| 16 |
+
"""Helper that wraps execution of SQL code.
|
| 17 |
+
|
| 18 |
+
This is used both by the REPL and by direct execution from the CLI.
|
| 19 |
+
|
| 20 |
+
'c' may be a cursor or a connection.
|
| 21 |
+
'sql' is the SQL string to execute.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
for row in c.execute(sql):
|
| 26 |
+
print(row)
|
| 27 |
+
except sqlite3.Error as e:
|
| 28 |
+
tp = type(e).__name__
|
| 29 |
+
try:
|
| 30 |
+
print(f"{tp} ({e.sqlite_errorname}): {e}", file=sys.stderr)
|
| 31 |
+
except AttributeError:
|
| 32 |
+
print(f"{tp}: {e}", file=sys.stderr)
|
| 33 |
+
if not suppress_errors:
|
| 34 |
+
sys.exit(1)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class SqliteInteractiveConsole(InteractiveConsole):
|
| 38 |
+
"""A simple SQLite REPL."""
|
| 39 |
+
|
| 40 |
+
def __init__(self, connection):
|
| 41 |
+
super().__init__()
|
| 42 |
+
self._con = connection
|
| 43 |
+
self._cur = connection.cursor()
|
| 44 |
+
|
| 45 |
+
def runsource(self, source, filename="<input>", symbol="single"):
|
| 46 |
+
"""Override runsource, the core of the InteractiveConsole REPL.
|
| 47 |
+
|
| 48 |
+
Return True if more input is needed; buffering is done automatically.
|
| 49 |
+
Return False is input is a complete statement ready for execution.
|
| 50 |
+
"""
|
| 51 |
+
match source:
|
| 52 |
+
case ".version":
|
| 53 |
+
print(f"{sqlite3.sqlite_version}")
|
| 54 |
+
case ".help":
|
| 55 |
+
print("Enter SQL code and press enter.")
|
| 56 |
+
case ".quit":
|
| 57 |
+
sys.exit(0)
|
| 58 |
+
case _:
|
| 59 |
+
if not sqlite3.complete_statement(source):
|
| 60 |
+
return True
|
| 61 |
+
execute(self._cur, source)
|
| 62 |
+
return False
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def main(*args):
|
| 66 |
+
parser = ArgumentParser(
|
| 67 |
+
description="Python sqlite3 CLI",
|
| 68 |
+
prog="python -m sqlite3",
|
| 69 |
+
)
|
| 70 |
+
parser.add_argument(
|
| 71 |
+
"filename", type=str, default=":memory:", nargs="?",
|
| 72 |
+
help=(
|
| 73 |
+
"SQLite database to open (defaults to ':memory:'). "
|
| 74 |
+
"A new database is created if the file does not previously exist."
|
| 75 |
+
),
|
| 76 |
+
)
|
| 77 |
+
parser.add_argument(
|
| 78 |
+
"sql", type=str, nargs="?",
|
| 79 |
+
help=(
|
| 80 |
+
"An SQL query to execute. "
|
| 81 |
+
"Any returned rows are printed to stdout."
|
| 82 |
+
),
|
| 83 |
+
)
|
| 84 |
+
parser.add_argument(
|
| 85 |
+
"-v", "--version", action="version",
|
| 86 |
+
version=f"SQLite version {sqlite3.sqlite_version}",
|
| 87 |
+
help="Print underlying SQLite library version",
|
| 88 |
+
)
|
| 89 |
+
args = parser.parse_args(*args)
|
| 90 |
+
|
| 91 |
+
if args.filename == ":memory:":
|
| 92 |
+
db_name = "a transient in-memory database"
|
| 93 |
+
else:
|
| 94 |
+
db_name = repr(args.filename)
|
| 95 |
+
|
| 96 |
+
# Prepare REPL banner and prompts.
|
| 97 |
+
if sys.platform == "win32" and "idlelib.run" not in sys.modules:
|
| 98 |
+
eofkey = "CTRL-Z"
|
| 99 |
+
else:
|
| 100 |
+
eofkey = "CTRL-D"
|
| 101 |
+
banner = dedent(f"""
|
| 102 |
+
sqlite3 shell, running on SQLite version {sqlite3.sqlite_version}
|
| 103 |
+
Connected to {db_name}
|
| 104 |
+
|
| 105 |
+
Each command will be run using execute() on the cursor.
|
| 106 |
+
Type ".help" for more information; type ".quit" or {eofkey} to quit.
|
| 107 |
+
""").strip()
|
| 108 |
+
sys.ps1 = "sqlite> "
|
| 109 |
+
sys.ps2 = " ... "
|
| 110 |
+
|
| 111 |
+
con = sqlite3.connect(args.filename, isolation_level=None)
|
| 112 |
+
try:
|
| 113 |
+
if args.sql:
|
| 114 |
+
# SQL statement provided on the command-line; execute it directly.
|
| 115 |
+
execute(con, args.sql, suppress_errors=False)
|
| 116 |
+
else:
|
| 117 |
+
# No SQL provided; start the REPL.
|
| 118 |
+
console = SqliteInteractiveConsole(con)
|
| 119 |
+
console.interact(banner, exitmsg="")
|
| 120 |
+
finally:
|
| 121 |
+
con.close()
|
| 122 |
+
|
| 123 |
+
sys.exit(0)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main(sys.argv[1:])
|
player/runtime/python/Lib/sqlite3/dbapi2.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# pysqlite2/dbapi2.py: the DB-API 2.0 interface
|
| 2 |
+
#
|
| 3 |
+
# Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
|
| 4 |
+
#
|
| 5 |
+
# This file is part of pysqlite.
|
| 6 |
+
#
|
| 7 |
+
# This software is provided 'as-is', without any express or implied
|
| 8 |
+
# warranty. In no event will the authors be held liable for any damages
|
| 9 |
+
# arising from the use of this software.
|
| 10 |
+
#
|
| 11 |
+
# Permission is granted to anyone to use this software for any purpose,
|
| 12 |
+
# including commercial applications, and to alter it and redistribute it
|
| 13 |
+
# freely, subject to the following restrictions:
|
| 14 |
+
#
|
| 15 |
+
# 1. The origin of this software must not be misrepresented; you must not
|
| 16 |
+
# claim that you wrote the original software. If you use this software
|
| 17 |
+
# in a product, an acknowledgment in the product documentation would be
|
| 18 |
+
# appreciated but is not required.
|
| 19 |
+
# 2. Altered source versions must be plainly marked as such, and must not be
|
| 20 |
+
# misrepresented as being the original software.
|
| 21 |
+
# 3. This notice may not be removed or altered from any source distribution.
|
| 22 |
+
|
| 23 |
+
import datetime
|
| 24 |
+
import time
|
| 25 |
+
import collections.abc
|
| 26 |
+
|
| 27 |
+
from _sqlite3 import *
|
| 28 |
+
from _sqlite3 import _deprecated_version
|
| 29 |
+
|
| 30 |
+
_deprecated_names = frozenset({"version", "version_info"})
|
| 31 |
+
|
| 32 |
+
paramstyle = "qmark"
|
| 33 |
+
|
| 34 |
+
apilevel = "2.0"
|
| 35 |
+
|
| 36 |
+
Date = datetime.date
|
| 37 |
+
|
| 38 |
+
Time = datetime.time
|
| 39 |
+
|
| 40 |
+
Timestamp = datetime.datetime
|
| 41 |
+
|
| 42 |
+
def DateFromTicks(ticks):
|
| 43 |
+
return Date(*time.localtime(ticks)[:3])
|
| 44 |
+
|
| 45 |
+
def TimeFromTicks(ticks):
|
| 46 |
+
return Time(*time.localtime(ticks)[3:6])
|
| 47 |
+
|
| 48 |
+
def TimestampFromTicks(ticks):
|
| 49 |
+
return Timestamp(*time.localtime(ticks)[:6])
|
| 50 |
+
|
| 51 |
+
_deprecated_version_info = tuple(map(int, _deprecated_version.split(".")))
|
| 52 |
+
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
|
| 53 |
+
|
| 54 |
+
Binary = memoryview
|
| 55 |
+
collections.abc.Sequence.register(Row)
|
| 56 |
+
|
| 57 |
+
def register_adapters_and_converters():
|
| 58 |
+
from warnings import warn
|
| 59 |
+
|
| 60 |
+
msg = ("The default {what} is deprecated as of Python 3.12; "
|
| 61 |
+
"see the sqlite3 documentation for suggested replacement recipes")
|
| 62 |
+
|
| 63 |
+
def adapt_date(val):
|
| 64 |
+
warn(msg.format(what="date adapter"), DeprecationWarning, stacklevel=2)
|
| 65 |
+
return val.isoformat()
|
| 66 |
+
|
| 67 |
+
def adapt_datetime(val):
|
| 68 |
+
warn(msg.format(what="datetime adapter"), DeprecationWarning, stacklevel=2)
|
| 69 |
+
return val.isoformat(" ")
|
| 70 |
+
|
| 71 |
+
def convert_date(val):
|
| 72 |
+
warn(msg.format(what="date converter"), DeprecationWarning, stacklevel=2)
|
| 73 |
+
return datetime.date(*map(int, val.split(b"-")))
|
| 74 |
+
|
| 75 |
+
def convert_timestamp(val):
|
| 76 |
+
warn(msg.format(what="timestamp converter"), DeprecationWarning, stacklevel=2)
|
| 77 |
+
datepart, timepart = val.split(b" ")
|
| 78 |
+
year, month, day = map(int, datepart.split(b"-"))
|
| 79 |
+
timepart_full = timepart.split(b".")
|
| 80 |
+
hours, minutes, seconds = map(int, timepart_full[0].split(b":"))
|
| 81 |
+
if len(timepart_full) == 2:
|
| 82 |
+
microseconds = int('{:0<6.6}'.format(timepart_full[1].decode()))
|
| 83 |
+
else:
|
| 84 |
+
microseconds = 0
|
| 85 |
+
|
| 86 |
+
val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
|
| 87 |
+
return val
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
register_adapter(datetime.date, adapt_date)
|
| 91 |
+
register_adapter(datetime.datetime, adapt_datetime)
|
| 92 |
+
register_converter("date", convert_date)
|
| 93 |
+
register_converter("timestamp", convert_timestamp)
|
| 94 |
+
|
| 95 |
+
register_adapters_and_converters()
|
| 96 |
+
|
| 97 |
+
# Clean up namespace
|
| 98 |
+
|
| 99 |
+
del(register_adapters_and_converters)
|
| 100 |
+
|
| 101 |
+
def __getattr__(name):
|
| 102 |
+
if name in _deprecated_names:
|
| 103 |
+
from warnings import warn
|
| 104 |
+
|
| 105 |
+
warn(f"{name} is deprecated and will be removed in Python 3.14",
|
| 106 |
+
DeprecationWarning, stacklevel=2)
|
| 107 |
+
return globals()[f"_deprecated_{name}"]
|
| 108 |
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
player/runtime/python/Lib/sqlite3/dump.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Mimic the sqlite3 console shell's .dump command
|
| 2 |
+
# Author: Paul Kippes <kippesp@gmail.com>
|
| 3 |
+
|
| 4 |
+
# Every identifier in sql is quoted based on a comment in sqlite
|
| 5 |
+
# documentation "SQLite adds new keywords from time to time when it
|
| 6 |
+
# takes on new features. So to prevent your code from being broken by
|
| 7 |
+
# future enhancements, you should normally quote any identifier that
|
| 8 |
+
# is an English language word, even if you do not have to."
|
| 9 |
+
|
| 10 |
+
def _iterdump(connection):
|
| 11 |
+
"""
|
| 12 |
+
Returns an iterator to the dump of the database in an SQL text format.
|
| 13 |
+
|
| 14 |
+
Used to produce an SQL dump of the database. Useful to save an in-memory
|
| 15 |
+
database for later restoration. This function should not be called
|
| 16 |
+
directly but instead called from the Connection method, iterdump().
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
writeable_schema = False
|
| 20 |
+
cu = connection.cursor()
|
| 21 |
+
cu.row_factory = None # Make sure we get predictable results.
|
| 22 |
+
yield('BEGIN TRANSACTION;')
|
| 23 |
+
|
| 24 |
+
# sqlite_master table contains the SQL CREATE statements for the database.
|
| 25 |
+
q = """
|
| 26 |
+
SELECT "name", "type", "sql"
|
| 27 |
+
FROM "sqlite_master"
|
| 28 |
+
WHERE "sql" NOT NULL AND
|
| 29 |
+
"type" == 'table'
|
| 30 |
+
ORDER BY "name"
|
| 31 |
+
"""
|
| 32 |
+
schema_res = cu.execute(q)
|
| 33 |
+
sqlite_sequence = []
|
| 34 |
+
for table_name, type, sql in schema_res.fetchall():
|
| 35 |
+
if table_name == 'sqlite_sequence':
|
| 36 |
+
rows = cu.execute('SELECT * FROM "sqlite_sequence";').fetchall()
|
| 37 |
+
sqlite_sequence = ['DELETE FROM "sqlite_sequence"']
|
| 38 |
+
sqlite_sequence += [
|
| 39 |
+
f'INSERT INTO "sqlite_sequence" VALUES(\'{row[0]}\',{row[1]})'
|
| 40 |
+
for row in rows
|
| 41 |
+
]
|
| 42 |
+
continue
|
| 43 |
+
elif table_name == 'sqlite_stat1':
|
| 44 |
+
yield('ANALYZE "sqlite_master";')
|
| 45 |
+
elif table_name.startswith('sqlite_'):
|
| 46 |
+
continue
|
| 47 |
+
elif sql.startswith('CREATE VIRTUAL TABLE'):
|
| 48 |
+
if not writeable_schema:
|
| 49 |
+
writeable_schema = True
|
| 50 |
+
yield('PRAGMA writable_schema=ON;')
|
| 51 |
+
yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
|
| 52 |
+
"VALUES('table','{0}','{0}',0,'{1}');".format(
|
| 53 |
+
table_name.replace("'", "''"),
|
| 54 |
+
sql.replace("'", "''"),
|
| 55 |
+
))
|
| 56 |
+
else:
|
| 57 |
+
yield('{0};'.format(sql))
|
| 58 |
+
|
| 59 |
+
# Build the insert statement for each row of the current table
|
| 60 |
+
table_name_ident = table_name.replace('"', '""')
|
| 61 |
+
res = cu.execute('PRAGMA table_info("{0}")'.format(table_name_ident))
|
| 62 |
+
column_names = [str(table_info[1]) for table_info in res.fetchall()]
|
| 63 |
+
q = """SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}";""".format(
|
| 64 |
+
table_name_ident,
|
| 65 |
+
",".join("""'||quote("{0}")||'""".format(col.replace('"', '""')) for col in column_names))
|
| 66 |
+
query_res = cu.execute(q)
|
| 67 |
+
for row in query_res:
|
| 68 |
+
yield("{0};".format(row[0]))
|
| 69 |
+
|
| 70 |
+
# Now when the type is 'index', 'trigger', or 'view'
|
| 71 |
+
q = """
|
| 72 |
+
SELECT "name", "type", "sql"
|
| 73 |
+
FROM "sqlite_master"
|
| 74 |
+
WHERE "sql" NOT NULL AND
|
| 75 |
+
"type" IN ('index', 'trigger', 'view')
|
| 76 |
+
"""
|
| 77 |
+
schema_res = cu.execute(q)
|
| 78 |
+
for name, type, sql in schema_res.fetchall():
|
| 79 |
+
yield('{0};'.format(sql))
|
| 80 |
+
|
| 81 |
+
if writeable_schema:
|
| 82 |
+
yield('PRAGMA writable_schema=OFF;')
|
| 83 |
+
|
| 84 |
+
# gh-79009: Yield statements concerning the sqlite_sequence table at the
|
| 85 |
+
# end of the transaction.
|
| 86 |
+
for row in sqlite_sequence:
|
| 87 |
+
yield('{0};'.format(row))
|
| 88 |
+
|
| 89 |
+
yield('COMMIT;')
|
player/runtime/python/Lib/sre_compile.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
warnings.warn(f"module {__name__!r} is deprecated",
|
| 3 |
+
DeprecationWarning,
|
| 4 |
+
stacklevel=2)
|
| 5 |
+
|
| 6 |
+
from re import _compiler as _
|
| 7 |
+
globals().update({k: v for k, v in vars(_).items() if k[:2] != '__'})
|
player/runtime/python/Lib/sre_constants.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import warnings
|
| 2 |
+
warnings.warn(f"module {__name__!r} is deprecated",
|
| 3 |
+
DeprecationWarning,
|
| 4 |
+
stacklevel=2)
|
| 5 |
+
|
| 6 |
+
from re import _constants as _
|
| 7 |
+
globals().update({k: v for k, v in vars(_).items() if k[:2] != '__'})
|