Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Heumos <lukas.heumos@posteo.net>
  • Loading branch information
Zethson committed Feb 3, 2025
1 parent 21d0220 commit 7787936
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
30 changes: 18 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.2.4"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- id: ruff-format
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand All @@ -32,22 +35,25 @@ repos:
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
# Check that there are no merge conflicts (could be generated by template sync)
- id: check-merge-conflict
args: [--assume-in-merge]

- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit rej files
name: Don't commit .rej files
entry: |
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
Fix the merge conflicts manually and remove the .rej files.
language: fail
files: '.*\.rej$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies:
["types-setuptools", "types-requests", "types-attrs"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies:
- types-setuptools
- types-requests
- types-attrs
28 changes: 12 additions & 16 deletions src/spatialdata_db/lamin_spatialdatadb_curator.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
from lamindb.curators import SpatialDataCurator
from spatialdata import SpatialData
import bionty as bt
import lamindb as ln
from lamindb.base.types import FieldAttr
from lamindb.curators._spatial import SpatialDataCurator
from lamindb.models import Record
from spatialdata import SpatialData

from lnschema_core import Record
from lnschema_core.types import FieldAttr
from lnschema_core import (
Record,
)

class SpatialDataDBCurator(SpatialDataCurator):
"""Custom Curator for SpatialDataDB"""

DEFAULT_CATEGORICALS = {
"assay": bt.ExperimentalFactor.name,
"chemistry_version": ln.ULabel.name,
'organism': bt.Organism.name,
"organism": bt.Organism.name,
"tissue": bt.Tissue.name,
"disease": bt.Disease.name,
"license": ln.ULabel.name,
Expand All @@ -29,11 +27,11 @@ class SpatialDataDBCurator(SpatialDataCurator):
"preproc_version": "unknown",
}

FIXED_SOURCES = {
# TODO: fix ontologies
}
FIXED_SOURCES = { # type: ignore
# TODO: fix ontologies
}

DEFAULT_VAR_INDEX = {'table': bt.Gene.ensembl_gene_id}
DEFAULT_VAR_INDEX = {"table": bt.Gene.ensembl_gene_id}

def __init__(
self,
Expand All @@ -49,9 +47,7 @@ def __init__(
sample_metadata_key: str = "sample",
):
if categoricals is None:
categoricals = dict([(
sample_metadata_key, self.DEFAULT_CATEGORICALS
)])
categoricals = {sample_metadata_key: self.DEFAULT_CATEGORICALS}

super().__init__(
sdata,
Expand All @@ -63,4 +59,4 @@ def __init__(
sources=sources,
exclude=exclude,
sample_metadata_key=sample_metadata_key,
)
)

0 comments on commit 7787936

Please sign in to comment.