Some linting fixes after trying out `ruff`

master
Tyler Goodlet 2023-05-24 17:25:23 -04:00
parent 7381c361cd
commit f0a346dcc3
5 changed files with 17 additions and 9 deletions

View File

@ -28,6 +28,7 @@ import tractor
import trio import trio
import typer import typer
from ..log import get_logger
from ..service import ( from ..service import (
open_piker_runtime, open_piker_runtime,
) )
@ -102,6 +103,7 @@ def sync(
"-l", "-l",
), ),
): ):
log = get_logger(loglevel)
console = Console() console = Console()
try: try:
@ -134,6 +136,10 @@ def sync(
tractor.open_nursery() as an, tractor.open_nursery() as an,
): ):
log.info(
f'Piker runtime up as {actor.uid}@{sockaddr}'
)
portal = await an.start_actor( portal = await an.start_actor(
loglevel=loglevel, loglevel=loglevel,
debug_mode=pdb, debug_mode=pdb,
@ -162,9 +168,10 @@ def sync(
async with ( async with (
open_trades_endpoint as ( open_trades_endpoint as (
brokerd_ctx, brokerd_ctx,
(positions, accounts,), (positions, accounts),
), ),
): ):
assert len(accounts) == 1
summary: str = ( summary: str = (
'[dim underline]Piker Position Summary[/] ' '[dim underline]Piker Position Summary[/] '
f'[dim blue underline]{brokername}[/]' f'[dim blue underline]{brokername}[/]'

View File

@ -296,7 +296,7 @@ class Client:
for bs_mktid, info in assets.items(): for bs_mktid, info in assets.items():
altname = self._altnames[bs_mktid] = info['altname'] altname = self._altnames[bs_mktid] = info['altname']
aclass = info['aclass'] aclass: str = info['aclass']
self.assets[bs_mktid] = Asset( self.assets[bs_mktid] = Asset(
name=altname.lower(), name=altname.lower(),

View File

@ -41,7 +41,6 @@ import numpy as np
from .. import config from .. import config
from ..accounting import ( from ..accounting import (
MktPair, MktPair,
unpack_fqme,
) )
from ._util import ( from ._util import (
log, log,
@ -110,6 +109,7 @@ async def start_backfill(
async with mod.open_history_client( async with mod.open_history_client(
mkt, mkt,
) as (hist, config): ) as (hist, config):
log.info(f'{mod} history client returned backfill config: {config}')
# get latest query's worth of history all the way # get latest query's worth of history all the way
# back to what is recorded in the tsdb # back to what is recorded in the tsdb
@ -326,7 +326,7 @@ async def start_backfill(
f'{start_dt} -> {end_dt}' f'{start_dt} -> {end_dt}'
) )
if mkt.dst.atype != 'crypto': if mkt.dst.atype not in {'crypto', 'crypto_currency'}:
# for now, our table key schema is not including # for now, our table key schema is not including
# the dst[/src] source asset token. # the dst[/src] source asset token.
col_sym_key: str = mkt.get_fqme( col_sym_key: str = mkt.get_fqme(

View File

@ -26,7 +26,6 @@
from __future__ import annotations from __future__ import annotations
from contextlib import asynccontextmanager as acm from contextlib import asynccontextmanager as acm
from datetime import datetime from datetime import datetime
from functools import partial
from pprint import pformat from pprint import pformat
from typing import ( from typing import (
Any, Any,
@ -59,6 +58,7 @@ from ._util import (
log, # sub-sys logger log, # sub-sys logger
get_console_log, get_console_log,
) )
from . import Services
from ..data.feed import maybe_open_feed from ..data.feed import maybe_open_feed
from .._profile import Profiler from .._profile import Profiler
from .. import config from .. import config
@ -260,7 +260,7 @@ async def start_ahab_daemon(
ep_kwargs={'user_config': conf}, ep_kwargs={'user_config': conf},
loglevel=loglevel, loglevel=loglevel,
) as ( ) as (
ctn_ready, _,
config, config,
(cid, pid), (cid, pid),
): ):
@ -583,6 +583,7 @@ class Storage:
client = self.client client = self.client
syms = await client.list_symbols() syms = await client.list_symbols()
if key not in syms: if key not in syms:
await tractor.breakpoint()
raise KeyError(f'`{key}` table key not found in\n{syms}?') raise KeyError(f'`{key}` table key not found in\n{syms}?')
tbk = mk_tbk(( tbk = mk_tbk((
@ -743,7 +744,7 @@ async def open_tsdb_client(
touch_if_dne=True, touch_if_dne=True,
) )
tsdbconf = rootconf['network'].get('tsdb') tsdbconf = rootconf['network'].get('tsdb')
backend = tsdbconf.pop('backend') # backend = tsdbconf.pop('backend')
async with ( async with (
open_storage_client( open_storage_client(
**tsdbconf, **tsdbconf,

View File

@ -123,8 +123,8 @@ class LevelLine(pg.InfiniteLine):
self._track_cursor: bool = False self._track_cursor: bool = False
self.always_show_labels = always_show_labels self.always_show_labels = always_show_labels
self._on_drag_start = lambda l: None self._on_drag_start = lambda lvln: None
self._on_drag_end = lambda l: None self._on_drag_end = lambda lvln: None
self._y_incr_mult = float(1 / chart.linked.mkt.size_tick) self._y_incr_mult = float(1 / chart.linked.mkt.size_tick)
self._right_end_sc: float = 0 self._right_end_sc: float = 0