crython/expression¶
Contains functionality for representing a single cron expression.
-
class
crython.expression.
CronExpression
(second, minute, hour, day, month, weekday, year, reboot=False, logger=None)¶ Represents an entire cron expression.
An expression consists of seven, space delimited fields that represent the following values:
+------------- second (0 - 59) | +------------- minute (0 - 59) | | +------------- hour (0 - 23) | | | +------------- day (1 - 31) | | | | +------------- month (1 - 12) | | | | | +------------- weekday (0 - 6) (Sunday to Saturday; 7 is also Sunday) | | | | | | +------------- year (1970 - 2099) | | | | | | | | | | | | | | * * * * * * *
-
classmethod
new
(expression=None, **kwargs)¶ Create a
CronExpression
instance from the given expression string or field values.Parameters: - expression – (Optional) A string that can be converted to a cron expression.
- kwargs – (Optional) A dict that maps field names to values.
Returns: A
CronExpression
that represents the given string or field values.
-
classmethod
from_str
(expression, reboot_sentinel=<object object>)¶ Create a
CronExpression
instance from the given cron expression string.Parameters: - expression – A string that can be converted to a cron expression.
- reboot_sentinel – (Optional) Object that indicates the expression is a reboot; Default: REBOOT_SENTINEL
Returns: A
CronExpression
that represents the given string.
-
classmethod
from_kwargs
(**kwargs)¶ Create a
CronExpression
instance from the given dict of field name -> field value.Parameters: kwargs – A dict that maps field names to values. Returns: A CronExpression
that represents the given dict.
-
classmethod
from_reboot
()¶ Create a
CronExpression
instance that indicates it’s a “reboot” expression. A “reboot” expression means that it should be executed during startup and as soon as possible.Returns: A CronExpression
that represents a “reboot”.
-
is_reboot
¶ Return True if this expression represents a reboot; False otherwise.
-
classmethod