pyx12.path

Parses an x12 path

An x12 path is comprised of a sequence of loop identifiers, a segment identifier, and element position, and a composite position.

The last loop id might be a segment id.

/LOOP_1/LOOP_2 /LOOP_1/LOOP_2/SEG /LOOP_1/LOOP_2/SEG02 /LOOP_1/LOOP_2/SEG[424]02-1 SEG[434]02-1 02-1 02

Classes

X12Path

Interface to an x12 path

Module Contents

class pyx12.path.X12Path(path_str)[source]

Interface to an x12 path

Parameters:

path_str (string)

re_seg_id: str = '(?P<seg_id>[A-Z][A-Z0-9]{1,2})?'[source]
re_id_val: str = '(\\[(?P<id_val>[A-Z0-9]+)\\])?'[source]
re_ele_idx: str = '(?P<ele_idx>[0-9]{2})?'[source]
re_subele_idx: str = '(-(?P<subele_idx>[0-9]+))?'[source]
re_str: str = '^(?P<seg_id>[A-Z][A-Z0-9]{1,2})?(\\[(?P<id_val>[A-Z0-9]+)\\])?(?P<ele_idx>[0-9]{2})?(-(?P<subele...[source]
rec_path: re.Pattern[str][source]
seg_id: str | None[source]
id_val: str | None[source]
ele_idx: int | None[source]
subele_idx: int | None[source]
relative: bool | None[source]
loop_list: list[str][source]
is_match(path_str)[source]
Parameters:

path_str (str)

Return type:

None

empty()[source]

Is the path empty? :return: True if contains no path data :rtype: boolean

Return type:

bool

format()[source]
Return type:

string

format_refdes()[source]
Return type:

str

is_child_path(child_path)[source]

Is the child path a child of this path? :type child_path: string :return: True if a child :rtype: boolean

Parameters:

child_path (str)

Return type:

bool