Skip to content

Commit

Permalink
Merge pull request #408 from bashtage/update-black
Browse files Browse the repository at this point in the history
MAINT: Update to black 20.8b1
  • Loading branch information
bashtage committed Aug 27, 2020
2 parents c5d4751 + 815531c commit ab7536a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
12 changes: 6 additions & 6 deletions arch/tests/unitroot/test_dynamic_ols.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def test_basic(trivariate_data):


LEADS_LAGS = (
([0, 0], ((-11.16047, 0.131134), (2.218772, 0.021983), (85.28087, 1.712124),)),
([0, 1], ((-11.47526, 0.118405), (2.271718, 0.019851), (89.31582, 1.545362),)),
([1, 0], ((-11.48150, 0.112980), (2.272349, 0.018941), (89.43907, 1.474557),)),
([7, 3], ((-11.98434, 0.068532), (2.356085, 0.011497), (96.03174, 0.893012),)),
([0, 0], ((-11.16047, 0.131134), (2.218772, 0.021983), (85.28087, 1.712124))),
([0, 1], ((-11.47526, 0.118405), (2.271718, 0.019851), (89.31582, 1.545362))),
([1, 0], ((-11.48150, 0.112980), (2.272349, 0.018941), (89.43907, 1.474557))),
([7, 3], ((-11.98434, 0.068532), (2.356085, 0.011497), (96.03174, 0.893012))),
)


Expand All @@ -102,7 +102,7 @@ def test_direct_eviews(trivariate_data, config):
assert_allclose(res.std_errors, se, rtol=1e-4)


AUTO = ([10, 4], ((-12.00320, 0.066865), (2.359063, 0.011222), (96.33288, 0.870645),))
AUTO = ([10, 4], ((-12.00320, 0.066865), (2.359063, 0.011222), (96.33288, 0.870645)))


@pytest.mark.parametrize("config", [AUTO])
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_kernels_eviews(trivariate_data, config):
assert_allclose(res.long_run_variance, lrvar, rtol=1e-5)


HAC = (((-12.00320, 0.097762), (2.359063, 0.016323), (96.33288, 1.331138),),)
HAC = (((-12.00320, 0.097762), (2.359063, 0.016323), (96.33288, 1.331138)),)


@pytest.mark.parametrize("config", HAC)
Expand Down
22 changes: 11 additions & 11 deletions arch/tests/univariate/test_recursions.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def setup_class(cls):
"""

def test_garch(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -233,7 +233,7 @@ def test_garch(self):
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])

def test_harch(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -281,7 +281,7 @@ def test_harch(self):
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])

def test_arch(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -329,7 +329,7 @@ def test_arch(self):
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])

def test_garch_power_1(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -364,7 +364,7 @@ def test_garch_power_1(self):
assert_almost_equal(sigma2_python, sigma2)

def test_garch_direct(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -403,7 +403,7 @@ def test_garch_direct(self):
assert_almost_equal(sigma2_python, sigma2)

def test_garch_no_q(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3])
Expand Down Expand Up @@ -438,7 +438,7 @@ def test_garch_no_q(self):
assert_almost_equal(sigma2_python, sigma2)

def test_garch_no_p(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3])
Expand Down Expand Up @@ -473,7 +473,7 @@ def test_garch_no_p(self):
assert_almost_equal(sigma2_python, sigma2)

def test_garch_no_o(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -535,7 +535,7 @@ def test_garch_arch(self):
assert_almost_equal(sigma2_garch, sigma2)

def test_bounds(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([1e100, 0.4, 0.3, 0.2])
Expand Down Expand Up @@ -774,7 +774,7 @@ def test_egarch(self):
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])

def test_midas_hyperbolic(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast

parameters = np.array([0.1, 0.8, 0])
Expand Down Expand Up @@ -831,7 +831,7 @@ def test_midas_hyperbolic(self):
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])

def test_figarch_recursion(self):
nobs, resids, = self.nobs, self.resids
nobs, resids = self.nobs, self.resids
sigma2, backcast = self.sigma2, self.backcast
parameters = np.array([1.0, 0.2, 0.4, 0.3])
fresids = resids ** 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def single_experiment(trend, gen: Generator, file_name: str):
help="Number of CPUs to use. If not specified, uses cpu_count() - 1",
)
parser.add_argument(
"--z_only", action="store_true", help="Only execute Z-type tests",
"--z_only",
action="store_true",
help="Only execute Z-type tests",
)
args = parser.parse_args()
njobs = getattr(args, "ncpu", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ def worker(
help="Number of CPUs to use. If not specified, uses cpu_count() - 1",
)
parser.add_argument(
"--z_only", action="store_true", help="Only execute Z-type tests",
"--z_only",
action="store_true",
help="Only execute Z-type tests",
)
args = parser.parse_args()
njobs = getattr(args, "ncpu", None)
Expand Down
29 changes: 10 additions & 19 deletions arch/unitroot/unitroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,7 @@ def _compute_statistic(self) -> None:
"""

def _reset(self) -> None:
"""Resets the unit root test so that it will be recomputed
"""
"""Resets the unit root test so that it will be recomputed"""
self._stat = None
assert self._stat is None

Expand All @@ -515,14 +514,12 @@ def _compute_if_needed(self) -> None:

@property
def null_hypothesis(self) -> str:
"""The null hypothesis
"""
"""The null hypothesis"""
return self._null_hypothesis

@property
def alternative_hypothesis(self) -> str:
"""The alternative hypothesis
"""
"""The alternative hypothesis"""
return self._alternative_hypothesis

@property
Expand All @@ -538,16 +535,14 @@ def valid_trends(self) -> Sequence[str]:

@property
def pvalue(self) -> float:
"""Returns the p-value for the test statistic
"""
"""Returns the p-value for the test statistic"""
self._compute_if_needed()
assert self._pvalue is not None
return self._pvalue

@property
def stat(self) -> float:
"""The test statistic for a unit root
"""
"""The test statistic for a unit root"""
self._compute_if_needed()
assert self._stat is not None
return self._stat
Expand All @@ -561,8 +556,7 @@ def critical_values(self) -> Dict[str, float]:
return self._critical_values

def summary(self) -> Summary:
"""Summary of test, containing statistic, p-value and critical values
"""
"""Summary of test, containing statistic, p-value and critical values"""
table_data = [
("Test Statistic", "{0:0.3f}".format(self.stat)),
("P-value", "{0:0.3f}".format(self.pvalue)),
Expand Down Expand Up @@ -634,8 +628,7 @@ def lags(self, value: Union[int, int32, int64]) -> None:

@property
def y(self) -> ArrayLike:
"""Returns the data used in the test statistic
"""
"""Returns the data used in the test statistic"""
return self._y

@property
Expand Down Expand Up @@ -804,8 +797,7 @@ def _compute_statistic(self) -> None:

@property
def regression(self) -> RegressionResults:
"""Returns the OLS regression results from the ADF model estimated
"""
"""Returns the OLS regression results from the ADF model estimated"""
self._compute_if_needed()
return self._regression

Expand Down Expand Up @@ -986,8 +978,7 @@ def trend(self, value: str) -> None:

@property
def regression(self) -> RegressionResults:
"""Returns the OLS regression results from the ADF model estimated
"""
"""Returns the OLS regression results from the ADF model estimated"""
self._compute_if_needed()
return self._regression

Expand Down Expand Up @@ -1688,7 +1679,7 @@ def overlap(self, value: bool) -> None:
@property
def robust(self) -> bool:
"""Sets of gets the indicator to use a heteroskedasticity robust
variance estimator """
variance estimator"""
return self._robust

@robust.setter
Expand Down
2 changes: 1 addition & 1 deletion arch/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def ensure1d(
x: Union[int, float, Sequence[Union[int, float]], ArrayLike,], # noqa: E231
x: Union[int, float, Sequence[Union[int, float]], ArrayLike], # noqa: E231
name: Optional[Hashable],
series: bool = False,
) -> Union[NDArray, Series]:
Expand Down
7 changes: 6 additions & 1 deletion arch/utility/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ class WaldTestStatistic(object):
"""

def __init__(
self, stat: float, df: int, null: str, alternative: str, name: str = "",
self,
stat: float,
df: int,
null: str,
alternative: str,
name: str = "",
) -> None:
self._stat = stat
self._null = null
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pytest>=5
pytest-xdist

# formatting
black==19.10b0
black==20.8b1
isort
flake8

Expand Down

0 comments on commit ab7536a

Please sign in to comment.