comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # coding: utf-8
2
3 from __future__ import print_function, absolute_import, division, unicode_literals
4
5 import datetime
6 import copy
7
8 # ToDo: at least on PY3 you could probably attach the tzinfo correctly to the object
9 # a more complete datetime might be used by safe loading as well
10
11 if False: # MYPY
12 from typing import Any, Dict, Optional, List # NOQA
13
14
15 class TimeStamp(datetime.datetime):
16 def __init__(self, *args, **kw):
17 # type: (Any, Any) -> None
18 self._yaml = dict(t=False, tz=None, delta=0) # type: Dict[Any, Any]
19
20 def __new__(cls, *args, **kw): # datetime is immutable
21 # type: (Any, Any) -> Any
22 return datetime.datetime.__new__(cls, *args, **kw) # type: ignore
23
24 def __deepcopy__(self, memo):
25 # type: (Any) -> Any
26 ts = TimeStamp(self.year, self.month, self.day, self.hour, self.minute, self.second)
27 ts._yaml = copy.deepcopy(self._yaml)
28 return ts