From 101d02d823f8e630aaf197fbdb0659bf10bb0971 Mon Sep 17 00:00:00 2001 From: Stiofain Fordham <17852477+sdfordham@users.noreply.github.com> Date: Sun, 5 May 2024 12:39:45 +0100 Subject: [PATCH] use future for py3.8 --- pysyncon/base.py | 2 +- pysyncon/generator.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pysyncon/base.py b/pysyncon/base.py index 4786020..5b00258 100644 --- a/pysyncon/base.py +++ b/pysyncon/base.py @@ -314,7 +314,7 @@ def att( if Z0 is not None and Z1 is not None: gaps = self._gaps(Z0=Z0.loc[time_period, :], Z1=Z1.loc[time_period]) else: - raise ValueError("dataprep must be set or (Z0, Z1) must be set for plots.") + raise ValueError("dataprep must be set or (Z0, Z1) must be set for att.") att = np.mean(gaps) se = np.std(gaps, ddof=1) / np.sqrt(len(time_period)) diff --git a/pysyncon/generator.py b/pysyncon/generator.py index 5f8b8d3..af9819f 100644 --- a/pysyncon/generator.py +++ b/pysyncon/generator.py @@ -1,4 +1,5 @@ -from typing import Optional, Tuple +from __future__ import annotations +from typing import Optional import numpy as np import pandas as pd @@ -9,12 +10,12 @@ class LinearFactorModel: def __init__( self, - observed_dist: Tuple[int] = (0, 1), - observed_params_dist: Tuple[int] = (0, 10), - unobserved_dist: Tuple[int] = (0, 1), - unobserved_params_dist: Tuple[int] = (0, 10), - effect_dist: Tuple[int] = (0, 20), - shocks_dist: Tuple[int] = (0, 1), + observed_dist: tuple[int] = (0, 1), + observed_params_dist: tuple[int] = (0, 10), + unobserved_dist: tuple[int] = (0, 1), + unobserved_params_dist: tuple[int] = (0, 10), + effect_dist: tuple[int] = (0, 20), + shocks_dist: tuple[int] = (0, 1), seed: Optional[int] = None, rng: Optional[np.random.Generator] = None, ) -> None: @@ -60,7 +61,7 @@ def generate( n_unobservable: int, n_periods_pre: int, n_periods_post: int, - ) -> Tuple[pd.DataFrame, pd.Series, pd.DataFrame, pd.Series]: + ) -> tuple[pd.DataFrame, pd.Series, pd.DataFrame, pd.Series]: """Generate the matrices (:math:`X_0`, :math:`X_1`, :math:`Z_0`, :math:`Z_1`) that can be used as input to a synthetic control method (using the notation of Abadie & Gardeazabal :cite:`basque2003`).