From 3e83764b5b3a7a64906eec922ed56a96e12c46b1 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Sat, 25 Feb 2023 16:21:30 -0500 Subject: [PATCH] Remove whitespace, uneeded comments --- piker/clearing/_ems.py | 3 ++- piker/clearing/_paper_engine.py | 2 +- piker/config.py | 3 ++- piker/pp.py | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 1f3c52cb..477da310 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -1451,7 +1451,8 @@ async def _emsd_main( ) as (relay, feed, client_ready): brokerd_stream = relay.brokerd_stream - dark_book = _router.get_dark_book(broker) + dark_book = _router.get_dark_book(broker) + # signal to client that we're started and deliver # all known pps and accounts for this ``brokerd``. await ems_ctx.started(( diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index 5b1453a8..4b226c1c 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -30,6 +30,7 @@ from typing import ( Callable, ) import uuid + from bidict import bidict import pendulum import trio @@ -249,7 +250,6 @@ class PaperBoi(Struct): ) await self.ems_trades_stream.send(msg) - # lookup any existing position key = fqsn.rstrip(f'.{self.broker}') t = Transaction( fqsn=fqsn, diff --git a/piker/config.py b/piker/config.py index abcbb652..6a76410e 100644 --- a/piker/config.py +++ b/piker/config.py @@ -33,6 +33,7 @@ from .log import get_logger log = get_logger('broker-config') + # taken from ``click`` since apparently they have some # super weirdness with sigint and sudo..no clue def get_app_dir(app_name, roaming=True, force_posix=False): @@ -92,7 +93,7 @@ def get_app_dir(app_name, roaming=True, force_posix=False): os.path.expanduser("~/.{}".format(_posixify(app_name)))) if sys.platform == "darwin": return os.path.join( - os.path.expanduser("~/Los.mkdir(_config_dir)ibrary/Application Support"), app_name + os.path.expanduser("~/Library/Application Support"), app_name ) return os.path.join( os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), diff --git a/piker/pp.py b/piker/pp.py index 756d9811..33086ba1 100644 --- a/piker/pp.py +++ b/piker/pp.py @@ -35,7 +35,6 @@ from typing import ( Union, Generator ) -from typing import Generator import pendulum from pendulum import datetime, now @@ -56,6 +55,7 @@ log = get_logger(__name__) def open_trade_ledger( broker: str, account: str, + ) -> Generator[dict, None, None]: ''' Indempotently create and read in a trade log file from the @@ -84,6 +84,7 @@ def open_trade_ledger( ledger = tomli.load(cf) print(f'Ledger load took {time.time() - start}s') cpy = ledger.copy() + try: yield cpy finally: @@ -544,6 +545,7 @@ class PpTable(Struct): pps = self.pps updated: dict[str, Position] = {} + # lifo update all pps from records for tid, t in trans.items(): @@ -680,6 +682,7 @@ class PpTable(Struct): # TODO: show diff output? # https://stackoverflow.com/questions/12956957/print-diff-of-python-dictionaries print(f'Updating ``pps.toml`` for {path}:\n') + # active, closed_pp_objs = table.dump_active() pp_entries = self.to_toml() self.conf[self.brokername][self.acctid] = pp_entries @@ -975,7 +978,6 @@ def open_pps( pp.ensure_state() try: -# breakpoint() yield table finally: if write_on_exit: