MCPcopy
hub / github.com/RUB-NDS/PRET / showstatus

Method showstatus

pjl.py:81–98  ·  view source on GitHub ↗
(self, str_stat)

Source from the content-addressed store, hash-verified

79
80 # parse PJL status message
81 def showstatus(self, str_stat):
82 codes = {}
83 messages = {}
84 # get status codes
85 for (num, code) in re.findall("CODE(\d+)?\s*=\s*(\d+)", str_stat):
86 codes[num] = code
87 # get status messages
88 for (num, mstr) in re.findall('DISPLAY(\d+)?\s*=\s*"(.*)"', str_stat):
89 messages[num] = mstr
90 # show codes and messages
91 for num, code in list(codes.items()):
92 message = messages[num] if num in messages else "UNKNOWN STATUS"
93 # workaround for hp printers with wrong range
94 if code.startswith("32"):
95 code = str(int(code) - 2000)
96 # show status from display and codebook
97 error = item(codebook().get_errors(code), "Unknown status")
98 output().errmsg("CODE " + code + ": " + message, error)
99
100 # parse PJL file errors
101 def fileerror(self, str_recv):

Callers 1

pjl_errMethod · 0.95

Calls 5

itemFunction · 0.90
codebookClass · 0.90
outputClass · 0.90
get_errorsMethod · 0.80
errmsgMethod · 0.80

Tested by

no test coverage detected