Skip to content

Commit a1d7339

Browse files
author
Binh Vu
committed
fix bugs in pydrepr
1 parent 05d5ac4 commit a1d7339

File tree

8 files changed

+22
-383
lines changed

8 files changed

+22
-383
lines changed

pydrepr/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ __pycache__
55
.*
66
!.gitignore
77
drepr.egg-info
8-
dist
8+
dist
9+
download-executed-*.txt

pydrepr/Pipfile

-15
This file was deleted.

pydrepr/Pipfile.lock

-356
This file was deleted.

pydrepr/drepr/models/parse_v1/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def dump(cls, drepr: 'DRepr', simplify: bool = True, use_json_path: bool = False
8383

8484
for node in drepr.sm.nodes.values():
8585
if isinstance(node, DataNode):
86-
edge = [e for e in drepr.sm.edges if e.target_id == node.node_id][0]
86+
edge = [e for e in drepr.sm.edges.values() if e.target_id == node.node_id][0]
8787
sm['data_nodes'][
8888
node.
8989
attr_id] = f"{class_ids[drepr.sm.nodes[edge.source_id].label][edge.source_id]}--{edge.label}"
@@ -98,7 +98,7 @@ def dump(cls, drepr: 'DRepr', simplify: bool = True, use_json_path: bool = False
9898
if node.data_type is not None:
9999
sm['literal_nodes'][-1] += f"^^{node.data_type.value}"
100100

101-
for edge in drepr.sm.edges:
101+
for edge in drepr.sm.edges.values():
102102
if isinstance(drepr.sm.nodes[edge.source_id], ClassNode) and isinstance(
103103
drepr.sm.nodes[edge.target_id], ClassNode):
104104
sm['relations'].append(

pydrepr/drepr/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "2.4" # ___PKG_VERSION___: DO NOT MODIFY the version here. Update it via version_manager.py!
1+
__version__ = "2.5" # ___PKG_VERSION___: DO NOT MODIFY the version here. Update it via version_manager.py!
22
__engine_version__ = "1.0.6" # ___PKG_VERSION___: DO NOT MODIFY the version here. Update it via version_manager.py!
33
__engine_release_tag__ = "2.3" # ___PKG_VERSION___: DO NOT MODIFY the version here. Update it via version_manager.py!

pydrepr/setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
python_requires='>3.6',
4545
license="MIT",
4646
install_requires=['ujson', 'ruamel.yaml>=0.15.0',
47-
'dataclasses;python_version<"3.7"', 'xmltodict'],
47+
'dataclasses;python_version<"3.7"', 'xmltodict', 'netcdf4',
48+
'pillow'],
4849
package_data={'': ['*.so', '*.pyd']})

pydrepr/tests/drepr/models/test_drepr.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -209,32 +209,40 @@ def test_serialize():
209209
}
210210
],
211211
'sm': {
212-
'edges': [
213-
{
212+
'edges': {
213+
0: {
214+
'edge_id': 0,
215+
'is_required': False,
214216
'is_subject': False,
215217
'label': 'eg:refArea',
216218
'source_id': 'qb:Observation:1',
217219
'target_id': 'dnode:area'
218220
},
219-
{
221+
1: {
222+
'edge_id': 1,
223+
'is_required': False,
220224
'is_subject': False,
221225
'label': 'eg:gender',
222226
'source_id': 'qb:Observation:1',
223227
'target_id': 'dnode:gender'
224228
},
225-
{
229+
2: {
230+
'edge_id': 2,
231+
'is_required': False,
226232
'is_subject': False,
227233
'label': 'eg:refPeriod',
228234
'source_id': 'qb:Observation:1',
229235
'target_id': 'dnode:period'
230236
},
231-
{
237+
3: {
238+
'edge_id': 3,
239+
'is_required': False,
232240
'is_subject': False,
233241
'label': 'smdx-measure:obsValue',
234242
'source_id': 'qb:Observation:1',
235243
'target_id': 'dnode:obs'
236244
}
237-
],
245+
},
238246
'nodes': {
239247
'dnode:area': {
240248
'type': 'data_node',

version_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# ================================================================================
66
# Note: update the version by changing variables before the `=...=` line
7-
DREPR_PYLIB_VESRION = "2.4"
7+
DREPR_PYLIB_VESRION = "2.5"
88
DREPR_ENGINE_VERSION = "1.0.6"
99
# this tag marks the release which contains the pre-built engine in it.
1010
DREPR_ENGINE_RELEASE_TAG = "2.3"

0 commit comments

Comments
 (0)