From 8cebaef595c29c5cfb9e4e1632288d98257ec527 Mon Sep 17 00:00:00 2001 From: ybnd Date: Sat, 30 Jan 2021 13:27:11 +0100 Subject: [PATCH 1/3] Advance version --- shapeflow/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shapeflow/__init__.py b/shapeflow/__init__.py index 83b41701..46773dc6 100644 --- a/shapeflow/__init__.py +++ b/shapeflow/__init__.py @@ -30,7 +30,7 @@ import diskcache -__version__: str = '0.4.3' +__version__: str = '0.4.4' """Library version """ From 15ca10290a22506641892925896dd68827df85ea Mon Sep 17 00:00:00 2001 From: ybnd Date: Sat, 30 Jan 2021 13:40:07 +0100 Subject: [PATCH 2/3] Add FileConfig to hold path and hash of files --- shapeflow/core/backend.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shapeflow/core/backend.py b/shapeflow/core/backend.py index 2d13cf63..05ab2396 100644 --- a/shapeflow/core/backend.py +++ b/shapeflow/core/backend.py @@ -11,7 +11,7 @@ import numpy as np import pandas as pd -from pydantic import Field +from pydantic import Field, FilePath from shapeflow import settings, get_logger, get_cache from shapeflow.api import api @@ -486,14 +486,20 @@ def __modify_schema__(cls, field_schema): ) +class FileConfig(BaseConfig): + path: Optional[FilePath] = Field(default=None) + hash: Optional[FilePath] = Field(default=None) + + class BaseAnalyzerConfig(BaseConfig): """Abstract analyzer configuration. """ - video_path: Optional[str] = Field(default=None) - design_path: Optional[str] = Field(default=None) name: Optional[str] = Field(default=None) description: Optional[str] = Field(default=None) + video: FileConfig = Field(default_factory=FileConfig) + design: FileConfig = Field(default_factory=FileConfig) + class BaseAnalyzer(Instance, RootInstance): """Abstract analyzer. From 2a984952d29c501b3b72819da83b10301a700ce5 Mon Sep 17 00:00:00 2001 From: ybnd Date: Sat, 30 Jan 2021 13:43:17 +0100 Subject: [PATCH 3/3] Handle configuration change in normalize_config() --- shapeflow/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shapeflow/config.py b/shapeflow/config.py index 60df5283..e6730e6f 100644 --- a/shapeflow/config.py +++ b/shapeflow/config.py @@ -479,6 +479,13 @@ def normalizing_to(version): # rename parameters -> feature_parameters if 'parameters' in d: d['feature_parameters'] = d.pop('parameters') + if before_version(d[VERSION], '0.4.4'): + normalizing_to('0.4.4') + # move video_path & design_path to video.path & design.path + if 'video_path' in d: + d['video'] = {'path': d.pop('video_path')} + if 'design_path' in d: + d['design'] = {'path': d.pop('design_path')} else: raise NotImplementedError