Skip to content
Snippets Groups Projects
Commit 35b3714b authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Communication: debug option

parent 8e0f7e7a
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,8 @@ from pathlib import Path
from utils import *
debug = False
def eprint(*args):
print(*args, file=sys.stderr, flush=True)
......@@ -195,7 +197,11 @@ class FuncCaller():
return cbor_dump({'return': r})
async def _client_caller_(self, func_name, *args, **kwargs):
if debug:
eprint("ASK:", func_name, args, kwargs)
in_head, in_data_raw = await self._client_.question({'func_name': func_name}, cbor_dump({'args': args, 'kwargs': kwargs}))
if debug:
eprint("DONE", func_name, args, kwargs)
in_data = cbor2.loads(in_data_raw)
return in_data["return"]
......
......@@ -200,8 +200,11 @@ class TripHistory:
...
# tps_new[-1][2]["without_data"] += 1
def add_preprocessed_data(self, data):
def add_preprocessed_data(self, data, dt_from=dt_minf, dt_to=dt_pinf):
for x in data["history"]:
hp = HistoryPointFromPreprocessed(x)
print(dt_from, dt_to, hp.first_captured, hp.last_captured)
if dt_from <= hp.last_captured and hp.first_captured < dt_to:
self.history.append(HistoryPointFromPreprocessed(x))
self.history.sort(key=lambda hp: hp.first_captured)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment