From 7c9766e5079e40ec5320581f4545294a93e8cb42 Mon Sep 17 00:00:00 2001 From: "a.p.chikov" Date: Tue, 28 Sep 2021 14:34:55 +0300 Subject: [PATCH] Fix style --- etna/transforms/datetime_flags.py | 8 ++++---- tests/test_transforms/test_dateflags_transform.py | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/etna/transforms/datetime_flags.py b/etna/transforms/datetime_flags.py index f4a960fff..15583ee9f 100644 --- a/etna/transforms/datetime_flags.py +++ b/etna/transforms/datetime_flags.py @@ -24,9 +24,9 @@ def __init__( week_number_in_year: Optional[bool] = False, month_number_in_year: Optional[bool] = False, year_number: Optional[bool] = False, + is_weekend: Optional[bool] = True, special_days_in_week: Sequence[int] = (), special_days_in_month: Sequence[int] = (), - is_weekend: Optional[bool] = True, ): """Create instance of DateFlags. @@ -46,14 +46,14 @@ def __init__( if True, add column "month_number_in_year" with month info to feature dataframe in transform year_number: if True, add column "year_number" with year info to feature dataframe in transform + is_weekend: + if True: add column "regressor_is_weekend" with weekends flags to feature dataframe in transform special_days_in_week: list of weekdays number (from [0, 6]) that should be interpreted as special ones, if given add column "special_days_in_week" with flag that shows given date is a special day special_days_in_month: list of days number (from [1, 31]) that should be interpreted as special ones, if given add column "special_days_in_month" with flag that shows given date is a special day - is_weekend: - if True: add column "regressor_is_weekend" with weekends flags to feature dataframe in transform Notes ----- @@ -79,9 +79,9 @@ def __init__( week_number_in_year, month_number_in_year, year_number, + is_weekend, special_days_in_week, special_days_in_month, - is_weekend, ] ): raise ValueError( diff --git a/tests/test_transforms/test_dateflags_transform.py b/tests/test_transforms/test_dateflags_transform.py index 0f2fdd12c..4c6ef8bba 100644 --- a/tests/test_transforms/test_dateflags_transform.py +++ b/tests/test_transforms/test_dateflags_transform.py @@ -18,10 +18,10 @@ "week_number_in_year": False, "week_number_in_month": False, "month_number_in_year": False, - "special_days_in_week": (), - "special_days_in_month": (), "year_number": False, "is_weekend": False, + "special_days_in_week": (), + "special_days_in_month": (), } @@ -95,9 +95,9 @@ def test_invalid_arguments_configuration(): week_number_in_year=False, month_number_in_year=False, year_number=False, + is_weekend=False, special_days_in_week=(), special_days_in_month=(), - is_weekend=False, ) @@ -111,15 +111,15 @@ def test_repr(): week_number_in_year=False, month_number_in_year=True, year_number=True, + is_weekend=True, special_days_in_week=(1, 2), special_days_in_month=(12,), - is_weekend=True, ) transform_repr = transform.__repr__() true_repr = ( f"{transform_class_repr}(day_number_in_week = True, day_number_in_month = True, week_number_in_month = False, " - f"week_number_in_year = False, month_number_in_year = True, year_number = True, special_days_in_week = (1, 2), " - f"special_days_in_month = (12,), is_weekend = True, )" + f"week_number_in_year = False, month_number_in_year = True, year_number = True, is_weekend = True, special_days_in_week = (1, 2), " + f"special_days_in_month = (12,), )" ) assert transform_repr == true_repr @@ -196,9 +196,9 @@ def test_interface_correct_tuple_args(true_params: List[str], train_df: pd.DataF {"week_number_in_month": True}, {"month_number_in_year": True}, {"year_number": True}, + {"is_weekend": True}, {"special_days_in_week": SPECIAL_DAYS}, {"special_days_in_month": SPECIAL_DAYS}, - {"is_weekend": True}, ), ) def test_feature_values(