comparison env/lib/python3.7/site-packages/ruamel/yaml/timestamp.py @ 2:6af9afd405e9 draft

"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author shellac
date Thu, 14 May 2020 14:56:58 -0400
parents 26e78fe6e8c4
children
comparison
equal deleted inserted replaced
1:75ca89e9b81c 2:6af9afd405e9
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