Skip to content

Commit a104911

Browse files
committed
linting
1 parent c6799f6 commit a104911

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ dependencies = [
99
"certifi>=2025.4.26",
1010
]
1111

12+
[tool.ruff.lint.per-file-ignores]
13+
"__init__.py" = ["F401"]
14+
1215
[project.scripts]
1316
loupepy = "loupepy:main"
1417

src/loupepy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
from .setup import setup, eula, eula_reset
1+
from .setup import setup as setup
2+
from .setup import eula as eula
3+
from .setup import eula_reset as eula_reset
24
from .convert import create_loupe_from_anndata, create_loupe
35
from .utils import get_obs, get_obsm, get_count_matrix

src/loupepy/convert.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import os
22
from os import PathLike
3-
from .setup import setup
43
from anndata import AnnData # type: ignore
54
import pandas as pd
6-
from scipy.sparse import csr_matrix, csc_matrix
5+
from scipy.sparse import csc_matrix
76
import h5py # type: ignore
8-
from typing import Any, Union, List
7+
from typing import List
98
from array import array
109
import logging
1110
from numpy import ndarray
12-
from .utils import _validate_anndata, _validate_obs, _get_loupe_path, _validate_obsm, get_obs, get_obsm, get_count_matrix
11+
from .utils import _validate_anndata, _get_loupe_path, get_obs, get_obsm, get_count_matrix
1312

1413

1514
def _create_string_dataset(obj: h5py.Group, key: str, strings: List[str]|pd.Series|str|pd.Index) -> None:
@@ -31,9 +30,9 @@ def _create_string_dataset(obj: h5py.Group, key: str, strings: List[str]|pd.Seri
3130
if strings == "":
3231
#for the special case of an empty string
3332
#matches r behavior
34-
d=obj.create_dataset(name=key, dtype=dtype, shape=(0,))
33+
obj.create_dataset(name=key, dtype=dtype, shape=(0,))
3534
else:
36-
d=obj.create_dataset(name=key, data=strings, dtype=dtype)
35+
obj.create_dataset(name=key, data=strings, dtype=dtype)
3736

3837
def _write_matrix(f: h5py.File, matrix: csc_matrix,
3938
features: pd.Series|pd.Index, barcodes: pd.Index|pd.Series,
@@ -202,7 +201,7 @@ def _write_hdf5(mat: csc_matrix,
202201
for n in obsm.keys():
203202
_write_projection(projections, obsm[n], n)
204203
f.close()
205-
except:
204+
except ValueError:
206205
logging.error("Something went wrong while writing the h5 file. Please check the input data.")
207206
os.remove(file_path)
208207

0 commit comments

Comments
 (0)