cyclonedx.model.lifecycle
=========================

.. py:module:: cyclonedx.model.lifecycle

.. autoapi-nested-parse::

       This set of classes represents the lifecycles types in the CycloneDX standard.

   .. note::
       Introduced in CycloneDX v1.5

   .. note::
       See the CycloneDX Schema for lifecycles: https://cyclonedx.org/docs/1.7/xml/#metadata_lifecycles



Attributes
----------

.. autoapisummary::

   cyclonedx.model.lifecycle.Lifecycle


Classes
-------

.. autoapisummary::

   cyclonedx.model.lifecycle.LifecyclePhase
   cyclonedx.model.lifecycle.PredefinedLifecycle
   cyclonedx.model.lifecycle.NamedLifecycle
   cyclonedx.model.lifecycle.LifecycleRepository


Module Contents
---------------

.. py:class:: LifecyclePhase

   Bases: :py:obj:`str`, :py:obj:`enum.Enum`


   Enum object that defines the permissible 'phase' for a Lifecycle according to the CycloneDX schema.

   .. note::
       See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.7/xml/#type_classification


   .. py:attribute:: DESIGN
      :value: 'design'



   .. py:attribute:: PRE_BUILD
      :value: 'pre-build'



   .. py:attribute:: BUILD
      :value: 'build'



   .. py:attribute:: POST_BUILD
      :value: 'post-build'



   .. py:attribute:: OPERATIONS
      :value: 'operations'



   .. py:attribute:: DISCOVERY
      :value: 'discovery'



   .. py:attribute:: DECOMMISSION
      :value: 'decommission'



.. py:class:: PredefinedLifecycle(phase: LifecyclePhase)

   Object that defines pre-defined phases in the product lifecycle.

   .. note::
       See the CycloneDX Schema definition:
       https://cyclonedx.org/docs/1.7/json/#tab-pane_metadata_lifecycles_items_oneOf_i0


   .. py:property:: phase
      :type: LifecyclePhase



.. py:class:: NamedLifecycle(name: str, *, description: Optional[str] = None)

   Object that defines custom state in the product lifecycle.

   .. note::
       See the CycloneDX Schema definition:
       https://cyclonedx.org/docs/1.7/json/#tab-pane_metadata_lifecycles_items_oneOf_i1


   .. py:property:: name
      :type: str


      Name of the lifecycle phase.

      Returns:
           `str`



   .. py:property:: description
      :type: Optional[str]


      Description of the lifecycle phase.

      Returns:
           `str`



.. py:data:: Lifecycle

   TypeAlias for a union of supported lifecycle models.

   - :class:`PredefinedLifecycle`
   - :class:`NamedLifecycle`


.. py:class:: LifecycleRepository(iterable=None, key=None)

   Bases: :py:obj:`sortedcontainers.SortedSet`\ [\ :py:obj:`Lifecycle`\ ]


   Collection of :class:`Lifecycle`.

   This is a `set`, not a `list`.  Order MUST NOT matter here.


   .. py:attribute:: isdisjoint

      Return True if two sets have a null intersection.



   .. py:attribute:: issubset


   .. py:attribute:: issuperset


   .. py:attribute:: bisect_left


   .. py:attribute:: bisect


   .. py:attribute:: bisect_right


   .. py:attribute:: index

      S.index(value, [start, [stop]]) -> integer -- return first index of
      value.  Raises ValueError if the value is not present.

      Supporting start and stop arguments is optional, but
      recommended.



   .. py:attribute:: irange


   .. py:attribute:: islice


   .. py:property:: key

      Function used to extract comparison key from values.

      Sorted set compares values directly when the key function is none.




   .. py:method:: add(value)

      Add `value` to sorted set.

      Runtime complexity: `O(log(n))` -- approximate.

      >>> ss = SortedSet()
      >>> ss.add(3)
      >>> ss.add(1)
      >>> ss.add(2)
      >>> ss
      SortedSet([1, 2, 3])

      :param value: value to add to sorted set




   .. py:method:: clear()

      Remove all values from sorted set.

      Runtime complexity: `O(n)`




   .. py:method:: copy()

      Return a shallow copy of the sorted set.

      Runtime complexity: `O(n)`

      :return: new sorted set




   .. py:method:: count(value)

      Return number of occurrences of `value` in the sorted set.

      Runtime complexity: `O(1)`

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.count(3)
      1

      :param value: value to count in sorted set
      :return: count




   .. py:method:: discard(value)

      Remove `value` from sorted set if it is a member.

      If `value` is not a member, do nothing.

      Runtime complexity: `O(log(n))` -- approximate.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.discard(5)
      >>> ss.discard(0)
      >>> ss == set([1, 2, 3, 4])
      True

      :param value: `value` to discard from sorted set




   .. py:method:: pop(index=-1)

      Remove and return value at `index` in sorted set.

      Raise :exc:`IndexError` if the sorted set is empty or index is out of
      range.

      Negative indices are supported.

      Runtime complexity: `O(log(n))` -- approximate.

      >>> ss = SortedSet('abcde')
      >>> ss.pop()
      'e'
      >>> ss.pop(2)
      'c'
      >>> ss
      SortedSet(['a', 'b', 'd'])

      :param int index: index of value (default -1)
      :return: value
      :raises IndexError: if index is out of range




   .. py:method:: remove(value)

      Remove `value` from sorted set; `value` must be a member.

      If `value` is not a member, raise :exc:`KeyError`.

      Runtime complexity: `O(log(n))` -- approximate.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.remove(5)
      >>> ss == set([1, 2, 3, 4])
      True
      >>> ss.remove(0)
      Traceback (most recent call last):
        ...
      KeyError: 0

      :param value: `value` to remove from sorted set
      :raises KeyError: if `value` is not in sorted set




   .. py:method:: difference(*iterables)

      Return the difference of two or more sets as a new sorted set.

      The `difference` method also corresponds to operator ``-``.

      ``ss.__sub__(iterable)`` <==> ``ss - iterable``

      The difference is all values that are in this sorted set but not the
      other `iterables`.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.difference([4, 5, 6, 7])
      SortedSet([1, 2, 3])

      :param iterables: iterable arguments
      :return: new sorted set




   .. py:method:: difference_update(*iterables)

      Remove all values of `iterables` from this sorted set.

      The `difference_update` method also corresponds to operator ``-=``.

      ``ss.__isub__(iterable)`` <==> ``ss -= iterable``

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> _ = ss.difference_update([4, 5, 6, 7])
      >>> ss
      SortedSet([1, 2, 3])

      :param iterables: iterable arguments
      :return: itself




   .. py:method:: intersection(*iterables)

      Return the intersection of two or more sets as a new sorted set.

      The `intersection` method also corresponds to operator ``&``.

      ``ss.__and__(iterable)`` <==> ``ss & iterable``

      The intersection is all values that are in this sorted set and each of
      the other `iterables`.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.intersection([4, 5, 6, 7])
      SortedSet([4, 5])

      :param iterables: iterable arguments
      :return: new sorted set




   .. py:method:: intersection_update(*iterables)

      Update the sorted set with the intersection of `iterables`.

      The `intersection_update` method also corresponds to operator ``&=``.

      ``ss.__iand__(iterable)`` <==> ``ss &= iterable``

      Keep only values found in itself and all `iterables`.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> _ = ss.intersection_update([4, 5, 6, 7])
      >>> ss
      SortedSet([4, 5])

      :param iterables: iterable arguments
      :return: itself




   .. py:method:: symmetric_difference(other)

      Return the symmetric difference with `other` as a new sorted set.

      The `symmetric_difference` method also corresponds to operator ``^``.

      ``ss.__xor__(other)`` <==> ``ss ^ other``

      The symmetric difference is all values tha are in exactly one of the
      sets.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.symmetric_difference([4, 5, 6, 7])
      SortedSet([1, 2, 3, 6, 7])

      :param other: `other` iterable
      :return: new sorted set




   .. py:method:: symmetric_difference_update(other)

      Update the sorted set with the symmetric difference with `other`.

      The `symmetric_difference_update` method also corresponds to operator
      ``^=``.

      ``ss.__ixor__(other)`` <==> ``ss ^= other``

      Keep only values found in exactly one of itself and `other`.

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> _ = ss.symmetric_difference_update([4, 5, 6, 7])
      >>> ss
      SortedSet([1, 2, 3, 6, 7])

      :param other: `other` iterable
      :return: itself




   .. py:method:: union(*iterables)

      Return new sorted set with values from itself and all `iterables`.

      The `union` method also corresponds to operator ``|``.

      ``ss.__or__(iterable)`` <==> ``ss | iterable``

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> ss.union([4, 5, 6, 7])
      SortedSet([1, 2, 3, 4, 5, 6, 7])

      :param iterables: iterable arguments
      :return: new sorted set




   .. py:method:: update(*iterables)

      Update the sorted set adding values from all `iterables`.

      The `update` method also corresponds to operator ``|=``.

      ``ss.__ior__(iterable)`` <==> ``ss |= iterable``

      >>> ss = SortedSet([1, 2, 3, 4, 5])
      >>> _ = ss.update([4, 5, 6, 7])
      >>> ss
      SortedSet([1, 2, 3, 4, 5, 6, 7])

      :param iterables: iterable arguments
      :return: itself




