icalendar.prop.integer module#

INT values from RFC 5545.

class icalendar.prop.integer.vInt(*args, params=None, _validate_range=True, **kwargs)[source]#

Bases: int

Integer

Value Name:

INTEGER

Purpose:

This value type is used to identify properties that contain a signed integer value.

Format Definition:

This value type is defined by the following notation:

integer    = (["+"] / "-") 1*DIGIT
Description:

If the property permits, multiple "integer" values are specified by a COMMA-separated list of values. The valid range for "integer" is -2147483648 to 2147483647. If the sign is not specified, then the value is assumed to be positive.

The __new__ method creates a vInt instance:

Parameters:
  • value – Integer value to encode. Must be within min to max.

  • params (dict[str, Any] | None) – Optional parameter dictionary for the property.

Returns:

vInt instance

Raises:

ValueError – If the value is outside the RFC 5545 signed 32-bit integer range as defined in min and max.

Examples

1234567890
-1234567890
+1234567890
432109876
>>> from icalendar.prop import vInt
>>> integer = vInt.from_ical('1234567890')
>>> integer
1234567890
>>> integer = vInt.from_ical('-1234567890')
>>> integer
-1234567890
>>> integer = vInt.from_ical('+1234567890')
>>> integer
1234567890
>>> integer = vInt.from_ical('432109876')
>>> integer
432109876

Create a PRIORITY property (1 = highest priority):

>>> priority = vInt(1)
>>> priority
1
>>> priority.to_ical()
b'1'

Create SEQUENCE property (for versioning):

>>> sequence = vInt(3)
>>> sequence.to_ical()
b'3'
XCAL_TYPE = 'xsd:integer'#
default_value: ClassVar[str] = 'INTEGER'#
classmethod examples()[source]#

Examples of vInt.

Return type:

list[Self]

classmethod from_ical(ical)[source]#
classmethod from_jcal(jcal_property)[source]#

Parse jCal from RFC 7265.

Parameters:

jcal_property (list) – The jCal property to parse.

Raises:

JCalParsingError – If the provided jCal is invalid.

Return type:

Self

classmethod from_xcal(xml)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • parser – Required. The xCal to parse or a parser.

  • params – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

classmethod from_xcal_element(element, params)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • element (ElementAdapter) – Required. The xCal element to parse.

  • params (Parameters) – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

Self

classmethod from_xcal_in_recur(xml)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • parser – Required. The xCal to parse or a parser.

  • params – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

property ical_value: int#

INTEGER property type according to RFC 5545 Section 3.3.8

max: ClassVar[int] = 2147483647#

The maximum valid value per RFC 5545 Section 3.3.8 (2147483647).

Type:

max

min: ClassVar[int] = -2147483648#

The minimum valid value per RFC 5545 Section 3.3.8 (-2147483648).

Type:

min

params: Parameters#
classmethod parse_jcal_value(value)[source]#

Parse a jCal value for vInt.

Raises:

JCalParsingError – If the value is not an int.

Return type:

int

to_ical()[source]#
Return type:

bytes

to_jcal(name)[source]#

The jCal representation of this property according to RFC 7265.

Return type:

list

to_xcal(element)[source]#

Add the xCal representation of this property according to RFC 6321.

Return type:

None

class icalendar.prop.integer.vNonNegativeInt(*args, params=None, _validate_range=True, **kwargs)[source]#

Bases: vInt

This is an integer that is at least 0.

See https://www.rfc-editor.org/rfc/inline-errata/rfc6321.html#btn_3050

XCAL_TYPE = 'xsd:nonNegativeInteger'#
classmethod examples()[source]#

Examples of vPositiveInt.

Return type:

list[vInt]

min: ClassVar[int] = 0#

The minimum valid value per RFC 5545 Section 3.3.8 (-2147483648).

Type:

min