From 30a4fb13df9fc619720e0b2e51e2d1c532d65ef0 Mon Sep 17 00:00:00 2001 From: goodboy Date: Wed, 2 Dec 2026 17:35:22 -0500 Subject: [PATCH] Group shared `reg_err_types` imports with Tractor deps Finish the shared-module portion of the import cleanup whose Kraken hunks landed in e0f8e5a8. Deats, - Group the validation, MarketStore and storage imports with the other third-party deps. Keep exception registration beside the classes it registers. - Use absolute `piker` imports in `storage.__init__`. Extracted from f210a478c64f03e2d524f74878c80032a6ce84e4. (this commit msg was generated in some part by `Codex` using `GPT-6` (`OpenAI`)) --- piker/data/validate.py | 2 +- piker/service/marketstore.py | 2 +- piker/storage/__init__.py | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/piker/data/validate.py b/piker/data/validate.py index a446984f..f460bd71 100644 --- a/piker/data/validate.py +++ b/piker/data/validate.py @@ -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 diff --git a/piker/service/marketstore.py b/piker/service/marketstore.py index cf4d523a..2e2382dc 100644 --- a/piker/service/marketstore.py +++ b/piker/service/marketstore.py @@ -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]) diff --git a/piker/storage/__init__.py b/piker/storage/__init__.py index b7e55040..46e18626 100644 --- a/piker/storage/__init__.py +++ b/piker/storage/__init__.py @@ -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) @@ -160,7 +162,6 @@ class StorageConnectionError(ConnectionError): ''' -from tractor._exceptions import reg_err_types reg_err_types([ TimeseriesNotFound, StorageConnectionError,