From b036a77b7ff1669b3bf46a157f86ee3e58884ab3 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Sun, 1 Dec 2019 10:16:07 +0100 Subject: [PATCH] require pydantic --- pts/dataset/common.py | 8 +++++--- setup.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pts/dataset/common.py b/pts/dataset/common.py index 7de2b39..4b17700 100644 --- a/pts/dataset/common.py +++ b/pts/dataset/common.py @@ -1,6 +1,8 @@ from abc import ABC, abstractmethod from typing import Any, Dict, Iterable, NamedTuple, Sized, List, Optional +from pydantic import BaseModel + DataEntry = Dict[str, Any] @@ -43,14 +45,14 @@ class Dataset(Sized, Iterable[DataEntry], ABC): def __len__(self): pass -class CategoricalFeatureInfo(): +class CategoricalFeatureInfo(BaseModel): name: str cardinality: str -class BasicFeatureInfo(): +class BasicFeatureInfo(BaseModel): name: str -class MetaData(): +class MetaData(BaseModel): freq: str = None target: Optional[BasicFeatureInfo] = None diff --git a/setup.py b/setup.py index 192db34..d4632c0 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,7 @@ setup( 'pydantic', 'gin-config', 'absl-py', + 'pydantic', ], test_suite='tests',