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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: none-shall-parse
3
- Version: 0.4.8
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>
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "none-shall-parse"
7
- version = "0.4.8"
7
+ version = "0.5.0"
8
8
  description = "Trinity Shared Python utilities."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -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
- naive = cover.tzinfo is None
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
- end = end.naive() if naive else end
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
- date_range.append(dt)
541
- ord_days.append(dt.day_of_year)
542
- iso_date_strings.append(dt.format('YYYY-MM-DD'))
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