Skip to content

Commit 2d85e50

Browse files
committed
lints
Signed-off-by: Andrea Reale <[email protected]>
1 parent 036db38 commit 2d85e50

File tree

9 files changed

+37
-50
lines changed

9 files changed

+37
-50
lines changed

docs/snippets/compare_snippet_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def main() -> None:
214214
# They should be the same!
215215
try:
216216
if backwards_path.exists():
217-
run_comparison(backwards_path, baseline_path, args.full_dump)
217+
run_comparison(str(backwards_path), baseline_path, args.full_dump)
218218
elif args.write_missing_backward_assets:
219219
print(f"Writing new backwards-compatibility file to {backwards_path}…")
220220
backwards_path.parent.mkdir(parents=True, exist_ok=True)

rerun_py/.non_sdk_mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ files = examples/python, docs/snippets, scripts
44
exclude = (?x)(
55
^examples/python/objectron/.*
66
| ^examples/python/ros_node/.*
7+
| examples/python/rrt_star/rrt_star.py
8+
| docs/snippets/all/archetypes/arrows3d_simple.py
79
| docs/snippets/all/concepts/how_helix_was_logged.py
810
| docs/snippets/all/concepts/static/log_static.py
911
| docs/snippets/all/concepts/static/log_static_10x.py

rerun_py/pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ name = "Rerun.io"
3535
text = "MIT OR Apache-2.0"
3636

3737
[project.optional-dependencies]
38-
tests = ["pytest==8.4.2", "syrupy==5.0.0", "boto3==1.42.5", "pytest_benchmark==5.2.3", "opentelemetry-api==1.39.0", "opentelemetry-sdk==1.39.0", "opentelemetry-exporter-otlp-proto-grpc==1.39.0"]
38+
tests = [
39+
"pytest==8.4.2",
40+
"syrupy==5.0.0",
41+
"boto3==1.42.5",
42+
"pytest_benchmark==5.2.3",
43+
"opentelemetry-api==1.39.0",
44+
"opentelemetry-sdk==1.39.0",
45+
"opentelemetry-exporter-otlp-proto-grpc==1.39.0",
46+
]
3947
notebook = ["rerun-notebook==0.28.0-alpha.1+dev"]
4048
datafusion = ["datafusion==50.1.0"]
4149
all = ["rerun-sdk[notebook]", "rerun-sdk[datafusion]"]
@@ -303,6 +311,8 @@ module = [
303311
"torchaudio.*",
304312
"cv2.*",
305313
"rerun.*",
314+
"opentelemetr.*",
315+
"pytest_benchmark.*",
306316
]
307317
ignore_missing_imports = true
308318

rerun_py/tests/e2e_redap_tests/conftest.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pathlib
1212
import platform
1313
import re
14-
from typing import TYPE_CHECKING
14+
from typing import TYPE_CHECKING, Any
1515

1616
import pyarrow as pa
1717
import pytest
@@ -24,6 +24,7 @@
2424
if TYPE_CHECKING:
2525
from collections.abc import Generator, Iterator
2626

27+
from pytest_benchmark.fixture import BenchmarkFixture
2728
from rerun.catalog import DatasetEntry, TableEntry
2829
from syrupy import SnapshotAssertion
2930

@@ -127,9 +128,10 @@ def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item
127128

128129

129130
@pytest.fixture(scope="session")
130-
def region(request: pytest.FixtureRequest) -> str:
131+
def region(request: pytest.FixtureRequest) -> str | None:
131132
"""Get the region for region-specific resources."""
132-
return request.config.getoption("--region")
133+
region: str | None = request.config.getoption("--region")
134+
return region
133135

134136

135137
@pytest.fixture(scope="session")
@@ -180,7 +182,8 @@ def readonly_table_uri(resource_prefix: str) -> str:
180182
@pytest.fixture(scope="session")
181183
def redap_url(request: pytest.FixtureRequest) -> str | None:
182184
"""Get the redap server URL from command-line options."""
183-
return request.config.getoption("--redap-url")
185+
url: str | None = request.config.getoption("--redap-url")
186+
return url
184187

185188

186189
@pytest.fixture(scope="session")
@@ -404,7 +407,11 @@ def telemetry() -> Iterator[Telemetry]:
404407

405408

406409
@pytest.hookimpl(trylast=True)
407-
def pytest_benchmark_update_json(config, benchmarks, output_json) -> None: # noqa: ARG001
410+
def pytest_benchmark_update_json(
411+
config: pytest.Config, # noqa: ARG001
412+
benchmarks: list[BenchmarkFixture],
413+
output_json: dict[str, Any], # noqa: ARG001
414+
) -> None:
408415
"""Hook to flush telemetry data at the end of the benchmark session."""
409416

410417
telemetry = Telemetry()

rerun_py/tests/e2e_redap_tests/droid/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
@pytest.fixture(scope="package")
2020
def droid_dataset_name(request: pytest.FixtureRequest) -> str:
2121
"""Fixture to provide access to the droid dataset."""
22-
return request.config.getoption("--droid-dataset")
22+
name: str = request.config.getoption("--droid-dataset")
23+
return name
2324

2425

2526
@pytest.fixture(scope="package")
2627
def droid_preregister_dataset(request: pytest.FixtureRequest) -> bool:
27-
return request.config.getoption("--droid-preregister-dataset")
28+
should_register: bool = request.config.getoption("--droid-preregister-dataset")
29+
return should_register
2830

2931

3032
@pytest.fixture(scope="package")
@@ -56,7 +58,8 @@ def aws_dataset_manifest(aws_regional_dataset_manifest_path: str) -> dict[str, A
5658
s3 = boto3.client("s3")
5759

5860
response = s3.get_object(Bucket=bucket, Key=key)
59-
return json.loads(response["Body"].read().decode("utf-8"))
61+
manifest: dict[str, Any] = json.loads(response["Body"].read().decode("utf-8"))
62+
return manifest
6063

6164

6265
@pytest.fixture(scope="package")

rerun_py/tests/e2e_redap_tests/droid/test_droid.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def lookup_embedding_using_index_values_body(dataset: DatasetEntry) -> None:
193193

194194
# Currently `using_index_values` will actually give us a single result, and so we have the option
195195
# to use that to improve the performance of this query.
196-
# TODO(https://linear.app/rerun/issue/DPF-1818/): Decide if this is actually something we want to depend on
196+
# TODO(DPF#1818): Decide if this is actually something we want to depend on
197197

198198
result = (
199199
dataset.dataframe_query_view(index="real_time", contents="/camera/wrist/embedding")
@@ -228,41 +228,6 @@ def sample_index_values_body(dataset: DatasetEntry) -> None:
228228
assert len(result) > 0
229229

230230

231-
@pytest.mark.benchmark(group="droid")
232-
def test_sample_index_values_chunk_ids(benchmark: BenchmarkFixture, tracing: trace.Span, dataset: DatasetEntry) -> None:
233-
"""Find the Chunk IDs needed for `sample_index_values`."""
234-
tracing.set_attribute("test_dataset", dataset.name)
235-
benchmark.pedantic(
236-
sample_index_values_chunk_ids_body,
237-
args=(dataset,),
238-
rounds=1,
239-
)
240-
241-
242-
def sample_index_values_chunk_ids_body(dataset: DatasetEntry) -> None:
243-
"""Find the Chunk IDs needed for `sample_index_values`."""
244-
wrist = dataset.dataframe_query_view(
245-
index="log_tick",
246-
contents="/camera/wrist/embedding /thumbnail/camera/wrist",
247-
)
248-
249-
sampled_times = [0, 100, 200, 500, 1000, 2000]
250-
results = (wrist.filter_index_values(sampled_times).fill_latest_at()).get_chunk_ids()
251-
for batch in results:
252-
assert batch.num_rows > 0
253-
254-
255-
@pytest.mark.benchmark(group="droid")
256-
def test_align_fixed_frequency(benchmark: BenchmarkFixture, tracing: trace.Span, dataset: DatasetEntry) -> None:
257-
"""Align two columns to a fixed frequency."""
258-
tracing.set_attribute("test_dataset", dataset.name)
259-
benchmark.pedantic(
260-
align_fixed_frequency_body,
261-
args=(dataset,),
262-
rounds=1,
263-
)
264-
265-
266231
def align_fixed_frequency_body(dataset: DatasetEntry) -> None:
267232
"""Align two columns to a fixed frequency."""
268233
# Grab the cheaper column to get range of times until we can pushdown

scripts/ci/compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def compare(
120120
current = current_bytes / div
121121

122122
if previous == current:
123-
change_pct = 0 # e.g. both are zero
123+
change_pct = 0.0 # e.g. both are zero
124124
elif previous == 0:
125-
change_pct = 100
125+
change_pct = 100.0
126126
else:
127127
change_pct = 100 * (current - previous) / previous
128128

scripts/fetch_crashes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def count_uniques(backtrace_item: tuple[str, list[Any]]) -> int:
164164
"\n"
165165
"Backtrace:\n"
166166
"```\n"
167-
f" {backtrace.decode('utf-8')}\n"
167+
f" {backtrace}\n"
168168
"```\n"
169169
"-------------------------------------------------------------------------------\n",
170170
)

scripts/lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ def main() -> None:
15401540
tracked_files = [item[1].path for item in repo.index.iter_blobs()]
15411541
for filepath in tracked_files:
15421542
# TODO do this with pathlib for general sep types
1543-
filepath = "./" + filepath
1543+
filepath = "./" + str(filepath)
15441544
extension = filepath.split(".")[-1]
15451545
if extension in extensions:
15461546
if filepath.startswith(exclude_paths):

0 commit comments

Comments
 (0)