opendate 0.1.9__tar.gz → 0.1.10__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.
Potentially problematic release.
This version of opendate might be problematic. Click here for more details.
- {opendate-0.1.9 → opendate-0.1.10}/PKG-INFO +1 -1
- {opendate-0.1.9 → opendate-0.1.10}/pyproject.toml +1 -1
- {opendate-0.1.9 → opendate-0.1.10}/src/date/__init__.py +1 -1
- {opendate-0.1.9 → opendate-0.1.10}/src/date/date.py +26 -12
- {opendate-0.1.9 → opendate-0.1.10}/LICENSE +0 -0
- {opendate-0.1.9 → opendate-0.1.10}/README.md +0 -0
- {opendate-0.1.9 → opendate-0.1.10}/src/date/extras.py +0 -0
|
@@ -1356,12 +1356,29 @@ class Interval:
|
|
|
1356
1356
|
set - set end=beg + num
|
|
1357
1357
|
- set set beg=end - num
|
|
1358
1358
|
|
|
1359
|
-
|
|
1359
|
+
Basic/legacy cases
|
|
1360
|
+
>>> Interval(Date(2014, 4, 3), None).b.range(3)
|
|
1360
1361
|
(Date(2014, 4, 3), Date(2014, 4, 8))
|
|
1361
1362
|
>>> Interval(None, Date(2014, 7, 27)).range(20)
|
|
1362
1363
|
(Date(2014, 7, 7), Date(2014, 7, 27))
|
|
1363
|
-
>>> Interval(None,
|
|
1364
|
+
>>> Interval(None, Date(2014, 7, 27)).b.range(20)
|
|
1364
1365
|
(Date(2014, 6, 27), Date(2014, 7, 27))
|
|
1366
|
+
|
|
1367
|
+
Do not modify dates if both are provided
|
|
1368
|
+
>>> Interval(Date(2024, 7, 25), Date(2024, 7, 25)).b.range(None)
|
|
1369
|
+
(Date(2024, 7, 25), Date(2024, 7, 25))
|
|
1370
|
+
>>> Interval(Date(2024, 7, 27), Date(2024, 7, 27)).b.range(None)
|
|
1371
|
+
(Date(2024, 7, 27), Date(2024, 7, 27))
|
|
1372
|
+
|
|
1373
|
+
Edge cases (7/27/24 is weekend)
|
|
1374
|
+
>>> Interval(Date(2024, 7, 27), None).b.range(0)
|
|
1375
|
+
(Date(2024, 7, 27), Date(2024, 7, 27))
|
|
1376
|
+
>>> Interval(None, Date(2024, 7, 27)).b.range(0)
|
|
1377
|
+
(Date(2024, 7, 27), Date(2024, 7, 27))
|
|
1378
|
+
>>> Interval(Date(2024, 7, 27), None).b.range(1)
|
|
1379
|
+
(Date(2024, 7, 27), Date(2024, 7, 29))
|
|
1380
|
+
>>> Interval(None, Date(2024, 7, 27)).b.range(1)
|
|
1381
|
+
(Date(2024, 7, 26), Date(2024, 7, 27))
|
|
1365
1382
|
"""
|
|
1366
1383
|
begdate, enddate = self.begdate, self.enddate
|
|
1367
1384
|
|
|
@@ -1375,17 +1392,14 @@ class Interval:
|
|
|
1375
1392
|
raise IntervalError('Missing begdate and enddate, window specified')
|
|
1376
1393
|
|
|
1377
1394
|
if begdate and enddate:
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
enddate).subtract(days=0)
|
|
1382
|
-
|
|
1383
|
-
if (not begdate and not enddate) or enddate:
|
|
1384
|
-
begdate = (enddate.business() if enddate._business else
|
|
1385
|
-
enddate).subtract(days=window)
|
|
1395
|
+
pass # do nothing if both provided
|
|
1396
|
+
elif (not begdate and not enddate) or enddate:
|
|
1397
|
+
begdate = enddate.subtract(days=window) if window else enddate
|
|
1386
1398
|
else:
|
|
1387
|
-
enddate =
|
|
1388
|
-
|
|
1399
|
+
enddate = begdate.add(days=window) if window else begdate
|
|
1400
|
+
|
|
1401
|
+
enddate._business = False
|
|
1402
|
+
begdate._business = False
|
|
1389
1403
|
|
|
1390
1404
|
return begdate, enddate
|
|
1391
1405
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|