opendate 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
Potentially problematic release.
This version of opendate might be problematic. Click here for more details.
- date/__init__.py +1 -1
- date/date.py +18 -1
- {opendate-0.1.4.dist-info → opendate-0.1.5.dist-info}/METADATA +2 -2
- opendate-0.1.5.dist-info/RECORD +7 -0
- opendate-0.1.4.dist-info/RECORD +0 -7
- {opendate-0.1.4.dist-info → opendate-0.1.5.dist-info}/LICENSE +0 -0
- {opendate-0.1.4.dist-info → opendate-0.1.5.dist-info}/WHEEL +0 -0
date/__init__.py
CHANGED
date/date.py
CHANGED
|
@@ -1438,18 +1438,35 @@ class Interval:
|
|
|
1438
1438
|
yield thedate
|
|
1439
1439
|
thedate = thedate.add(days=1)
|
|
1440
1440
|
|
|
1441
|
+
def start_of_series(self, unit='month') -> list[Date]:
|
|
1442
|
+
"""Return a series between and inclusive of begdate and enddate.
|
|
1443
|
+
|
|
1444
|
+
>>> Interval(Date(2018, 1, 5), Date(2018, 4, 5)).start_of_series('month')
|
|
1445
|
+
[Date(2018, 1, 1), Date(2018, 2, 1), Date(2018, 3, 1), Date(2018, 4, 1)]
|
|
1446
|
+
>>> Interval(Date(2018, 4, 30), Date(2018, 7, 30)).start_of_series('month')
|
|
1447
|
+
[Date(2018, 4, 1), Date(2018, 5, 1), Date(2018, 6, 1), Date(2018, 7, 1)]
|
|
1448
|
+
>>> Interval(Date(2018, 1, 5), Date(2018, 4, 5)).start_of_series('week')
|
|
1449
|
+
[Date(2018, 1, 1), Date(2018, 1, 8), ..., Date(2018, 4, 2)]
|
|
1450
|
+
"""
|
|
1451
|
+
begdate = self.begdate.start_of(unit)
|
|
1452
|
+
enddate = self.enddate.start_of(unit)
|
|
1453
|
+
interval = _pendulum.interval(begdate, enddate)
|
|
1454
|
+
return [Date.instance(d).start_of(unit) for d in interval.range(f'{unit}s')]
|
|
1455
|
+
|
|
1441
1456
|
def end_of_series(self, unit='month') -> list[Date]:
|
|
1442
1457
|
"""Return a series between and inclusive of begdate and enddate.
|
|
1443
1458
|
|
|
1444
1459
|
>>> Interval(Date(2018, 1, 5), Date(2018, 4, 5)).end_of_series('month')
|
|
1445
1460
|
[Date(2018, 1, 31), Date(2018, 2, 28), Date(2018, 3, 31), Date(2018, 4, 30)]
|
|
1461
|
+
>>> Interval(Date(2018, 4, 30), Date(2018, 7, 30)).end_of_series('month')
|
|
1462
|
+
[Date(2018, 4, 30), Date(2018, 5, 31), Date(2018, 6, 30), Date(2018, 7, 31)]
|
|
1446
1463
|
>>> Interval(Date(2018, 1, 5), Date(2018, 4, 5)).end_of_series('week')
|
|
1447
1464
|
[Date(2018, 1, 7), Date(2018, 1, 14), ..., Date(2018, 4, 8)]
|
|
1448
1465
|
"""
|
|
1449
1466
|
begdate = self.begdate.end_of(unit)
|
|
1450
1467
|
enddate = self.enddate.end_of(unit)
|
|
1451
1468
|
interval = _pendulum.interval(begdate, enddate)
|
|
1452
|
-
return [Date.instance(d) for d in interval.range(f'{unit}s')]
|
|
1469
|
+
return [Date.instance(d).end_of(unit) for d in interval.range(f'{unit}s')]
|
|
1453
1470
|
|
|
1454
1471
|
def days(self) -> int:
|
|
1455
1472
|
"""Return days between (begdate, enddate] or negative (enddate, begdate].
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
date/__init__.py,sha256=A3XyfTndgbAkc-rfT_InuuU9uORhPgGxUT_yEz-heOM,2747
|
|
2
|
+
date/date.py,sha256=K10ETuUqqhgFLU7backJGrItKqpZ97szDE0l6RWNKtY,55855
|
|
3
|
+
date/extras.py,sha256=7xsOsdhKrmGoyLl5W4Xhg9TfuytaaIH7uKWW9PvR5sE,2832
|
|
4
|
+
opendate-0.1.5.dist-info/LICENSE,sha256=V4Rx8WWy7v8Fim6PHcEBszpZkDLbCHeorz1e_gr0Cbk,1111
|
|
5
|
+
opendate-0.1.5.dist-info/METADATA,sha256=7PMv5fe7Hu2F3jc75ZE9nU2pXIpzU2ozOJfs0vs3DUE,1841
|
|
6
|
+
opendate-0.1.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
7
|
+
opendate-0.1.5.dist-info/RECORD,,
|
opendate-0.1.4.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
date/__init__.py,sha256=eB3ZluWh9M_QVfMOpmjeigLItgUl7mywdby88ffQfbE,2747
|
|
2
|
-
date/date.py,sha256=Z-8-5T8TfLtgiGe0ahK7QIgXjbBEDmrGRw8zEhiQD2Y,54819
|
|
3
|
-
date/extras.py,sha256=7xsOsdhKrmGoyLl5W4Xhg9TfuytaaIH7uKWW9PvR5sE,2832
|
|
4
|
-
opendate-0.1.4.dist-info/LICENSE,sha256=V4Rx8WWy7v8Fim6PHcEBszpZkDLbCHeorz1e_gr0Cbk,1111
|
|
5
|
-
opendate-0.1.4.dist-info/METADATA,sha256=up550EjO3j1IFI7F_iUrlugXe6rkcfpQpeRCQrEqgN8,1816
|
|
6
|
-
opendate-0.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
7
|
-
opendate-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|