bybit-exchange/pybit

Type hint in '_http_manager.py' causing TypeError: 'type' object is not subscriptable

Opened this issue · 0 comments

Minium code to replicate the error

from pybit.unified_trading import HTTP

Traceback

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from pybit.unified_trading import HTTP
  File "...\env\lib\site-packages\pybit\unified_trading.py", line 7, in <module>
    from ._v5_misc import MiscHTTP
  File "...\env\lib\site-packages\pybit\_v5_misc.py", line 1, in <module>
    from ._http_manager import _V5HTTPManager
  File "...\env\lib\site-packages\pybit\_http_manager.py", line 62, in <module>
    class _V5HTTPManager:
  File "...\env\lib\site-packages\pybit\_http_manager.py", line 75, in _V5HTTPManager
    retry_codes: defaultdict[dict] = field(
TypeError: 'type' object is not subscriptable

Fixes

'_http_manager.py'

line 1

from collections import defaultdict # old

from typing import DefaultDict, Any # new

line 75

    retry_codes: defaultdict[dict] = field( # old

    retry_codes: DefaultDict[dict, Any] = field( # new