summaryrefslogtreecommitdiff
path: root/timestamp.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2023-05-01 19:13:50 +0200
committerAnthon van der Neut <anthon@mnt.org>2023-05-01 19:13:50 +0200
commit8b731994b1543d7886af85f926d9eea5a22d0732 (patch)
tree3553d4cbc80b541484d7a3f39e00cdcfd8f9d030 /timestamp.py
parent45111ba0b67e8619265d89f3202635e62c13cde6 (diff)
downloadruamel.yaml-8b731994b1543d7886af85f926d9eea5a22d0732.tar.gz
retrofitted 0.18 changes
Diffstat (limited to 'timestamp.py')
-rw-r--r--timestamp.py35
1 files changed, 15 insertions, 20 deletions
diff --git a/timestamp.py b/timestamp.py
index 58eef04..4ab695f 100644
--- a/timestamp.py
+++ b/timestamp.py
@@ -6,38 +6,33 @@ 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
+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 __init__(self, *args: Any, **kw: Any) -> None:
+ self._yaml: Dict[Any, Any] = dict(t=False, tz=None, delta=0)
- def __new__(cls, *args, **kw): # datetime is immutable
- # type: (Any, Any) -> Any
+ def __new__(cls, *args: Any, **kw: Any) -> Any: # datetime is immutable
return datetime.datetime.__new__(cls, *args, **kw)
- def __deepcopy__(self, memo):
- # type: (Any) -> Any
+ def __deepcopy__(self, memo: Any) -> Any:
ts = TimeStamp(self.year, self.month, self.day, self.hour, self.minute, self.second)
ts._yaml = copy.deepcopy(self._yaml)
return ts
def replace(
self,
- year=None,
- month=None,
- day=None,
- hour=None,
- minute=None,
- second=None,
- microsecond=None,
- tzinfo=True,
- fold=None,
- ):
- # type: (Any, Any, Any, Any, Any, Any, Any, Any, Any) -> Any
+ year: Any = None,
+ month: Any = None,
+ day: Any = None,
+ hour: Any = None,
+ minute: Any = None,
+ second: Any = None,
+ microsecond: Any = None,
+ tzinfo: Any = True,
+ fold: Any = None,
+ ) -> Any:
if year is None:
year = self.year
if month is None: