From deaaa16e8cbdcdb5026c4eda5a1ae67a8b7cfa69 Mon Sep 17 00:00:00 2001 From: Rudolph Pienaar Date: Fri, 17 May 2024 17:05:02 -0400 Subject: [PATCH] Reformat --- pypx/status.py | 93 ++++++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 48 deletions(-) diff --git a/pypx/status.py b/pypx/status.py index 13833fd..7204a5c 100644 --- a/pypx/status.py +++ b/pypx/status.py @@ -1,14 +1,15 @@ # Global modules -import subprocess -import pudb -import json -import pfmisc -from pfmisc._colors import Colors -from argparse import Namespace +import subprocess +import pudb +import json +import pfmisc +from pfmisc._colors import Colors +from argparse import Namespace # PYPX modules -from .base import Base -from pypx import smdb +from .base import Base +from pypx import smdb + class Status(Base): """ @@ -32,56 +33,52 @@ def __init__(self, arg): """ super(Status, self).__init__(arg) - self.dp = pfmisc.debug( - verbosity = self.verbosity, - within = 'Find', - syslog = False - ) - self.log = self.dp.qprint - self.db = smdb.SMDB( - Namespace(str_logDir = self.arg['dblogbasepath']) - ) + self.dp = pfmisc.debug(verbosity=self.verbosity, within="Find", syslog=False) + self.log = self.dp.qprint + self.db = smdb.SMDB(Namespace(str_logDir=self.arg["dblogbasepath"])) def status_init(self): """ Intialize the status model """ - d_status = { - 'state' : { - 'study': "NoStudyFound", - 'series': "NoSeriesFound", - 'images': "NoImagesFound", + d_status = { + "state": { + "study": "NoStudyFound", + "series": "NoSeriesFound", + "images": "NoImagesFound", + }, + "study": {}, + "series": {}, + "images": { + "received": {"count": -1}, + "requested": {"count": -1}, + "packed": {"count": -1}, + "pushed": {"count": -1}, + "registered": {"count": -1}, }, - 'study' : {}, - 'series' : {}, - 'images' : { - 'received' : {'count' : -1}, - 'requested' : {'count' : -1}, - 'packed' : {'count' : -1}, - 'pushed' : {'count' : -1}, - 'registered' : {'count' : -1} - } } return d_status def run(self, opt={}) -> dict: # pudb.set_trace() - d_status : dict = self.status_init() - d_status.update(self.db.study_seriesContainsVerify( - opt['StudyInstanceUID'], - opt['SeriesInstanceUID'], - opt['verifySeriesInStudy'] - )) - d_status['state']['study'] = d_status['study']['state'] - if opt['verifySeriesInStudy']: - if 'seriesListInStudy' in d_status['study'].keys(): - if not d_status['study']['seriesListInStudy']['status']: - d_status['state']['series'] = 'SeriesNotInStudy' + d_status: dict = self.status_init() + d_status.update( + self.db.study_seriesContainsVerify( + opt["StudyInstanceUID"], + opt["SeriesInstanceUID"], + opt["verifySeriesInStudy"], + ) + ) + d_status["state"]["study"] = d_status["study"]["state"] + if opt["verifySeriesInStudy"]: + if "seriesListInStudy" in d_status["study"].keys(): + if not d_status["study"]["seriesListInStudy"]["status"]: + d_status["state"]["series"] = "SeriesNotInStudy" return d_status - if d_status['status']: - d_status['images'] = self.db.series_receivedAndRequested( - opt['SeriesInstanceUID'] - ) - d_status['state']['series'] = d_status['series']['state'] - d_status['state']['images'] = d_status['images']['state'] + if d_status["status"]: + d_status["images"] = self.db.series_receivedAndRequested( + opt["SeriesInstanceUID"] + ) + d_status["state"]["series"] = d_status["series"]["state"] + d_status["state"]["images"] = d_status["images"]["state"] return d_status