edison-parser 0.4__tar.gz → 0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edison-parser
3
- Version: 0.4
3
+ Version: 0.5
4
4
  Summary: An EDIFACT parser with a real syntax tree.
5
5
  Author-email: Alex Prengère <alex.prengere@gmail.com>
6
6
  License-Expression: MIT
@@ -31,21 +31,23 @@ Dynamic: license-file
31
31
  <a href="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml"><img src="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml/badge.svg" alt="Build"></a>
32
32
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/v/edison-parser.svg" alt="Version"></a>
33
33
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/pyversions/edison-parser.svg" alt="Python versions"></a>
34
+ <a href="https://github.com/AmadeusITGroup/Edison/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
34
35
  <!-- <a href="https://pepy.tech/project/edison-parser"><img src="https://static.pepy.tech/badge/edison-parser" alt="Downloads"></a> -->
35
36
  </p>
36
37
  </div>
37
38
 
38
- Edison is a Python library for parsing EDIFACT messages. Instead of treating a
39
- message as a flat stream of segments, it models valid messages as a tree.
40
- You define the schema once, then parse, validate, or pretty-print
41
- messages against that structure.
39
+ Edison is a Python library for parsing EDIFACT messages. Instead of treating a message as a flat list of segments,
40
+ it models messages as a syntax tree: segments can define groups of child segments, recursively.
41
+
42
+ You define the syntax tree once, then parse, validate, or pretty-print messages against that structure.
43
+ It works by converting the syntax tree to a state machine of possible transitions between segments.
42
44
 
43
45
  ## Highlights
44
46
 
45
47
  - Define EDIFACT syntax trees directly in Python.
46
48
  - Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
47
49
  - Attach parsing callbacks to the segments you care about.
48
- - Select schemas by message version.
50
+ - Select syntax tree by message version.
49
51
  - Handle escaped EDIFACT separators and EBCDIC control characters.
50
52
  - Properly tokenize segments with specified lengths like `BLB`
51
53
  - Export transition graphs with `pydot`.
@@ -72,12 +74,12 @@ class PIZZAQParser(BaseParser):
72
74
  (0, 0): [
73
75
  ["UNH"],
74
76
  ["CVR"],
75
- ["REF"],
77
+ ["REF"], # one type of REF segment
76
78
  [
77
79
  "PIZ",
78
80
  [
79
81
  ["TYP", [], "parse_typ"],
80
- ["REF", [], "parse_ref"],
82
+ ["REF", [], "parse_ref"], # another type of REF segment
81
83
  ],
82
84
  ],
83
85
  ["UNT"],
@@ -89,9 +91,12 @@ class PIZZAQParser(BaseParser):
89
91
  self.pizza = None
90
92
 
91
93
  def parse_typ(self, segment: str):
94
+ # Executed when the parser sees a "TYP" segment. The segment is passed as a string.
92
95
  self.pizza = segment[4:]
93
96
 
94
97
  def parse_ref(self, segment: str):
98
+ # Executed when the parser sees a "REF" segment. The segment is passed as a string.
99
+ # Only executed on the "second" type of "REF" segment!
95
100
  refs = segment[4:].split("*")
96
101
  self.summary[self.pizza] = len(refs)
97
102
 
@@ -6,21 +6,23 @@
6
6
  <a href="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml"><img src="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml/badge.svg" alt="Build"></a>
7
7
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/v/edison-parser.svg" alt="Version"></a>
8
8
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/pyversions/edison-parser.svg" alt="Python versions"></a>
9
+ <a href="https://github.com/AmadeusITGroup/Edison/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
9
10
  <!-- <a href="https://pepy.tech/project/edison-parser"><img src="https://static.pepy.tech/badge/edison-parser" alt="Downloads"></a> -->
10
11
  </p>
11
12
  </div>
12
13
 
13
- Edison is a Python library for parsing EDIFACT messages. Instead of treating a
14
- message as a flat stream of segments, it models valid messages as a tree.
15
- You define the schema once, then parse, validate, or pretty-print
16
- messages against that structure.
14
+ Edison is a Python library for parsing EDIFACT messages. Instead of treating a message as a flat list of segments,
15
+ it models messages as a syntax tree: segments can define groups of child segments, recursively.
16
+
17
+ You define the syntax tree once, then parse, validate, or pretty-print messages against that structure.
18
+ It works by converting the syntax tree to a state machine of possible transitions between segments.
17
19
 
18
20
  ## Highlights
19
21
 
20
22
  - Define EDIFACT syntax trees directly in Python.
21
23
  - Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
22
24
  - Attach parsing callbacks to the segments you care about.
23
- - Select schemas by message version.
25
+ - Select syntax tree by message version.
24
26
  - Handle escaped EDIFACT separators and EBCDIC control characters.
25
27
  - Properly tokenize segments with specified lengths like `BLB`
26
28
  - Export transition graphs with `pydot`.
@@ -47,12 +49,12 @@ class PIZZAQParser(BaseParser):
47
49
  (0, 0): [
48
50
  ["UNH"],
49
51
  ["CVR"],
50
- ["REF"],
52
+ ["REF"], # one type of REF segment
51
53
  [
52
54
  "PIZ",
53
55
  [
54
56
  ["TYP", [], "parse_typ"],
55
- ["REF", [], "parse_ref"],
57
+ ["REF", [], "parse_ref"], # another type of REF segment
56
58
  ],
57
59
  ],
58
60
  ["UNT"],
@@ -64,9 +66,12 @@ class PIZZAQParser(BaseParser):
64
66
  self.pizza = None
65
67
 
66
68
  def parse_typ(self, segment: str):
69
+ # Executed when the parser sees a "TYP" segment. The segment is passed as a string.
67
70
  self.pizza = segment[4:]
68
71
 
69
72
  def parse_ref(self, segment: str):
73
+ # Executed when the parser sees a "REF" segment. The segment is passed as a string.
74
+ # Only executed on the "second" type of "REF" segment!
70
75
  refs = segment[4:].split("*")
71
76
  self.summary[self.pizza] = len(refs)
72
77
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edison-parser
3
- Version: 0.4
3
+ Version: 0.5
4
4
  Summary: An EDIFACT parser with a real syntax tree.
5
5
  Author-email: Alex Prengère <alex.prengere@gmail.com>
6
6
  License-Expression: MIT
@@ -31,21 +31,23 @@ Dynamic: license-file
31
31
  <a href="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml"><img src="https://github.com/AmadeusITGroup/Edison/actions/workflows/ci.yml/badge.svg" alt="Build"></a>
32
32
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/v/edison-parser.svg" alt="Version"></a>
33
33
  <a href="https://pypi.org/project/edison-parser/"><img src="https://img.shields.io/pypi/pyversions/edison-parser.svg" alt="Python versions"></a>
34
+ <a href="https://github.com/AmadeusITGroup/Edison/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
34
35
  <!-- <a href="https://pepy.tech/project/edison-parser"><img src="https://static.pepy.tech/badge/edison-parser" alt="Downloads"></a> -->
35
36
  </p>
36
37
  </div>
37
38
 
38
- Edison is a Python library for parsing EDIFACT messages. Instead of treating a
39
- message as a flat stream of segments, it models valid messages as a tree.
40
- You define the schema once, then parse, validate, or pretty-print
41
- messages against that structure.
39
+ Edison is a Python library for parsing EDIFACT messages. Instead of treating a message as a flat list of segments,
40
+ it models messages as a syntax tree: segments can define groups of child segments, recursively.
41
+
42
+ You define the syntax tree once, then parse, validate, or pretty-print messages against that structure.
43
+ It works by converting the syntax tree to a state machine of possible transitions between segments.
42
44
 
43
45
  ## Highlights
44
46
 
45
47
  - Define EDIFACT syntax trees directly in Python.
46
48
  - Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
47
49
  - Attach parsing callbacks to the segments you care about.
48
- - Select schemas by message version.
50
+ - Select syntax tree by message version.
49
51
  - Handle escaped EDIFACT separators and EBCDIC control characters.
50
52
  - Properly tokenize segments with specified lengths like `BLB`
51
53
  - Export transition graphs with `pydot`.
@@ -72,12 +74,12 @@ class PIZZAQParser(BaseParser):
72
74
  (0, 0): [
73
75
  ["UNH"],
74
76
  ["CVR"],
75
- ["REF"],
77
+ ["REF"], # one type of REF segment
76
78
  [
77
79
  "PIZ",
78
80
  [
79
81
  ["TYP", [], "parse_typ"],
80
- ["REF", [], "parse_ref"],
82
+ ["REF", [], "parse_ref"], # another type of REF segment
81
83
  ],
82
84
  ],
83
85
  ["UNT"],
@@ -89,9 +91,12 @@ class PIZZAQParser(BaseParser):
89
91
  self.pizza = None
90
92
 
91
93
  def parse_typ(self, segment: str):
94
+ # Executed when the parser sees a "TYP" segment. The segment is passed as a string.
92
95
  self.pizza = segment[4:]
93
96
 
94
97
  def parse_ref(self, segment: str):
98
+ # Executed when the parser sees a "REF" segment. The segment is passed as a string.
99
+ # Only executed on the "second" type of "REF" segment!
95
100
  refs = segment[4:].split("*")
96
101
  self.summary[self.pizza] = len(refs)
97
102
 
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.5",
3
+ "distance": 0,
4
+ "node": "g6322c36918168e89c37bd4a1872c622539a6ac58",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-22"
8
+ }
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.4",
3
- "distance": 0,
4
- "node": "gd5d6d94b1b4dd48881eaa4ea42bee94e6e437a97",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-10-21"
8
- }
File without changes
File without changes
File without changes
File without changes