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 CronField instance 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

A CronField

classmethod from_number(value, name, min, max, specials, *args, **kwargs)

Create a new CronField instance from the given numeric value.

Parameters
  • value – A int value.

  • 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

A CronField

classmethod from_str(value, name, min, max, specials, *args, **kwargs)

Create a new CronField instance from the given string value.

Parameters
  • value – A str value.

  • 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

A CronField

classmethod from_iterable(value, name, min, max, specials, *args, **kwargs)

Create a new CronField instance from the given Iterable value.

Parameters
  • value – A Iterable value.

  • 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

A CronField

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.

crython.field.second(value, *, name='second', **kwargs)

Partial for creating a CronField that represents the “second”.

crython.field.minute(value, *, name='minute', **kwargs)

Partial for creating a CronField that represents the “minute”.

crython.field.hour(value, *, name='hour', **kwargs)

Partial for creating a CronField that represents the “hour”.

crython.field.day(value, *, name='day', **kwargs)

Partial for creating a CronField that represents the “day of month”.

crython.field.month(value, *, name='month', **kwargs)

Partial for creating a CronField that represents the “day of month”.

crython.field.weekday(value, *, name='weekday', **kwargs)

Partial for creating a CronField that represents the “day of week”.

crython.field.year(value, *, name='year', **kwargs)

Partial for creating a CronField that represents the “year”.

crython.field.partials

Mapping of field name to the partial that create one of that field “type”.