Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hf_converter keyword to SpectrumDataset._to_tensor and AnnotatedSpectrumDataset._to_tensor for pylance compatability. #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions depthcharge/data/spectrum_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from os import PathLike
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any
from typing import Any, Optional

import lance
import polars as pl
Expand Down Expand Up @@ -239,13 +239,16 @@
def _to_tensor(
self,
batch: pa.RecordBatch,
hf_converter: Optional[Any] = None,

Check failure on line 242 in depthcharge/data/spectrum_datasets.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (UP007)

depthcharge/data/spectrum_datasets.py:242:23: UP007 Use `X | Y` for type annotations
) -> dict[str, torch.Tensor | list[str | torch.Tensor]]:
"""Convert a record batch to tensors.

Parameters
----------
batch : pyarrow.RecordBatch
The batch of data.
hf_converter : Optional[Any]
Does nothing; added to maintain compatibility with pylance

Returns
-------
Expand Down Expand Up @@ -351,14 +354,17 @@
def _to_tensor(
self,
batch: pa.RecordBatch,
hf_converter : Optional[Any] = None,

Check failure on line 357 in depthcharge/data/spectrum_datasets.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (UP007)

depthcharge/data/spectrum_datasets.py:357:24: UP007 Use `X | Y` for type annotations
) -> dict[str, torch.Tensor | list[str | torch.Tensor]]:
"""Convert a record batch to tensors.

Parameters
----------
batch : pyarrow.RecordBatch
The batch of data.

hf_converter : Optional[Any]
Does nothing; added to maintain compatibility with pylance

Check failure on line 367 in depthcharge/data/spectrum_datasets.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (W293)

depthcharge/data/spectrum_datasets.py:367:1: W293 Blank line contains whitespace
Returns
-------
dict of str to tensors or lists
Expand Down
Loading