pyx12.errh_json

Generates a JSON document of validation errors. Visitor - Visits an error_handler composite (issue #50).

Classes

errh_json_visitor

Visit an error_handler composite. Accumulate a nested dict mirroring

Module Contents

class pyx12.errh_json.errh_json_visitor(fd, indent=2)[source]

Bases: pyx12.error_visitor.error_visitor

Visit an error_handler composite. Accumulate a nested dict mirroring the ISA / GS / ST / segment / element hierarchy and dump it once as JSON in visit_root_post.

Streaming JSON during the walk would require closing arrays mid-walk; the err_handler tree always fits in memory for any X12 document, so accumulate-then-dump is the right shape.

Parameters:
  • fd (file descriptor) – target file

  • indent (int | None) – json.dump indent argument; pass None for compact output

fd: TextIO[source]
indent: int | None[source]
doc: dict[str, Any][source]
visit_root_post(errh)[source]
Parameters:

errh (L{error_handler.err_handler}) – Error handler

Return type:

None

visit_isa_pre(err_isa)[source]
Parameters:

err_isa (L{error_handler.err_isa}) – ISA error node

Return type:

None

visit_isa_post(err_isa)[source]

Params: err_isa - error_isa instance

Parameters:

err_isa (Any)

Return type:

None

visit_gs_pre(err_gs)[source]
Parameters:

err_gs (Any)

Return type:

None

visit_gs_post(err_gs)[source]

Params: err_gs - error_gs instance

Parameters:

err_gs (Any)

Return type:

None

visit_st_pre(err_st)[source]
Parameters:

err_st (Any)

Return type:

None

visit_st_post(err_st)[source]

Params: err_st - error_st instance

Parameters:

err_st (Any)

Return type:

None

visit_seg(err_seg)[source]

Params: err_seg - error_seg instance

Parameters:

err_seg (Any)

Return type:

None

visit_ele(err_ele)[source]

Params: err_ele - error_ele instance

Parameters:

err_ele (Any)

Return type:

None