crython/field¶
Contains functionality for representing an individual field within an expression.
-
class
crython.field.CronField(value, name, min, max, specials)¶ Represents an individual field of a cron expression.
-
classmethod
new(value, name, *args, **kwargs)¶ Create a new
CronFieldinstance from the given value.- Parameters
value – Value to create field from.
name – Name of the column this field represents within an expression.
args – Additional positional args
kwargs – Additional keyword args
- Returns
-
classmethod
from_number(value, name, min, max, specials, *args, **kwargs)¶ Create a new
CronFieldinstance from the given numeric value.- Parameters
value – A
intvalue.name – Name of the column this field represents within an expression.
min – Lower bound for the value, inclusive
max – Upper bound for the value, inclusive
specials – Set of special characters valid for this field type
args – Additional positional args
kwargs – Additional keyword args
- Returns
-
classmethod
from_str(value, name, min, max, specials, *args, **kwargs)¶ Create a new
CronFieldinstance from the given string value.- Parameters
value – A
strvalue.name – Name of the column this field represents within an expression.
min – Lower bound for the value, inclusive
max – Upper bound for the value, inclusive
specials – Set of special characters valid for this field type
args – Additional positional args
kwargs – Additional keyword args
- Returns
-
classmethod
from_iterable(value, name, min, max, specials, *args, **kwargs)¶ Create a new
CronFieldinstance from the givenIterablevalue.- Parameters
value – A
Iterablevalue.name – Name of the column this field represents within an expression.
min – Lower bound for the value, inclusive
max – Upper bound for the value, inclusive
specials – Set of special characters valid for this field type
args – Additional positional args
kwargs – Additional keyword args
- Returns
-
matches(item)¶ Check to see if the given time is ‘within’ the “time” denoted by this individual field.
..todo:: Recomputing this isn’t very efficient. Consider converting the field or expression to a datetime or timedelta instance.
-
classmethod
-
crython.field.second(value, *, name='second', **kwargs)¶ Partial for creating a
CronFieldthat represents the “second”.
-
crython.field.minute(value, *, name='minute', **kwargs)¶ Partial for creating a
CronFieldthat represents the “minute”.
-
crython.field.hour(value, *, name='hour', **kwargs)¶ Partial for creating a
CronFieldthat represents the “hour”.
-
crython.field.day(value, *, name='day', **kwargs)¶ Partial for creating a
CronFieldthat represents the “day of month”.
-
crython.field.month(value, *, name='month', **kwargs)¶ Partial for creating a
CronFieldthat represents the “day of month”.
-
crython.field.weekday(value, *, name='weekday', **kwargs)¶ Partial for creating a
CronFieldthat represents the “day of week”.
-
crython.field.year(value, *, name='year', **kwargs)¶ Partial for creating a
CronFieldthat represents the “year”.
-
crython.field.partials¶ Mapping of field name to the partial that create one of that field “type”.