Add NLP, scheduler, generator, and describer modules
Some checks failed
CI / test (push) Failing after 9s
Some checks failed
CI / test (push) Failing after 9s
This commit is contained in:
23
src/cronparse/describer.py
Normal file
23
src/cronparse/describer.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
"""Cron expression description module using cron-descriptor."""
|
||||||
|
|
||||||
|
from typing import Optional
|
||||||
|
from cron_descriptor import Options, DescriptionTypeEnum
|
||||||
|
|
||||||
|
|
||||||
|
def describe_cron(expression: str, use_24h: bool = False) -> str:
|
||||||
|
"""Describe a cron expression in human-readable language.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
expression: The cron expression.
|
||||||
|
use_24h: Whether to use 24-hour time format.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Human-readable description of the cron expression.
|
||||||
|
"""
|
||||||
|
options = Options()
|
||||||
|
options.use_24hour_time_format = use_24h
|
||||||
|
options.description_type = DescriptionTypeEnum.FULL
|
||||||
|
|
||||||
|
from cron_descriptor import get_description
|
||||||
|
description = get_description(expression, options)
|
||||||
|
return description
|
||||||
Reference in New Issue
Block a user