Package pyx12 :: Module map_if
[hide private]

Module map_if

source code

Interface to a X12N IG Map

Classes [hide private]
  x12_node
X12 Node Superclass
  map_if
Map file interface
  loop_if
Loop Interface
  segment_if
Segment Interface
  element_if
Element Interface
  composite_if
Composite Node Interface
  Pickle_Errors
Class for map pickling errors.
  Create_Map_Errors
Class for map creation errors.
Functions [hide private]
 
apply_xslt_to_map_win() source code
 
cb(ctx, str) source code
pyx12.map_if
load_map_file(map_file, param, xslt_files=[])
If any XSL transforms are given, apply them and create map_if from transformed map.
source code
tuple(boolean, error string)
is_syntax_valid(seg_data, syn)
Verifies the segment against the syntax
source code
string
syntax_str(syntax) source code
string
syntax_ele_id_str(seg_id, ele_pos_list) source code
boolean
IsValidDataType(str_val, data_type, charset='B')
Is str_val a valid X12 data value
source code
boolean
match_re(short_data_type, val)
Returns: True if matched, False if not
source code
boolean
not_match_re(short_data_type, val, charset='B')
Returns: True if found invalid characters, False if none
source code
boolean
is_valid_date(data_type, val)
Returns: True if valid, False if not
source code
 
is_valid_time(val) source code
Variables [hide private]
  NodeType = {'CData': 4, 'attrib': 2, 'comment': 8, 'doc': 9, '...
  MAXINT = 2147483647
  rec_N = re.compile(r'(?s)^-?[0-9]+')
  rec_R = re.compile(r'(?s)^-?[0-9]*(\.[0-9]+)?')
  rec_ID_E = re.compile(r'(?s)[^A-Z0-9!"&\'\(\)\*\+,-\\\./:;\?=\...
  rec_ID_B = re.compile(r'(?s)[^A-Z0-9!"&\'\(\)\*\+,-\\\./:;\?=\...
  rec_DT = re.compile(r'(?s)[^0-9]+')
  rec_TM = re.compile(r'(?s)[^0-9]+')
Function Details [hide private]

load_map_file(map_file, param, xslt_files=[])

source code 

If any XSL transforms are given, apply them and create map_if from transformed map. Else, load the map by pickle if available

Parameters:
  • map_file (string) - absolute path for file
  • xslt_files (list[string]) - list of absolute paths of xsl files
Returns: pyx12.map_if

is_syntax_valid(seg_data, syn)

source code 

Verifies the segment against the syntax

Parameters:
  • seg_data (segment) - data segment instance
  • syn (list[string]) - list containing the syntax type, and the indices of elements
Returns: tuple(boolean, error string)

IsValidDataType(str_val, data_type, charset='B')

source code 

Is str_val a valid X12 data value

Parameters:
  • str_val (string) - data value to validate
  • data_type (string) - X12 data element identifier
  • charset (string) - [optional] - 'B' for Basic X12 character set, 'E' for extended
Returns: boolean

match_re(short_data_type, val)

source code 
Parameters:
  • short_data_type (string) - simplified data type
  • val (string) - data value to be verified
Returns: boolean
True if matched, False if not

not_match_re(short_data_type, val, charset='B')

source code 
Parameters:
  • short_data_type (string) - simplified data type
  • val (string) - data value to be verified
  • charset (string) - [optional] - 'B' for Basic X12 character set, 'E' for extended
Returns: boolean
True if found invalid characters, False if none

is_valid_date(data_type, val)

source code 
Parameters:
  • data_type (string) - Date type
  • val (string) - data value to be verified
Returns: boolean
True if valid, False if not

is_valid_time(val)

source code 
Parameters:
  • val (string) - time value to be verified

Variables Details [hide private]

NodeType

Value:
{'CData': 4,
 'attrib': 2,
 'comment': 8,
 'doc': 9,
 'doc_frag': 11,
 'dtd': 10,
 'element_end': 15,
 'element_start': 1,
...

rec_ID_E

Value:
re.compile(r'(?s)[^A-Z0-9!"&\'\(\)\*\+,-\\\./:;\?=\sa-z%~@\[\]_\{\}\\\\
|<>#\$\s]')

rec_ID_B

Value:
re.compile(r'(?s)[^A-Z0-9!"&\'\(\)\*\+,-\\\./:;\?=\s]')