From 8549c7dc6f7745a874e435f9cc3c02087e5b851b Mon Sep 17 00:00:00 2001 From: Lilferrit Date: Wed, 2 Oct 2024 10:32:41 -0700 Subject: [PATCH 1/3] pylance version fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8638a95..8ec2d89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "torch>=2.0.0", "polars>=0.19.0", "pyarrow>=12.0.1", - "pylance>=0.7.5", + "pylance==0.15.0", "pyteomics>=4.7.2", "numpy>=1.18.1", "numba>=0.48.0", From 3c20cfaf32870f8149441a60e3b8926ea90e3a48 Mon Sep 17 00:00:00 2001 From: Lilferrit Date: Thu, 17 Oct 2024 16:10:23 -0700 Subject: [PATCH 2/3] hf_converter keyword in _to_tensor functions --- depthcharge/data/spectrum_datasets.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/depthcharge/data/spectrum_datasets.py b/depthcharge/data/spectrum_datasets.py index 1944ea9..5722079 100644 --- a/depthcharge/data/spectrum_datasets.py +++ b/depthcharge/data/spectrum_datasets.py @@ -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 @@ -239,6 +239,7 @@ def from_lance( def _to_tensor( self, batch: pa.RecordBatch, + hf_converter: Optional[Any] = None, ) -> dict[str, torch.Tensor | list[str | torch.Tensor]]: """Convert a record batch to tensors. @@ -246,6 +247,8 @@ def _to_tensor( ---------- batch : pyarrow.RecordBatch The batch of data. + hf_converter : Optional[Any] + Does nothing; added to maintain compatibility with pylance Returns ------- @@ -351,6 +354,7 @@ def __init__( def _to_tensor( self, batch: pa.RecordBatch, + hf_converter : Optional[Any] = None, ) -> dict[str, torch.Tensor | list[str | torch.Tensor]]: """Convert a record batch to tensors. @@ -358,7 +362,9 @@ def _to_tensor( ---------- batch : pyarrow.RecordBatch The batch of data. - + hf_converter : Optional[Any] + Does nothing; added to maintain compatibility with pylance + Returns ------- dict of str to tensors or lists From 90b41c35709a8dc0bac8fbf6d3b3b9622007cf3c Mon Sep 17 00:00:00 2001 From: Lilferrit Date: Thu, 17 Oct 2024 16:15:17 -0700 Subject: [PATCH 3/3] revert pylance requirement to >=0.7.5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8ec2d89..8638a95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "torch>=2.0.0", "polars>=0.19.0", "pyarrow>=12.0.1", - "pylance==0.15.0", + "pylance>=0.7.5", "pyteomics>=4.7.2", "numpy>=1.18.1", "numba>=0.48.0",