Skip to content

Commit 7ae5e16

Browse files
alexbarrosfabclmnt
authored andcommitted
fix: Literal not supported in python 3.7
1 parent 3642b01 commit 7ae5e16

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/ydata_profiling/config.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
"""Configuration for the package."""
22
from enum import Enum
33
from pathlib import Path
4-
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
4+
from typing import Any, Dict, List, Optional, Tuple, Union
55

66
import yaml
77
from pydantic.v1 import BaseModel, BaseSettings, Field, PrivateAttr
88

9+
try:
10+
# typing only available in python 3.8+
11+
from typing import Literal
12+
AutoLagType = Literal["AIC", "BIC", "t-stat"]
13+
except:
14+
AutoLagType = str
915

1016
def _merge_dictionaries(dict1: dict, dict2: dict) -> dict:
1117
"""
@@ -112,7 +118,7 @@ class TimeseriesVars(BaseModel):
112118
lags: List[int] = [1, 7, 12, 24, 30]
113119
significance: float = 0.05
114120
pacf_acf_lag: int = 100
115-
autolag: Optional[Literal["AIC", "BIC", "t-stat"]] = "AIC"
121+
autolag: Optional[AutoLagType] = "AIC"
116122
maxlag: Optional[int] = None
117123

118124

0 commit comments

Comments
 (0)