Skip to content

Commit

Permalink
MAINT: Restore typing completeness
Browse files Browse the repository at this point in the history
Fix typing issues
isort, black and flake8 compat
  • Loading branch information
bashtage committed Feb 3, 2020
1 parent 8b19978 commit 09d6217
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion arch/univariate/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import pandas as pd
from pandas import DataFrame, Series
from pandas.util._decorators import deprecate_kwarg
from arch.vendor import cached_property
from scipy.optimize import OptimizeResult
import scipy.stats as stats
from statsmodels.iolib.summary import Summary, fmt_2cols, fmt_params
Expand All @@ -34,6 +33,7 @@
starting_value_warning,
)
from arch.utility.testing import WaldTestStatistic
from arch.vendor import cached_property

try:
from matplotlib.figure import Figure
Expand Down
2 changes: 1 addition & 1 deletion arch/univariate/mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import numpy as np
from pandas import DataFrame
from arch.vendor import cached_property
from scipy.optimize import OptimizeResult
from statsmodels.tsa.tsatools import lagmat

Expand Down Expand Up @@ -40,6 +39,7 @@
ensure1d,
parse_dataframe,
)
from arch.vendor import cached_property

__all__ = ["HARX", "ConstantMean", "ZeroMean", "ARX", "arch_model", "LS"]

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

import numpy as np
from pandas import DataFrame, DatetimeIndex, Index, NaT, Series, Timestamp, to_datetime
from arch.vendor import cached_property

from arch.typing import AnyPandas, ArrayLike, DateLike, NDArray
from arch.vendor import cached_property

__all__ = [
"ensure1d",
Expand Down
3 changes: 2 additions & 1 deletion arch/utility/testing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Dict, Optional

from arch.vendor import cached_property
from scipy.stats import chi2

from arch.vendor import cached_property

__all__ = ["WaldTestStatistic"]


Expand Down
17 changes: 4 additions & 13 deletions arch/vendor/property_cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

import asyncio
import functools
import sys
import threading
from time import time
from typing import Any, Mapping
import weakref

__author__ = "Martin Larralde"
Expand All @@ -52,21 +52,12 @@ class cached_property(property):

_sentinel = object()

if sys.version_info[0] < 3:

def _update_wrapper(self, func):
self.__doc__ = getattr(func, "__doc__", None)
self.__module__ = getattr(func, "__module__", None)
self.__name__ = getattr(func, "__name__", None)

else:

_update_wrapper = functools.update_wrapper
_update_wrapper = functools.update_wrapper

def __init__(self, func) -> None:
self.cache = weakref.WeakKeyDictionary()
self.cache: Mapping[str, Any] = weakref.WeakKeyDictionary()
self.func = func
self._update_wrapper(func)
self._update_wrapper(func) # type: ignore

def __get__(self, obj, cls):
if obj is None:
Expand Down

0 comments on commit 09d6217

Please sign in to comment.