none-shall-parse 0.4.8__tar.gz → 0.5.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.
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/PKG-INFO +1 -1
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/pyproject.toml +1 -1
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/dates.py +16 -6
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/README.md +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/__init__.py +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/imeis.py +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/lists.py +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/parse.py +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/strings.py +0 -0
- {none_shall_parse-0.4.8 → none_shall_parse-0.5.0}/src/none_shall_parse/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: none-shall-parse
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Trinity Shared Python utilities.
|
|
5
5
|
Author: Andries Niemandt, Jan Badenhorst
|
|
6
6
|
Author-email: Andries Niemandt <andries.niemandt@trintel.co.za>, Jan Badenhorst <jan@trintel.co.za>
|
|
@@ -518,13 +518,21 @@ def unroll_span_func(
|
|
|
518
518
|
DateUtilsError: If the date range cannot be processed due to invalid dates or formatting.
|
|
519
519
|
"""
|
|
520
520
|
cover = pendulum.now() if cover is None else cover
|
|
521
|
-
|
|
521
|
+
|
|
522
522
|
try:
|
|
523
523
|
start, end = f(cover)
|
|
524
524
|
start = pendulum.instance(start)
|
|
525
|
-
start = start.naive() if naive else start
|
|
526
525
|
end = pendulum.instance(end)
|
|
527
|
-
|
|
526
|
+
|
|
527
|
+
# Determine naiveness from the dates returned by f, not from cover
|
|
528
|
+
naive = start.tzinfo is None
|
|
529
|
+
if naive:
|
|
530
|
+
start = start.naive()
|
|
531
|
+
end = end.naive()
|
|
532
|
+
|
|
533
|
+
# Get actual current time for filtering future dates (always "now", not cover)
|
|
534
|
+
current_date_sentinel = pendulum.now().naive() if naive else pendulum.now()
|
|
535
|
+
|
|
528
536
|
except Exception as e:
|
|
529
537
|
raise DateUtilsError(f"Function f failed to compute date range: {str(e)}")
|
|
530
538
|
|
|
@@ -537,9 +545,11 @@ def unroll_span_func(
|
|
|
537
545
|
ord_days = []
|
|
538
546
|
iso_date_strings = []
|
|
539
547
|
for dt in interval.range(unit="days"):
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
548
|
+
# Filter: only include dates up to today (not future dates)
|
|
549
|
+
if dt <= current_date_sentinel and dt < end:
|
|
550
|
+
date_range.append(dt)
|
|
551
|
+
ord_days.append(dt.day_of_year)
|
|
552
|
+
iso_date_strings.append(dt.format('YYYY-MM-DD'))
|
|
543
553
|
|
|
544
554
|
return date_range, ord_days, iso_date_strings, start, end
|
|
545
555
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|