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

View File

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

View File

@ -41,7 +41,6 @@ import numpy as np
from .. import config
from ..accounting import (
MktPair,
unpack_fqme,
)
from ._util import (
log,
@ -110,6 +109,7 @@ async def start_backfill(
async with mod.open_history_client(
mkt,
) as (hist, config):
log.info(f'{mod} history client returned backfill config: {config}')
# get latest query's worth of history all the way
# back to what is recorded in the tsdb
@ -326,7 +326,7 @@ async def start_backfill(
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
# the dst[/src] source asset token.
col_sym_key: str = mkt.get_fqme(

View File

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

View File

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