time_split.settings#
Global settings for the splitting logic.
Classes
Configuration for the 'auto' |
|
Global settings for the |
|
|
Miscellaneous settings that don't fit in any other namespace. |
|
Global settings for the |
- class auto_expand_limits[source]#
Bases:
objectConfiguration for the ‘auto’
ExpandLimitslogic.This class determines how
(min, max)-tuples are expanded when expanded limits are enabled.- SANITY_CHECK: bool = True#
If
True, use original limits if expanded limits do not pass sanity checks.
- classmethod set_level(level: Literal['hour', 'day'], *, start_at: str | Timedelta | timedelta | timedelta64, round_to: str | Timedelta | timedelta | timedelta64, tolerance: str | Timedelta | timedelta | timedelta64) None[source]#
Set a
Levelused by the auto-expand_limits logic.Inputs are not verified until an actual split is made.
- Parameters:
level – The level to set; ‘hour’ or ‘day’.
start_at – Span size at which this level starts.
round_to – Frequency to round the range limits to.
tolerance – Maximum amount by which to alter limits.
- Raises:
AttributeError – For unknown level names.
- class Level(start_at: str | Timedelta | timedelta | timedelta64, round_to: str | Timedelta | timedelta | timedelta64, tolerance: str | Timedelta | timedelta | timedelta64)[source]#
Bases:
NamedTupleLevel type used by
auto_expand_limits.- start_at: str | Timedelta | timedelta | timedelta64#
Span size at which this level starts.
- round_to: str | Timedelta | timedelta | timedelta64#
Frequency to round the range limits to.
- tolerance: str | Timedelta | timedelta | timedelta64#
Maximum amount by which to alter limits.
- class plot[source]#
Bases:
objectGlobal settings for the
time_split.plot()-function.- THOUSANDS_SEPARATOR_CUTOFF: int = 10000#
Minimum value before bar_labels include a
THOUSANDS_SEPARATOR.
- class log_split_progress[source]#
Bases:
objectGlobal settings for the
log_split_progress()-function.- FOLD_FORMAT: str = "'{start.auto}' <= [schedule: '{mid.auto}' ({mid:%A})] < '{end.auto}'"#
Pretty-printed fold-key for other messages.
Only the
start,mid, andendkeys are available (seeDatetimeSplitBounds). You may use<key>.autoto format as a date when time is zero (this is the default).
Sample output.#'2021-12-30' <= [schedule: '2022-01-04' (Tuesday)] < '2022-01-04 18:00:00'
- SECONDS_FORMATTER: Callable[[float], str] | None = None#
A callable
(seconds) -> formatted_seconds. Userics.strings.format_seconds()ifNone.Both
secondsandformatted_secondswill be available to theEND_MESSAGEmessage.
- START_MESSAGE: str = 'Begin fold {n}/{n_splits}: {fold}.'#
Message indicating that the current fold has been yielded to the user.
Has access to all keys from the previous section, as well as:
The
foldkey (seeFOLD_FORMAT), andThe
nkey, which is the 1-based position of the fold in splits, andThe
n_foldskey, which is justlen(splits).
Sample output.#Begin fold 5/7: '2021-12-30' <= [schedule: '2022-01-04' (Tuesday)] < '2022-01-04 18:00:00'.
- END_MESSAGE: str = "Finished fold {n}/{n_splits}: [schedule: '{mid.auto}' ({mid:%A})] after {formatted_seconds}."#
Message indicating that the user is done with the current fold.
Has access to all keys from the previous sections, as well as:
The
secondskey, which is the (fractional) time the user spent in the fold, andThe
formatted_secondskey, obtained using theSECONDS_FORMATTER.
The value of
secondsis obtained usingtime.perf_counter().Sample output.#Finished fold 5/7: [schedule: '2022-01-04' (Tuesday)] after 5m 21s.
- AUTO_DATE_FORMAT = '%Y-%m-%d'#
Short-form timestamp format_spec used by
<key>.auto.
- AUTO_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'#
Long-form timestamp format_spec used by
<key>.auto.
- class misc[source]#
Bases:
objectMiscellaneous settings that don’t fit in any other namespace.
- snap_to_end: bool = True#
Controls alignment of timedelta-based splits.
Note
Active only when both schedule and after are
TimedeltaTypes.If
True, ensure that the Future data of the final fold ends at the rightmost edge of the available data range. Otherwise, alignment is determined bypandas.date_range().
- filter: Callable[[Timestamp, Timestamp, Timestamp], bool] | None = None#
A callable
(start, mid, end) -> boolapplied to all generated folds.
- round_limits: bool = False#
If
True, use rounding instead offloorandceilfor limits expansion.Normally, limits such as
>>> ('2019-04-10 23:55:00', '2019-05-12 01:00:00')
will never be rounded to
>>> ('2019-04-11', '2019-05-12')
since that wouldn’t be an expansion of the limits. Setting
round_limits=Truewill allow theexpand_limits()function round these bounds inward to the nearest dates.