From be1b5fbb800f1e86c7593bac737c88d95959e0d7 Mon Sep 17 00:00:00 2001 From: Marcel R Date: Sat, 30 Sep 2023 11:05:53 +0200 Subject: [PATCH] Cleanup. --- modeltest.py | 10 ---------- order/__init__.py | 6 ++++-- order/models/campaign.py | 21 +++++++-------------- order/models/dataset.py | 2 +- 4 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 modeltest.py diff --git a/modeltest.py b/modeltest.py deleted file mode 100644 index 7a933c3..0000000 --- a/modeltest.py +++ /dev/null @@ -1,10 +0,0 @@ -# coding: utf-8 -import json, yaml - - -with open("../order-data/campaigns/run2_2018_pp_nano.yaml", "r") as f: - cpn = yaml.full_load(f) - -from order.models.campaign import Campaign - -c = Campaign(**cpn) diff --git a/order/__init__.py b/order/__init__.py index 2ae98b0..e320c2b 100644 --- a/order/__init__.py +++ b/order/__init__.py @@ -12,6 +12,8 @@ "AdapterModel", "Adapter", "Materialized", "DataProvider", "UniqueObject", "LazyUniqueObject", "UniqueObjectIndex", "DuplicateObjectException", "DuplicateNameException", "DuplicateIdException", + "GenOrder", "DatasetInfo", "Dataset", "LazyDataset", "DatasetIndex", + "Campaign", ] @@ -24,14 +26,14 @@ # provisioning imports from order.settings import Settings from order.types import Lazy +from order.adapters.base import AdapterModel, Adapter, Materialized, DataProvider from order.models.base import Model from order.models.unique import ( UniqueObject, LazyUniqueObject, UniqueObjectIndex, DuplicateObjectException, DuplicateNameException, DuplicateIdException, ) +from order.models.dataset import GenOrder, DatasetInfo, Dataset, LazyDataset, DatasetIndex from order.models.campaign import Campaign -from order.models.dataset import Dataset -from order.adapters.base import AdapterModel, Adapter, Materialized, DataProvider # import adapters to trigger their registration import order.adapters.order diff --git a/order/models/campaign.py b/order/models/campaign.py index 1dabafb..37e5587 100644 --- a/order/models/campaign.py +++ b/order/models/campaign.py @@ -7,24 +7,17 @@ from __future__ import annotations -__all__ = ["GT", "Campaign"] +__all__ = ["Campaign"] -from order.types import Lazy, Field -from order.models.base import Model +from order.types import Lazy, NonEmptyStrictStr, StrictFloat, Field +from order.models.unique import UniqueObject from order.models.dataset import DatasetIndex -class GT(Model): +class Campaign(UniqueObject): - gt: str - - -class Campaign(Model): - - id: int - name: str - tier: Lazy[str] - ecm: Lazy[float] - recommended_gt: GT + tier: Lazy[NonEmptyStrictStr] + ecm: Lazy[StrictFloat] + recommended_global_tag: NonEmptyStrictStr datasets: DatasetIndex = Field(default_factory=DatasetIndex) diff --git a/order/models/dataset.py b/order/models/dataset.py index 08fabfe..5a2cad9 100644 --- a/order/models/dataset.py +++ b/order/models/dataset.py @@ -3,7 +3,7 @@ from __future__ import annotations -__all__ = ["Dataset"] +__all__ = ["GenOrder", "DatasetInfo", "Dataset", "LazyDataset", "DatasetIndex"] import enum