Skip to content

refactor: mv class and interface #246

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

irusland
Copy link
Contributor

@irusland irusland commented Aug 3, 2023

No description provided.

@irusland irusland self-assigned this Aug 3, 2023
@irusland irusland requested a review from daxartio August 4, 2023 06:59
@@ -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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай это лучше как Protocol опишем и уберем явное наследование от абстрактного класса. Плюс убрать I, это вроде как плохая практика

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в общем в этом модуле вообще не должно быть импортом из других мест

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants