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-code
repair_tests
Gud Boi 2026-03-30 13:25:41 -04:00
parent 79be47635f
commit f210a478c6
6 changed files with 22 additions and 12 deletions

View File

@ -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',

View File

@ -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])

View File

@ -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

View File

@ -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

View File

@ -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])

View File

@ -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,