edison-parser 0.2__tar.gz → 0.4__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.
- {edison_parser-0.2/src/edison_parser.egg-info → edison_parser-0.4}/PKG-INFO +25 -11
- {edison_parser-0.2 → edison_parser-0.4}/README.md +24 -10
- {edison_parser-0.2 → edison_parser-0.4/src/edison_parser.egg-info}/PKG-INFO +25 -11
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/scm_file_list.json +1 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/scm_version.json +2 -2
- {edison_parser-0.2 → edison_parser-0.4}/LICENSE +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/MANIFEST.in +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/pyproject.toml +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/setup.cfg +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison/__init__.py +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison/envelope.py +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison/parser.py +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison/py.typed +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison/tokenizer.py +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/SOURCES.txt +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/dependency_links.txt +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/requires.txt +0 -0
- {edison_parser-0.2 → edison_parser-0.4}/src/edison_parser.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edison-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
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
|
|
@@ -36,16 +36,16 @@ Dynamic: license-file
|
|
|
36
36
|
</div>
|
|
37
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
|
-
|
|
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
41
|
messages against that structure.
|
|
42
42
|
|
|
43
43
|
## Highlights
|
|
44
44
|
|
|
45
45
|
- Define EDIFACT syntax trees directly in Python.
|
|
46
|
+
- Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
|
|
46
47
|
- Attach parsing callbacks to the segments you care about.
|
|
47
48
|
- Select schemas by message version.
|
|
48
|
-
- Model conditional, mandatory, and repeatable segments.
|
|
49
49
|
- Handle escaped EDIFACT separators and EBCDIC control characters.
|
|
50
50
|
- Properly tokenize segments with specified lengths like `BLB`
|
|
51
51
|
- Export transition graphs with `pydot`.
|
|
@@ -109,16 +109,21 @@ REF+3'
|
|
|
109
109
|
UNT+19+1'
|
|
110
110
|
"""
|
|
111
111
|
|
|
112
|
+
# Create the parser and parse this EDIFACT message.
|
|
113
|
+
# The `summary` attribute is populated by the callbacks.
|
|
112
114
|
parser = PIZZAQParser()
|
|
113
115
|
parser.parse(edi)
|
|
116
|
+
parser.summary # {"MARGARITA": 2, "PESTO": 1}
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
# Validate and pretty-print the message.
|
|
119
|
+
PIZZAQParser.validate(edi) # True/False
|
|
120
|
+
PIZZAQParser.show(edi) # to print
|
|
118
121
|
```
|
|
119
122
|
|
|
123
|
+
Here is the output of `PIZZAQParser.show(edi)`.
|
|
124
|
+
|
|
120
125
|
<div align="center">
|
|
121
|
-
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="
|
|
126
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="364" alt="Edison">
|
|
122
127
|
<p><strong>Tree-based structure.</strong></p>
|
|
123
128
|
</div>
|
|
124
129
|
|
|
@@ -318,9 +323,12 @@ finishes.
|
|
|
318
323
|
<details>
|
|
319
324
|
<summary>Transition graphs</summary>
|
|
320
325
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
Internally, Edison builds a directed graph of transitions between segments, when the parser class is created.
|
|
327
|
+
Each node is a specific segment, and each edge is a valid transition to the next segment.
|
|
328
|
+
With this, parsing is just a walk through the graph, and validation is checking if the path exists.
|
|
329
|
+
|
|
330
|
+
You can visualize the transition graph with `build_dot_object()`, which returns a `pydot.Dot` object.
|
|
331
|
+
`pydot` is installed with Edison. To write PNG files, make sure Graphviz is available on your system.
|
|
324
332
|
|
|
325
333
|
```python
|
|
326
334
|
from edison import BaseParser
|
|
@@ -345,6 +353,12 @@ dot = Parser.build_dot_object()
|
|
|
345
353
|
dot.write_png("transitions.png")
|
|
346
354
|
```
|
|
347
355
|
|
|
356
|
+
Here is the resulting graph for the above schema.
|
|
357
|
+
|
|
358
|
+
<p align="center">
|
|
359
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/transitions.png" alt="pydot">
|
|
360
|
+
</p>
|
|
361
|
+
|
|
348
362
|
You can pass the same version selector used by parsing, and hide upward links
|
|
349
363
|
for a simpler tree-like graph:
|
|
350
364
|
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
</div>
|
|
12
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
|
-
|
|
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
16
|
messages against that structure.
|
|
17
17
|
|
|
18
18
|
## Highlights
|
|
19
19
|
|
|
20
20
|
- Define EDIFACT syntax trees directly in Python.
|
|
21
|
+
- Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
|
|
21
22
|
- Attach parsing callbacks to the segments you care about.
|
|
22
23
|
- Select schemas by message version.
|
|
23
|
-
- Model conditional, mandatory, and repeatable segments.
|
|
24
24
|
- Handle escaped EDIFACT separators and EBCDIC control characters.
|
|
25
25
|
- Properly tokenize segments with specified lengths like `BLB`
|
|
26
26
|
- Export transition graphs with `pydot`.
|
|
@@ -84,16 +84,21 @@ REF+3'
|
|
|
84
84
|
UNT+19+1'
|
|
85
85
|
"""
|
|
86
86
|
|
|
87
|
+
# Create the parser and parse this EDIFACT message.
|
|
88
|
+
# The `summary` attribute is populated by the callbacks.
|
|
87
89
|
parser = PIZZAQParser()
|
|
88
90
|
parser.parse(edi)
|
|
91
|
+
parser.summary # {"MARGARITA": 2, "PESTO": 1}
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
# Validate and pretty-print the message.
|
|
94
|
+
PIZZAQParser.validate(edi) # True/False
|
|
95
|
+
PIZZAQParser.show(edi) # to print
|
|
93
96
|
```
|
|
94
97
|
|
|
98
|
+
Here is the output of `PIZZAQParser.show(edi)`.
|
|
99
|
+
|
|
95
100
|
<div align="center">
|
|
96
|
-
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="
|
|
101
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="364" alt="Edison">
|
|
97
102
|
<p><strong>Tree-based structure.</strong></p>
|
|
98
103
|
</div>
|
|
99
104
|
|
|
@@ -293,9 +298,12 @@ finishes.
|
|
|
293
298
|
<details>
|
|
294
299
|
<summary>Transition graphs</summary>
|
|
295
300
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
Internally, Edison builds a directed graph of transitions between segments, when the parser class is created.
|
|
302
|
+
Each node is a specific segment, and each edge is a valid transition to the next segment.
|
|
303
|
+
With this, parsing is just a walk through the graph, and validation is checking if the path exists.
|
|
304
|
+
|
|
305
|
+
You can visualize the transition graph with `build_dot_object()`, which returns a `pydot.Dot` object.
|
|
306
|
+
`pydot` is installed with Edison. To write PNG files, make sure Graphviz is available on your system.
|
|
299
307
|
|
|
300
308
|
```python
|
|
301
309
|
from edison import BaseParser
|
|
@@ -320,6 +328,12 @@ dot = Parser.build_dot_object()
|
|
|
320
328
|
dot.write_png("transitions.png")
|
|
321
329
|
```
|
|
322
330
|
|
|
331
|
+
Here is the resulting graph for the above schema.
|
|
332
|
+
|
|
333
|
+
<p align="center">
|
|
334
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/transitions.png" alt="pydot">
|
|
335
|
+
</p>
|
|
336
|
+
|
|
323
337
|
You can pass the same version selector used by parsing, and hide upward links
|
|
324
338
|
for a simpler tree-like graph:
|
|
325
339
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edison-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
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
|
|
@@ -36,16 +36,16 @@ Dynamic: license-file
|
|
|
36
36
|
</div>
|
|
37
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
|
-
|
|
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
41
|
messages against that structure.
|
|
42
42
|
|
|
43
43
|
## Highlights
|
|
44
44
|
|
|
45
45
|
- Define EDIFACT syntax trees directly in Python.
|
|
46
|
+
- Segments can define groups of child segments, which can be conditional, mandatory, or repeatable.
|
|
46
47
|
- Attach parsing callbacks to the segments you care about.
|
|
47
48
|
- Select schemas by message version.
|
|
48
|
-
- Model conditional, mandatory, and repeatable segments.
|
|
49
49
|
- Handle escaped EDIFACT separators and EBCDIC control characters.
|
|
50
50
|
- Properly tokenize segments with specified lengths like `BLB`
|
|
51
51
|
- Export transition graphs with `pydot`.
|
|
@@ -109,16 +109,21 @@ REF+3'
|
|
|
109
109
|
UNT+19+1'
|
|
110
110
|
"""
|
|
111
111
|
|
|
112
|
+
# Create the parser and parse this EDIFACT message.
|
|
113
|
+
# The `summary` attribute is populated by the callbacks.
|
|
112
114
|
parser = PIZZAQParser()
|
|
113
115
|
parser.parse(edi)
|
|
116
|
+
parser.summary # {"MARGARITA": 2, "PESTO": 1}
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
# Validate and pretty-print the message.
|
|
119
|
+
PIZZAQParser.validate(edi) # True/False
|
|
120
|
+
PIZZAQParser.show(edi) # to print
|
|
118
121
|
```
|
|
119
122
|
|
|
123
|
+
Here is the output of `PIZZAQParser.show(edi)`.
|
|
124
|
+
|
|
120
125
|
<div align="center">
|
|
121
|
-
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="
|
|
126
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/Image.png" width="364" alt="Edison">
|
|
122
127
|
<p><strong>Tree-based structure.</strong></p>
|
|
123
128
|
</div>
|
|
124
129
|
|
|
@@ -318,9 +323,12 @@ finishes.
|
|
|
318
323
|
<details>
|
|
319
324
|
<summary>Transition graphs</summary>
|
|
320
325
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
Internally, Edison builds a directed graph of transitions between segments, when the parser class is created.
|
|
327
|
+
Each node is a specific segment, and each edge is a valid transition to the next segment.
|
|
328
|
+
With this, parsing is just a walk through the graph, and validation is checking if the path exists.
|
|
329
|
+
|
|
330
|
+
You can visualize the transition graph with `build_dot_object()`, which returns a `pydot.Dot` object.
|
|
331
|
+
`pydot` is installed with Edison. To write PNG files, make sure Graphviz is available on your system.
|
|
324
332
|
|
|
325
333
|
```python
|
|
326
334
|
from edison import BaseParser
|
|
@@ -345,6 +353,12 @@ dot = Parser.build_dot_object()
|
|
|
345
353
|
dot.write_png("transitions.png")
|
|
346
354
|
```
|
|
347
355
|
|
|
356
|
+
Here is the resulting graph for the above schema.
|
|
357
|
+
|
|
358
|
+
<p align="center">
|
|
359
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/Edison/main/docs/transitions.png" alt="pydot">
|
|
360
|
+
</p>
|
|
361
|
+
|
|
348
362
|
You can pass the same version selector used by parsing, and hide upward links
|
|
349
363
|
for a simpler tree-like graph:
|
|
350
364
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|