diff env/lib/python3.9/site-packages/ruamel/yaml/timestamp.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.9/site-packages/ruamel/yaml/timestamp.py	Mon Mar 22 18:12:50 2021 +0000
@@ -0,0 +1,28 @@
+# coding: utf-8
+
+from __future__ import print_function, absolute_import, division, unicode_literals
+
+import datetime
+import copy
+
+# ToDo: at least on PY3 you could probably attach the tzinfo correctly to the object
+#       a more complete datetime might be used by safe loading as well
+
+if False:  # MYPY
+    from typing import Any, Dict, Optional, List  # NOQA
+
+
+class TimeStamp(datetime.datetime):
+    def __init__(self, *args, **kw):
+        # type: (Any, Any) -> None
+        self._yaml = dict(t=False, tz=None, delta=0)  # type: Dict[Any, Any]
+
+    def __new__(cls, *args, **kw):  # datetime is immutable
+        # type: (Any, Any) -> Any
+        return datetime.datetime.__new__(cls, *args, **kw)  # type: ignore
+
+    def __deepcopy__(self, memo):
+        # type: (Any) -> Any
+        ts = TimeStamp(self.year, self.month, self.day, self.hour, self.minute, self.second)
+        ts._yaml = copy.deepcopy(self._yaml)
+        return ts