time-split 1.1.0__tar.gz → 1.1.1__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.
Files changed (39) hide show
  1. {time_split-1.1.0 → time_split-1.1.1}/PKG-INFO +1 -1
  2. {time_split-1.1.0 → time_split-1.1.1}/pyproject.toml +1 -1
  3. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/__init__.py +1 -1
  4. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_schedule.py +10 -2
  5. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_splitter.py +1 -1
  6. {time_split-1.1.0 → time_split-1.1.1}/LICENSE.md +0 -0
  7. {time_split-1.1.0 → time_split-1.1.1}/README.md +0 -0
  8. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/__main__.py +0 -0
  9. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/__init__.py +0 -0
  10. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_datetime_index_like.py +0 -0
  11. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_limits.py +0 -0
  12. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_process_available.py +0 -0
  13. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_backend/_span.py +0 -0
  14. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_docstrings.py +0 -0
  15. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/__init__.py +0 -0
  16. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/_plot.py +0 -0
  17. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/_progress.py +0 -0
  18. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/_split.py +0 -0
  19. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/_to_string.py +0 -0
  20. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_frontend/_weight.py +0 -0
  21. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/_support.py +0 -0
  22. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/app/__init__.py +0 -0
  23. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/app/_create_explorer_link.py +0 -0
  24. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/app/reexport/__init__.py +0 -0
  25. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/cli.py +0 -0
  26. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/__init__.py +0 -0
  27. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/_log_progress.py +0 -0
  28. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/base.py +0 -0
  29. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/pandas/__init__.py +0 -0
  30. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/pandas/_impl.py +0 -0
  31. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/polars/__init__.py +0 -0
  32. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/polars/_impl.py +0 -0
  33. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/sklearn/__init__.py +0 -0
  34. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/integration/sklearn/_impl.py +0 -0
  35. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/py.typed +0 -0
  36. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/settings.py +0 -0
  37. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/support/__init__.py +0 -0
  38. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/support/types.py +0 -0
  39. {time_split-1.1.0 → time_split-1.1.1}/src/time_split/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: time-split
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Time-based k-fold validation splits for heterogeneous data.
5
5
  License: MIT
6
6
  License-File: LICENSE.md
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "time-split"
3
- version = "1.1.0"
3
+ version = "1.1.1"
4
4
  description = "Time-based k-fold validation splits for heterogeneous data."
5
5
  authors = [
6
6
  { name = "Richard Sundqvist", email = "richard.sundqvist@live.se" },
@@ -9,4 +9,4 @@ __all__ = [
9
9
  "split",
10
10
  ]
11
11
 
12
- __version__ = "1.1.0"
12
+ __version__ = "1.1.1"
@@ -1,4 +1,4 @@
1
- from typing import NamedTuple, get_args
1
+ from typing import Literal, NamedTuple, get_args
2
2
 
3
3
  from pandas import DatetimeIndex, NaT, Timedelta, Timestamp, date_range
4
4
 
@@ -8,6 +8,7 @@ from ._limits import LimitsTuple
8
8
  from ._process_available import ProcessAvailableResult, process_available
9
9
 
10
10
  NO_LIMITS: LimitsTuple = NaT, NaT
11
+ ScheduleType = Literal["cron", "explicit", "timedelta"]
11
12
 
12
13
 
13
14
  class MaterializedSchedule(NamedTuple):
@@ -15,6 +16,7 @@ class MaterializedSchedule(NamedTuple):
15
16
 
16
17
  schedule: DatetimeIndex
17
18
  available_metadata: ProcessAvailableResult
19
+ schedule_type: ScheduleType
18
20
 
19
21
 
20
22
  def materialize_schedule(
@@ -26,6 +28,7 @@ def materialize_schedule(
26
28
  return MaterializedSchedule(
27
29
  DatetimeIndex(schedule),
28
30
  available_metadata=ProcessAvailableResult(None, NO_LIMITS, NO_LIMITS),
31
+ schedule_type="explicit",
29
32
  )
30
33
  except TypeError as e:
31
34
  raise ValueError("Schedule must be explicit when not bounded by an available range.") from e
@@ -33,17 +36,22 @@ def materialize_schedule(
33
36
  available_metadata = process_available(available, expand_limits=expand_limits)
34
37
  min_dt, max_dt = available_metadata.expanded_limits
35
38
 
39
+ schedule_type: ScheduleType
36
40
  if isinstance(schedule, str) and _cron_like(schedule):
37
41
  schedule = _handle_cron(schedule, min_dt, max_dt)
42
+ schedule_type = "cron"
38
43
  elif isinstance(schedule, get_args(TimedeltaTypes)):
39
44
  schedule = _from_timedelta(schedule, available_metadata.expanded_limits)
45
+ schedule_type = "timedelta"
40
46
  else:
41
47
  if not isinstance(schedule, DatetimeIndex):
42
48
  schedule = DatetimeIndex(schedule)
43
49
 
44
50
  schedule = schedule.tz_localize(min_dt.tz) if schedule.tz is None else schedule.tz_convert(min_dt.tz)
45
51
  schedule = schedule[(min_dt <= schedule) & (schedule <= max_dt)]
46
- return MaterializedSchedule(schedule, available_metadata=available_metadata)
52
+ schedule_type = "explicit"
53
+
54
+ return MaterializedSchedule(schedule, available_metadata, schedule_type)
47
55
 
48
56
 
49
57
  def _cron_like(schedule: str) -> bool:
@@ -53,7 +53,7 @@ class DatetimeIndexSplitter:
53
53
  if (
54
54
  settings.snap_to_end
55
55
  and self.after != "all"
56
- and isinstance(self.schedule, types)
56
+ and ms.schedule_type == "timedelta"
57
57
  and isinstance(self.after, (types, int))
58
58
  ):
59
59
  ms = self._snap_to_end(ms)
File without changes
File without changes