Skip to content
Snippets Groups Projects
Commit 813bc581 authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Use current time as the default timestamp.

parent 009028c8
Branches
Tags
No related merge requests found
Pipeline #378 skipped
......@@ -10,7 +10,7 @@ def contents(*filenames):
setup(
name = "yangson",
packages = ["yangson"],
version = "0.1.39",
version = "0.1.40",
description = "Library for working with YANG schemas and data",
author = "Ladislav Lhotka",
author_email = "lhotka@nic.cz",
......
......@@ -14,12 +14,12 @@ Value = Union[ScalarValue, "ArrayValue", "ObjectValue"]
class StructuredValue:
"""Abstract class for array and object values."""
def __init__(self, ts: datetime = None) -> None:
def __init__(self, ts: datetime) -> None:
"""Initialize class instance.
:param ts: creation timestamp
"""
self.timestamp = ts
self.timestamp = ts if ts else datetime.now()
def stamp(self) -> None:
"""Update the receiver's timestamp to current time."""
......
......@@ -313,7 +313,6 @@ class InternalNode(SchemaNode):
if ch is None:
raise NonexistentSchemaNode(cn[0], cn[1] if cn[1] else self.ns)
res[ch.instance_name()] = ch.from_raw(val[qn])
res.stamp()
return res
def _ascii_tree(self, indent: str) -> str:
......@@ -445,7 +444,6 @@ class SequenceNode(DataNode):
res = ArrayValue([])
for en in val:
res.append(self._entry_from_raw(en))
res.stamp()
return res
def _entry_from_raw(self, val: RawValue) -> Value:
......
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