comparison env/lib/python3.7/site-packages/ruamel/yaml/timestamp.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
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