139 Constructs array of json strings for components of this object.
140 add_lf: if True then line feed added at end of each entry. This is
141 unnecessary if returned array is printed as line per entry.
142 Returns string list with first entry starting with notok: if error
149 qcq:str= DQ +
":" + DQ
154 clbq:str= c + lb + DQ
163 outarray.append(lbq+
"report" + qc + ls)
164 outarray.append(lbq+
"title"+qcq+self.
title+qrb)
165 outarray.append(clbq+
"status"+qcq+self.
status+qrb)
166 outarray.append(clbq+
"debug"+qcq+self.
debug+qrb)
167 outarray.append(clbq+
"numrecs"+qcq+str(self.
numrecs)+qrb)
168 outarray.append(clbq+
"maxuv"+qcq+str(self.
maxuv)+qrb)
169 outarray.append(clbq+
"delim"+qcq+self.
delim+qrb)
170 outarray.append(clbq+
"delim_char"+qcq+self.
delim_char+qrb)
171 outarray.append(clbq+
"is_case_sens"+qcq+str(self.
is_case_sens).lower()+qrb)
172 outarray.append(clbq+
"is_quoted"+qcq+str(self.
is_quoted).lower()+qrb)
173 outarray.append(clbq+
"has_header"+qcq+str(self.
has_header).lower()+qrb)
174 outarray.append(clbq+
"extract_fields"+qcq+str(self.
extract_fields).lower()+qrb)
176 outarray.append(clbq+
"fields"+qc+ls)
177 for i
in range(len(self.
fields)):
182 outline += DQ + self.
fields[i].title + DQ
183 outarray.append(outline)
187 outarray.append(clbq+
"field_datatypes"+qc+ls)
188 for i
in range(len(self.
fields)):
193 outline += DQ + self.
fields[i].datatype + DQ
194 outarray.append(outline)
198 outarray.append(clbq+
"field_formats"+qc+ls)
199 for i
in range(len(self.
fields)):
205 outline+=DQ+
"strcase"+qcq+ self.
fields[i].fmt_strcase +DQ
206 outline+=c+DQ+
"strlen"+qcq+str(self.
fields[i].fmt_strlen)+DQ
207 outline+=c+DQ+
"decimal"+qcq+str(self.
fields[i].fmt_decimal)+DQ
208 outline+=c+DQ+
"date"+qcq+self.
fields[i].fmt_date+DQ
209 outline+=c+DQ+
"strcut"+qcq+str(self.
fields[i].fmt_strcut)+DQ
210 outline+=c+DQ+
"strpad"+qcq+str(self.
fields[i].fmt_strpad)+DQ
211 outline+=c+DQ+
"strpadchar"+qcq+str(self.
fields[i].fmt_strpadchar)+DQ
213 outarray.append(outline)
217 outarray.append(clbq+
"field_quality"+qc+ls)
218 for i
in range(len(self.
fields)):
225 outline += DQ + txt + DQ
226 outarray.append(outline)
230 outarray.append(clbq+
"field_datatype_dists"+qc+ls)
231 for i
in range(len(self.
fields)):
242 outline += DQ + k + qc + str(v)
244 outarray.append(outline)
248 outarray.append(clbq+
"field_uniqvalues"+qc+ls)
250 for i
in range(len(self.
fields)):
256 outline += lbq +
"field" + qcq + self.
fields[i].title +qcom
257 outarray.append(outline)
258 outline= DQ +
"uniqvalues" + qc + ls
259 outarray.append(outline)
264 txt= recfuncs.extract_char_aliases(self.
field_uniqvals[i][j][0],[
"|",
"/"])
265 outline += lbq +
"uniqvalue" + qcq + txt + qcom + DQ +
"count" + qc + str(self.
field_uniqvals[i][j][1]) + rb
266 outarray.append(outline)
272 outarray.append(clbq+
"covalues"+qc+ls)
278 outarray.append(outline)
282 outarray.append(clbq+
"covalue_uniqvalues"+qc+ls)
290 outline += lbq +
"covalue" + qcq + self.
covalues[i].title + qcom
291 outarray.append(outline)
292 outline= DQ +
"uniqvalues" + qc+ls
293 outarray.append(outline)
298 txt= recfuncs.extract_char_aliases(self.
covalue_uniqvals[i][j][0],[
"|",
"/"])
299 outline += lbq +
"uniqvalue" + qcq + txt + qcom
301 outarray.append(outline)
307 outarray.append(clbq+
"field_spchar_dists"+qc+ls)
308 for i
in range(len(self.
fields)):
312 outline += lbq +
"field" + qcq + self.
fields[i].title +qc+ls
313 outarray.append(outline)
321 outline += lbq + k + qc + str(v) + rb
322 outarray.append(outline)
328 outarray.append(clbq+
"spec_char_dists"+qc+ls)
335 outline += lbq + k + qc + str(v) + rb
336 outarray.append(outline)
340 outarray.append(clbq+
"spec_char_examples"+qc+ls)
347 if txt.find(
"[")>-1
and txt.find(
"]")>-1:
348 txt1=txt[:txt.find(
"]")+1]
349 txt=txt[txt.find(
"]")+1:]
350 txt= recfuncs.extract_char_aliases(txt,[
",",
"|",
"/",
"(",
")"])
352 outline += lbq +
"example" + qc + DQ + txt1 + DQ
353 outline += c+ DQ +
"rec" + qcq + txt + qrb
354 outarray.append(outline)
359 outarray.append(clbq+
"err_stats"+qc+ls)
360 outarray.append(lbq+
"numrecs_err"+qc+str(self.
err_stats[
"numrecs_err"])+rb)
361 outarray.append(clbq+
"numrecs_err_datatype"+qc+str(self.
err_stats[
"numrecs_err_datatype"])+rb)
362 outarray.append(clbq+
"numrecs_err_fmt"+qc+str(self.
err_stats[
"numrecs_err_fmt"])+rb)
363 outarray.append(clbq+
"fields_err_datatype"+qc+ls)
365 for f,b
in self.
err_stats[
"fields_err_datatype"].items():
370 outline += lbq +
"field" + qcq + str(f) + qcom
371 outline += DQ +
"count" + qc + str(b[
"count"]) + c
372 outarray.append(outline)
373 outarray.append(DQ+
"reasons"+qc + ls)
375 for r,n
in b[
"reasons"].items():
380 outline += lbq +
"reason" + qcq + str(r) + qcom
381 outline += DQ +
"count" + qc + str(n) + rb
382 outarray.append(outline)
388 outarray.append(clbq+
"fields_err_fmt"+qc+ls)
390 for f,b
in self.
err_stats[
"fields_err_fmt"].items():
395 outline += lbq +
"field" + qcq + str(f) + qcom
396 outline += DQ +
"count" + qc + str(b[
"count"]) + c
397 outarray.append(outline)
398 outarray.append(DQ+
"reasons"+qc + ls)
400 for r,n
in b[
"reasons"].items():
405 outline += lbq +
"reason" + qcq + str(r) + qcom
406 outline += DQ +
"count" + qc + str(n) + rb
407 outarray.append(outline)
417 outarray.append(clbq+
"err_datatype_examples"+qc+ls)
424 if txt.startswith(
"("):
425 txt1=txt[1:txt.find(
")")]
426 txt=txt[txt.find(
")")+1:]
427 txt= recfuncs.extract_char_aliases(txt,[
",",
"|",
"/",
"(",
")",
"[",
"]"])
429 outline += lbq +
"nline" + qc + txt1
430 outline += c+ DQ +
"rec" + qcq + txt + qrb
431 outarray.append(outline)
435 outarray.append(clbq+
"err_fmt_examples"+qc+ls)
442 if txt.startswith(
"("):
443 txt1=txt[1:txt.find(
")")]
444 txt=txt[txt.find(
")")+1:]
445 txt= recfuncs.extract_char_aliases(txt,[
",",
"|",
"/",
"(",
")",
"[",
"]"])
447 outline += lbq +
"nline" + qc + txt1
448 outline += c+ DQ +
"rec" + qcq + txt + qrb
449 outarray.append(outline)
453 outarray.append(clbq+
"rec_size_dist"+qc+ls)
460 outline += lbq + k + qc + str(v) + rb
461 outarray.append(outline)
465 outarray.append(clbq+
"rec_parse_dist"+qc+ls)
472 outline += lbq + k + qc + str(v) + rb
473 outarray.append(outline)
477 outarray.append(clbq+
"rec_parse_errs"+qc+ls)
478 outarray.append(lbq +
"small1" + qc + str(self.
rec_parse_errs[
"small1"]) + rb)
479 outarray.append(clbq +
"small2" + qc + str(self.
rec_parse_errs[
"small2"]) + rb)
480 outarray.append(clbq +
"big" + qc + str(self.
rec_parse_errs[
"big"]) + rb)
484 outarray.append(clbq+
"rec_parse_errs_examples"+qc+ls)
488 outarray.append(lbq +
"small1" + qc + ls)
493 txt= recfuncs.extract_char_aliases(self.
rec_parse_errs[
"small1_recs"][i],[
",",
" ",
"|",
"/",
"(",
")"])
494 outline += lbq +
"record" + qcq + txt + qrb
495 outline += lbq+txt+qrb
496 outarray.append(outline)
504 outarray.append(txt+lbq +
"small2" + qc + ls)
509 txt= recfuncs.extract_char_aliases(self.
rec_parse_errs[
"small2_recs"][i],[
",",
" ",
"|",
"/",
"(",
")"])
510 outline += lbq +
"record" + qcq + txt + qrb
511 outarray.append(outline)
519 outarray.append(txt+lbq +
"big" + qc + ls)
524 txt= recfuncs.extract_char_aliases(self.
rec_parse_errs[
"big_recs"][i],[
",",
" ",
"|",
"/",
"(",
")"])
525 outline += lbq +
"record" + qcq + txt + qrb
526 outarray.append(outline)
537 for i
in range(len(outarray)):
539 except (RuntimeError, OSError, ValueError)
as err:
540 outarray.insert(0,
"notok:" + str(err))