Skip to content

Commit

Permalink
fix(interfaces): resolve str | Path union to str
Browse files Browse the repository at this point in the history
```pytb
WARNING  type_engine.py:482 - Field reports_processed_path of type str | pathlib.Path cannot be converted to a literal type. Error: Type of Generic Union type is not supported, type object 'Path' has no attribute 'extension'

WARNING  type_engine.py:482 - Field models_path of type str | pathlib.Path cannot be converted to a literal type. Error: Type of Generic Union type is not supported, type object 'Path' has no attribute 'extension'
 ```

Signed-off-by: Cameron Smith <[email protected]>
  • Loading branch information
cameronraysmith committed Aug 15, 2024
1 parent ff5edf4 commit 93d1422
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/pyrovelocity/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
from dataclasses import make_dataclass
from enum import Enum
from typing import TYPE_CHECKING
from typing import Any
from typing import Dict
from typing import Optional
from typing import Tuple
from typing import Type

from beartype.typing import TYPE_CHECKING, Any, Dict, Tuple, Type
from mashumaro.mixins.json import DataClassJSONMixin

from pyrovelocity.tasks.data import download_dataset
from pyrovelocity.tasks.preprocess import preprocess_dataset
from pyrovelocity.tasks.train import train_dataset
from pyrovelocity.workflows.configuration import create_dataclass_from_callable


__all__ = [
"DownloadDatasetInterface",
"PreprocessDataInterface",
Expand Down Expand Up @@ -66,6 +60,7 @@ class PyroVelocityTrainInterface(DataClassJSONMixin):
preprocess_data_types_defaults: Dict[str, Tuple[Type, Any]] = {
"adata": (str, "data/external/simulated.h5ad"),
"data_processed_path": (str, "data/processed"),
"reports_processed_path": (str, "reports/processed"),
}

preprocess_data_fields = create_dataclass_from_callable(
Expand All @@ -82,6 +77,7 @@ class PyroVelocityTrainInterface(DataClassJSONMixin):

pyrovelocity_train_types_defaults: Dict[str, Tuple[Type, Any]] = {
"adata": (str, "data/processed/simulated_processed.h5ad"),
"models_path": (str, "models"),
# "use_gpu": (str, "auto"),
}

Expand Down

0 comments on commit 93d1422

Please sign in to comment.