-
Notifications
You must be signed in to change notification settings - Fork 88
refactor: mv class and interface #246
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,5 @@ | |||
# Breaking changes | |||
## 0.2.0-beta60 | |||
- `MarketDataCache` moved into [tinkoff/invest/caching/market_data_cache/cache.py](tinkoff/invest/caching/market_data_cache/cache.py). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `MarketDataCache` moved into [tinkoff/invest/caching/market_data_cache/cache.py](tinkoff/invest/caching/market_data_cache/cache.py). | |
- `MarketDataCache` was moved to [tinkoff/invest/caching/market_data_cache/cache.py](tinkoff/invest/caching/market_data_cache/cache.py). |
# Breaking changes | ||
## 0.2.0-beta60 | ||
- `MarketDataCache` moved into [tinkoff/invest/caching/market_data_cache/cache.py](tinkoff/invest/caching/market_data_cache/cache.py). | ||
- Correct import is now `from tinkoff.invest.caching.market_data_cache.cache import MarketDataCache` (whereas previously was `from tinkoff.invest.services import MarketDataCache`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Correct import is now `from tinkoff.invest.caching.market_data_cache.cache import MarketDataCache` (whereas previously was `from tinkoff.invest.services import MarketDataCache`). | |
- The correct import is now `from tinkoff.invest.caching.market_data_cache.cache import MarketDataCache` instead of `from tinkoff.invest.services import MarketDataCache`. |
) | ||
logger.debug( | ||
"Filtered net real [\n%s\n%s\n]", | ||
str(min(list(map(lambda x: x.time, filtered_candles)))), # noqa: C417 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C417: Unnecessary map
usage - rewrite using a generator expression/<list/set/dict>
comprehension.
map(func, iterable)
has great performance when func is a built-in function, and it makes sense if your function already has a name. But if your func is a lambda
, it’s faster to use a generator expression or a comprehension, as it avoids the function call overhead. For example:
- Rewrite
map(lambda x: x + 1, iterable)
to(x + 1 for x in iterable)
- Rewrite
map(lambda item: get_id(item), items)
to(get_id(item) for item in items)
- Rewrite
list(map(lambda num: num * 2, nums))
to[num * 2 for num in nums]
- Rewrite
set(map(lambda num: num % 2 == 0, nums))
to{num % 2 == 0 for num in nums}
- Rewrite
dict(map(lambda v: (v, v ** 2), values))
to{v : v ** 2 for v in values}
from .caching.market_data_cache.instrument_market_data_storage import ( | ||
InstrumentMarketDataStorage, | ||
) | ||
from .candle_getter_interface import ICandleGetter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай это лучше как Protocol опишем и уберем явное наследование от абстрактного класса. Плюс убрать I, это вроде как плохая практика
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в общем в этом модуле вообще не должно быть импортом из других мест
No description provided.