Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/ruamel/yaml/timestamp.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:32:28 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d30785e31577 | 1:56ad4e20f292 |
---|---|
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 |