Skip to content

Commit f650753

Browse files
committed
remove any
1 parent e99a2be commit f650753

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

autointent/_pipeline/_pipeline.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
from pathlib import Path
66
from typing import TYPE_CHECKING, Any
7+
from typing_extensions import assert_never
78

89
import numpy as np
910
import yaml
@@ -27,7 +28,7 @@ class Pipeline:
2728

2829
def __init__(
2930
self,
30-
nodes: list[NodeOptimizer] | list[InferenceNode] | list[Any],
31+
nodes: list[NodeOptimizer] | list[InferenceNode],
3132
seed: int = 42,
3233
) -> None:
3334
"""
@@ -45,10 +46,9 @@ def __init__(
4546
self.vector_index_config = VectorIndexConfig()
4647
self.data_config = DataConfig()
4748
elif not isinstance(nodes[0], InferenceNode):
48-
msg = "Pipeline should be initialized with list of NodeOptimizers or InferenceNodes"
49-
raise TypeError(msg)
49+
assert_never(nodes)
5050

51-
def set_config(self, config: LoggingConfig | VectorIndexConfig | DataConfig | Any) -> None: # noqa: ANN401
51+
def set_config(self, config: LoggingConfig | VectorIndexConfig | DataConfig) -> None: # noqa: ANN401
5252
"""
5353
Set configuration for the optimizer.
5454
@@ -61,8 +61,7 @@ def set_config(self, config: LoggingConfig | VectorIndexConfig | DataConfig | An
6161
elif isinstance(config, DataConfig):
6262
self.data_config = config
6363
else:
64-
msg = "unknown config type"
65-
raise TypeError(msg)
64+
assert_never(config)
6665

6766
@classmethod
6867
def from_search_space(cls, search_space: list[dict[str, Any]] | Path | str, seed: int = 42) -> "Pipeline":

0 commit comments

Comments
 (0)