clockwork 0.1.4__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clockwork-0.1.4 → clockwork-0.2.0}/PKG-INFO +1 -1
- clockwork-0.2.0/clockwork/__init__.py +4 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/_base.py +1 -1
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/core.py +9 -1
- {clockwork-0.1.4 → clockwork-0.2.0}/pyproject.toml +1 -1
- clockwork-0.1.4/clockwork/__init__.py +0 -4
- {clockwork-0.1.4 → clockwork-0.2.0}/LICENSE +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/README.md +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/_month_end.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/_quarter_end.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/__init__.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/_scheduler.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/_task.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/file_monitor.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/logger.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/taskmaster.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/taskmaster/utils.py +0 -0
- {clockwork-0.1.4 → clockwork-0.2.0}/clockwork/utils.py +0 -0
|
@@ -325,7 +325,7 @@ class DateBase(object):
|
|
|
325
325
|
components = ['%Y-%m-%d']
|
|
326
326
|
if self.dt.hour + self.dt.second + self.dt.microsecond > 0:
|
|
327
327
|
components.append('%I:%M:%S.%f %p')
|
|
328
|
-
return self.str(' '.join(components))
|
|
328
|
+
return self.__class__.__name__ + '(%s)' % self.str(' '.join(components))
|
|
329
329
|
|
|
330
330
|
def __int__(self):
|
|
331
331
|
return self.timestamp
|
|
@@ -12,7 +12,7 @@ from ._month_end import MonthEnd
|
|
|
12
12
|
#| Functions |
|
|
13
13
|
#╰-------------------------------------------------------------------------╯
|
|
14
14
|
|
|
15
|
-
def Date(arg=None, normalize=False, week_offset=0):
|
|
15
|
+
def Date(arg=None, normalize=False, format=None, week_offset=0):
|
|
16
16
|
'''
|
|
17
17
|
Description
|
|
18
18
|
------------
|
|
@@ -35,6 +35,8 @@ def Date(arg=None, normalize=False, week_offset=0):
|
|
|
35
35
|
• DateBase object or DateBase polymorphism
|
|
36
36
|
normalize : bool
|
|
37
37
|
if True, only the year, month, and day are retained (hours, minutes, seconds, microseconds are set to zero)
|
|
38
|
+
format : str
|
|
39
|
+
if 'arg' is a string, this format is used to parse it (e.g. '%Y%m%d %H%S').
|
|
38
40
|
week_offset : int
|
|
39
41
|
by default, if a day of the week is supplied (e.g. 'Monday') then the date returned will be that day of the week
|
|
40
42
|
for the current week. This argument is used to override this behavior by shifting the week backwards or forwards
|
|
@@ -70,6 +72,12 @@ def Date(arg=None, normalize=False, week_offset=0):
|
|
|
70
72
|
return out
|
|
71
73
|
|
|
72
74
|
|
|
75
|
+
if format is not None:
|
|
76
|
+
if not isinstance(arg, str):
|
|
77
|
+
raise TypeError(f"When 'format' argument is not None, 'arg' must be a string, not {type(arg)}.")
|
|
78
|
+
arg = DateBase.to_datetime(arg, format=format)
|
|
79
|
+
return Date(arg, normalize=normalize)
|
|
80
|
+
|
|
73
81
|
if arg is None:
|
|
74
82
|
dt = datetime.datetime.now()
|
|
75
83
|
elif hasattr(arg, 'to_pydatetime'): # pandas
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|