Move `reg_err_types` imports to module-level
Hoist inline `from tractor._exceptions import reg_err_types` calls up to the module-level import block across 5 files so they follow normal import ordering. Other, - `kraken/broker.py`: same; also add `ConfigurationError` import and raise on missing `src_fiat` config field instead of `KeyError`. - `storage/__init__.py`: same; also switch from relative to absolute `piker.*` imports and reorder the import block. - comment out stray `await tractor.pause()` in binance `feed.py`. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-coderepair_tests
parent
79be47635f
commit
f210a478c6
|
|
@ -383,7 +383,8 @@ async def get_mkt_info(
|
|||
if not mkt_mode:
|
||||
mkt_mode: str = f'{venue_lower}_futes'
|
||||
|
||||
await tractor.pause()
|
||||
# tracing
|
||||
# await tractor.pause()
|
||||
|
||||
async with open_cached_client(
|
||||
'binance',
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import hashlib
|
|||
import hmac
|
||||
import base64
|
||||
import tractor
|
||||
from tractor._exceptions import reg_err_types
|
||||
import trio
|
||||
|
||||
from piker import config
|
||||
|
|
@ -118,7 +119,6 @@ class InvalidKey(ValueError):
|
|||
|
||||
'''
|
||||
|
||||
from tractor._exceptions import reg_err_types
|
||||
reg_err_types([InvalidKey])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ from typing import (
|
|||
from bidict import bidict
|
||||
import trio
|
||||
import tractor
|
||||
from tractor._exceptions import reg_err_types
|
||||
|
||||
from piker.accounting import (
|
||||
Position,
|
||||
|
|
@ -45,6 +46,9 @@ from piker.accounting import (
|
|||
open_trade_ledger,
|
||||
open_account,
|
||||
)
|
||||
from piker.config import (
|
||||
ConfigurationError,
|
||||
)
|
||||
from piker.clearing import(
|
||||
OrderDialogs,
|
||||
)
|
||||
|
|
@ -97,7 +101,7 @@ MsgUnion = Union[
|
|||
class TooFastEdit(Exception):
|
||||
'Edit requests faster then api submissions'
|
||||
|
||||
from tractor._exceptions import reg_err_types
|
||||
|
||||
reg_err_types([TooFastEdit])
|
||||
|
||||
|
||||
|
|
@ -464,7 +468,11 @@ async def open_trade_dialog(
|
|||
# (much like the web UI let's you set an "account currency")
|
||||
# such that all positions (nested or flat) will be translated to
|
||||
# this source currency's terms.
|
||||
src_fiat = client.conf['src_fiat']
|
||||
src_fiat = client.conf.get('src_fiat')
|
||||
if not src_fiat:
|
||||
raise ConfigurationError(
|
||||
'No `src_fiat: str` field defined in `brokers.toml`'
|
||||
)
|
||||
|
||||
# auth required block
|
||||
acctid = client._name
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ from typing import (
|
|||
)
|
||||
|
||||
from msgspec import field
|
||||
from tractor._exceptions import reg_err_types
|
||||
|
||||
from piker.types import Struct
|
||||
from piker.accounting import (
|
||||
Asset,
|
||||
MktPair,
|
||||
)
|
||||
from tractor._exceptions import reg_err_types
|
||||
from ._util import log
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ from msgspec.msgpack import (
|
|||
# import pyqtgraph as pg
|
||||
import numpy as np
|
||||
import tractor
|
||||
from tractor._exceptions import reg_err_types
|
||||
from trio_websocket import open_websocket_url
|
||||
from anyio_marketstore import ( # noqa
|
||||
open_marketstore_client,
|
||||
|
|
@ -382,7 +383,6 @@ def quote_to_marketstore_structarray(
|
|||
class MarketStoreError(Exception):
|
||||
"Generic marketstore client error"
|
||||
|
||||
from tractor._exceptions import reg_err_types
|
||||
reg_err_types([MarketStoreError])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,15 +42,17 @@ from typing import (
|
|||
)
|
||||
|
||||
import numpy as np
|
||||
from tractor._exceptions import reg_err_types
|
||||
|
||||
from .. import config
|
||||
from ..service import (
|
||||
check_for_service,
|
||||
)
|
||||
from ..log import (
|
||||
from piker import config
|
||||
from piker.log import (
|
||||
get_logger,
|
||||
get_console_log,
|
||||
)
|
||||
from piker.service import (
|
||||
check_for_service,
|
||||
)
|
||||
|
||||
subsys: str = 'piker.storage'
|
||||
|
||||
log = get_logger(subsys)
|
||||
|
|
@ -151,7 +153,6 @@ class StorageConnectionError(ConnectionError):
|
|||
|
||||
'''
|
||||
|
||||
from tractor._exceptions import reg_err_types
|
||||
reg_err_types([
|
||||
TimeseriesNotFound,
|
||||
StorageConnectionError,
|
||||
|
|
|
|||
Loading…
Reference in New Issue