Skip to content

Commit

Permalink
MAINT: Update for changes in mypy
Browse files Browse the repository at this point in the history
Update typing for new errors due to mypy changes
  • Loading branch information
bashtage committed Oct 14, 2020
1 parent 7795ac3 commit 8ac812e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
5 changes: 3 additions & 2 deletions arch/bootstrap/base.py
Expand Up @@ -9,6 +9,7 @@
Sequence,
Tuple,
Union,
cast,
)

import numpy as np
Expand Down Expand Up @@ -708,8 +709,8 @@ def conf_int(
values = results
if method == studentized:
# studentized uses studentized parameter estimates
assert isinstance(studentized_results, NDArray)
values = studentized_results
# assert isinstance(studentized_results, NDArray)
values = cast(NDArray, studentized_results)

if method in ("debiased", "bc", "bias-corrected", "bca"):
# bias corrected uses modified percentiles, but is
Expand Down
Expand Up @@ -92,9 +92,7 @@ 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
Expand Up @@ -316,9 +316,7 @@ 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
5 changes: 2 additions & 3 deletions arch/univariate/volatility.py
Expand Up @@ -2270,7 +2270,7 @@ def compute_variance(
mus = self._ewma_smoothing_parameters()

sigma2_temp = np.zeros_like(sigma2)
assert isinstance(backcast, NDArray)
backcast = cast(NDArray, backcast)
for k in range(kmax):
mu = mus[k]
ewma_recursion(mu, resids, sigma2_temp, nobs, backcast[k])
Expand Down Expand Up @@ -2348,7 +2348,7 @@ def _simulation_forecast(
kmax = self.kmax
w = self._ewma_combination_weights()
mus = self._ewma_smoothing_parameters()
backcast = np.asarray(backcast)
backcast = cast(NDArray, np.asarray(backcast))

t = resids.shape[0]
paths = np.full((t, simulations, horizon), np.nan)
Expand All @@ -2359,7 +2359,6 @@ def _simulation_forecast(
component_one_step = np.empty((kmax, t + 1))
_resids = np.empty((t + 1))
_resids[:-1] = resids
assert isinstance(backcast, NDArray)
for k in range(kmax):
mu = mus[k]
ewma_recursion(mu, _resids, component_one_step[k, :], t + 1, backcast[k])
Expand Down
7 changes: 1 addition & 6 deletions arch/utility/testing.py
Expand Up @@ -26,12 +26,7 @@ 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

0 comments on commit 8ac812e

Please sign in to comment.