mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-11 12:00:50 +08:00
PERF: Reimplemented remember_last with a weak_lru_cache
which won't leak instances whose methods have been decorated (specifically DataPortal instances) MAINT: Not using functools32 anymore
This commit is contained in:
@@ -31,13 +31,12 @@ from zipline.data.us_equity_loader import (
|
||||
)
|
||||
|
||||
from zipline.utils import tradingcalendar
|
||||
from zipline.utils.compat import lru_cache
|
||||
from zipline.utils.math_utils import (
|
||||
nansum,
|
||||
nanmean,
|
||||
nanstd
|
||||
)
|
||||
from zipline.utils.memoize import remember_last
|
||||
from zipline.utils.memoize import remember_last, weak_lru_cache
|
||||
from zipline.errors import (
|
||||
NoTradeDataAvailableTooEarly,
|
||||
NoTradeDataAvailableTooLate,
|
||||
@@ -1686,7 +1685,7 @@ class DataPortal(object):
|
||||
else:
|
||||
return [assets] if isinstance(assets, Asset) else []
|
||||
|
||||
@lru_cache(20)
|
||||
@weak_lru_cache(20)
|
||||
def _get_minute_count_for_transform(self, ending_minute, days_count):
|
||||
# cache size picked somewhat loosely. this code exists purely to
|
||||
# handle deprecated API.
|
||||
|
||||
Reference in New Issue
Block a user