Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 24538438 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

- json serialization of Nodes done

parent 99c6fa7a
......@@ -143,7 +143,7 @@ class Error:
def from_json_obj(self, json_obj: Dict) -> Error:
"""Convert a json object representing an Error object back into an
Error object. Raises a ValueError, if json_obj does not represent
an error object"""
an Error object"""
if json_obj.get('__class__', '') != 'DHParser.Error':
raise ValueError('JSON object: ' + str(json_obj) +
' does not represent an Error object.')
......
......@@ -749,17 +749,34 @@ class Node: # (collections.abc.Sized): Base class omitted for cython-compatibil
def to_json_obj(self) -> Dict:
return { '__class__': 'DHParser.Nose',
'content': [ self.tag_name,
[child.to_json_obj() for child in self.children] if self.children
else self.result_,
self._pos,
self._xmlattr if self.attr_active() else None ] }
"""Seralize a node or tree as json-object"""
return { '__class__': 'DHParser.Node',
'data': [ self.tag_name,
[child.to_json_obj() for child in self.children] if self.children
else str(self.result_),
self._pos,
self._xmlattr if self.attr_active() else None ] }
@static
def from_json_obj(self, json_obj: Dict) -> Error:
pass
"""Convert a json object representing a node (or tree) back into a
Node object. Raises a ValueError, if `json_obj` does not represent
a node."""
if json_obj.get('__class__', '') != 'DHParser.Node':
raise ValueError('JSON object: ' + str(json_obj) +
' does not represent a Node object.')
tag_name, result, pos, attr = json_obj['data']
if isinstance(str):
leafhint = True
else:
leafhint = False
result = tuple(Node.from_json_obj(child) for child in result)
node = Node(tag_name, result, leafhint)
node._pos = pos
if attr:
node.attr = attr
return node
def serialize(node: Node, how: str='default') -> str:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment