19 lines
513 B
Python
19 lines
513 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Callable
|
|
|
|
from tushare_client import TushareClient
|
|
|
|
|
|
class TushareProvider:
|
|
def __init__(
|
|
self,
|
|
token_supplier: Callable[[], str],
|
|
client_factory: Callable[[str], TushareClient] = TushareClient,
|
|
) -> None:
|
|
self._token_supplier = token_supplier
|
|
self._client_factory = client_factory
|
|
|
|
def client(self) -> TushareClient:
|
|
return self._client_factory(str(self._token_supplier() or "").strip())
|