diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c30a56ea..44f080f9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: # "official" pre-commit hooks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace exclude: \.secret\. @@ -42,22 +42,22 @@ repos: # third-pary hooks - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.1.1 hooks: - id: black - id: black-jupyter - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v4.0.0-alpha.8 hooks: - id: prettier exclude: (\.secret\.)|(pnpm-lock.yaml) - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.34.0 + rev: v9.0.0-alpha.2 hooks: - id: eslint files: src - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: 0.28.0 hooks: - id: check-github-actions - id: check-github-workflows @@ -67,6 +67,6 @@ repos: - id: shellcheck - id: shfmt - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.7.1 hooks: - id: nbstripout diff --git a/renumics/spotlight/dataset/__init__.py b/renumics/spotlight/dataset/__init__.py index bdaa1ead..6f14e556 100644 --- a/renumics/spotlight/dataset/__init__.py +++ b/renumics/spotlight/dataset/__init__.py @@ -393,18 +393,15 @@ def __delitem__(self, item: Union[str, IndexType, Indices1dType]) -> None: @overload def __getitem__( self, item: Union[str, Tuple[str, Indices1dType], Tuple[Indices1dType, str]] - ) -> np.ndarray: - ... + ) -> np.ndarray: ... @overload - def __getitem__(self, item: IndexType) -> Dict[str, Optional[OutputType]]: - ... + def __getitem__(self, item: IndexType) -> Dict[str, Optional[OutputType]]: ... @overload def __getitem__( self, item: Union[Tuple[str, IndexType], Tuple[IndexType, str]] - ) -> Optional[OutputType]: - ... + ) -> Optional[OutputType]: ... def __getitem__( self, @@ -463,20 +460,19 @@ def __setitem__( self, item: Union[str, Tuple[str, Indices1dType], Tuple[Indices1dType, str]], value: Union[ColumnInputType, Iterable[ColumnInputType]], - ) -> None: - ... + ) -> None: ... @overload - def __setitem__(self, item: IndexType, value: Dict[str, ColumnInputType]) -> None: - ... + def __setitem__( + self, item: IndexType, value: Dict[str, ColumnInputType] + ) -> None: ... @overload def __setitem__( self, item: Union[Tuple[str, IndexType], Tuple[IndexType, str]], value: ColumnInputType, - ) -> None: - ... + ) -> None: ... def __setitem__( self, @@ -635,16 +631,14 @@ def keys(self) -> List[str]: return list(self._column_names) @overload - def iterrows(self) -> Iterable[Dict[str, Optional[OutputType]]]: - ... + def iterrows(self) -> Iterable[Dict[str, Optional[OutputType]]]: ... @overload def iterrows( self, column_names: Union[str, Iterable[str]] ) -> Union[ Iterable[Dict[str, Optional[OutputType]]], Iterable[Optional[OutputType]] - ]: - ... + ]: ... def iterrows( self, column_names: Optional[Union[str, Iterable[str]]] = None @@ -1902,12 +1896,10 @@ def insert_row(self, index: IndexType, values: Dict[str, ColumnInputType]) -> No self._update_generation_id() @overload - def pop(self, item: str) -> np.ndarray: - ... + def pop(self, item: str) -> np.ndarray: ... @overload - def pop(self, item: IndexType) -> Dict[str, Optional[OutputType]]: - ... + def pop(self, item: IndexType) -> Dict[str, Optional[OutputType]]: ... def pop( self, item: Union[str, IndexType] diff --git a/renumics/spotlight/dtypes/conversion.py b/renumics/spotlight/dtypes/conversion.py index 4e2c5416..45315b28 100644 --- a/renumics/spotlight/dtypes/conversion.py +++ b/renumics/spotlight/dtypes/conversion.py @@ -114,12 +114,12 @@ def __init__(self, value: NormalizedValue, dtype: dtypes.DType) -> None: N = TypeVar("N", bound=NormalizedValue) Converter = Callable[[N, dtypes.DType], ConvertedValue] -_converters_table: Dict[ - Type[NormalizedValue], Dict[str, List[Converter]] -] = defaultdict(lambda: defaultdict(list)) -_simple_converters_table: Dict[ - Type[NormalizedValue], Dict[str, List[Converter]] -] = defaultdict(lambda: defaultdict(list)) +_converters_table: Dict[Type[NormalizedValue], Dict[str, List[Converter]]] = ( + defaultdict(lambda: defaultdict(list)) +) +_simple_converters_table: Dict[Type[NormalizedValue], Dict[str, List[Converter]]] = ( + defaultdict(lambda: defaultdict(list)) +) def register_converter( diff --git a/renumics/spotlight/embeddings/decorator.py b/renumics/spotlight/embeddings/decorator.py index 4243e287..d626fd83 100644 --- a/renumics/spotlight/embeddings/decorator.py +++ b/renumics/spotlight/embeddings/decorator.py @@ -20,8 +20,7 @@ @overload def embed( dtype: Union[Literal["image", "Image"], Image], *, name: Optional[str] = None -) -> Callable[[EmbedImageFunc], EmbedImageFunc]: - ... +) -> Callable[[EmbedImageFunc], EmbedImageFunc]: ... @overload @@ -30,8 +29,7 @@ def embed( *, name: Optional[str] = None, sampling_rate: int, -) -> Callable[[EmbedArrayFunc], EmbedArrayFunc]: - ... +) -> Callable[[EmbedArrayFunc], EmbedArrayFunc]: ... @overload @@ -43,15 +41,13 @@ def embed( ], *, name: Optional[str] = None, -) -> Callable[[EmbedArrayFunc], EmbedArrayFunc]: - ... +) -> Callable[[EmbedArrayFunc], EmbedArrayFunc]: ... @overload def embed( dtype: Any, *, name: Optional[str] = None, sampling_rate: Optional[int] = None -) -> Callable[[EmbedFunc], EmbedFunc]: - ... +) -> Callable[[EmbedFunc], EmbedFunc]: ... def embed( diff --git a/renumics/spotlight/layout/__init__.py b/renumics/spotlight/layout/__init__.py index 1e548161..889450b6 100644 --- a/renumics/spotlight/layout/__init__.py +++ b/renumics/spotlight/layout/__init__.py @@ -288,8 +288,7 @@ def similaritymap( color_by_column: Optional[str] = None, size_by_column: Optional[str] = None, filter: bool = False, -) -> Similaritymap: - ... +) -> Similaritymap: ... @overload @@ -303,8 +302,7 @@ def similaritymap( *, umap_metric: Optional[_UmapMetric] = None, umap_balance: Optional[_UmapBalance] = None, -) -> Similaritymap: - ... +) -> Similaritymap: ... @overload @@ -317,8 +315,7 @@ def similaritymap( filter: bool = False, *, pca_normalization: Optional[_PCANormalization] = None, -) -> Similaritymap: - ... +) -> Similaritymap: ... def similaritymap(