
    <i                          S r SSKJrJr  SS jrSS jrSS jrSS jrSS jrSS	 jr	 " S
 S\
5      r\\l        \\l        \\l        \\l        \\l        \	\l	        g)a  
Functions for working with STIX 2 Data Markings.

These high level functions will operate on both object-level markings and
granular markings unless otherwise noted in each of the functions.

Note:
    These functions are also available as methods on SDOs, SROs, and Marking
    Definitions. The corresponding methods on those classes are identical to
    these functions except that the `obj` parameter is omitted.

.. autosummary::
   :toctree: markings

   granular_markings
   object_markings
   utils

|
    )granular_markingsobject_markingsNc                     Uc  [         R                  " U 5      $ [        R                  " U UUUUU5      nU(       a%  UR                  [         R                  " U 5      5        [	        [        U5      5      $ )a5  
Get all markings associated to the field(s) specified by selectors.

Args:
    obj: An SDO or SRO object.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the properties appear.
    inherited (bool): If True, include object level markings and granular
        markings inherited relative to the properties.
    descendants (bool): If True, include granular markings applied to any
        children relative to the properties.
    marking_ref (bool): If False, excludes markings that use
        ``marking_ref`` property.
    lang (bool): If False, excludes markings that use ``lang`` property.

Returns:
    list: Marking identifiers that matched the selectors expression.

Note:
    If ``selectors`` is None, operation will be performed only on object
    level markings.

)r   get_markingsr   extendlistset)obj	selectors	inheriteddescendantsmarking_reflangresultss          Q/home/james-whalen/.local/lib/python3.13/site-packages/stix2/markings/__init__.pyr   r      sh    0 ++C00,,G 33C89G    c                 d    Uc  [         R                  " X5      $ [        R                  " XX#U5      $ )aY  
Remove all markings associated with selectors and appends a new granular
marking. Refer to `clear_markings` and `add_markings` for details.

Args:
    obj: An SDO or SRO object.
    marking: identifier or list of marking identifiers that apply to the
        properties selected by `selectors`.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the properties appear.
    marking_ref (bool): If False, markings that use the ``marking_ref``
        property will not be removed.
    lang (bool): If False, markings that use the ``lang`` property
        will not be removed.

Returns:
    A new version of the given SDO or SRO with specified markings removed
    and new ones added.

Note:
    If ``selectors`` is None, operations will be performed on object level
    markings. Otherwise on granular markings.

)r   set_markingsr   )r
   markingr   r   r   s        r   r   r   C   s1    2 ++C99 --cITXYYr   c                 b    Uc  [         R                  " X5      $ [        R                  " XU5      $ )a  
Remove a marking from this object.

Args:
    obj: An SDO or SRO object.
    marking: identifier or list of marking identifiers that apply to the
        properties selected by `selectors`.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the properties appear.

Raises:
    InvalidSelectorError: If `selectors` fail validation.
    MarkingNotFoundError: If markings to remove are not found on
        the provided SDO or SRO.

Returns:
    A new version of the given SDO or SRO with specified markings removed.

Note:
    If ``selectors`` is None, operations will be performed on object level
    markings. Otherwise on granular markings.

)r   remove_markingsr   r
   r   r   s      r   r   r   b   s.    0 ..s<< 00yIIr   c                 b    Uc  [         R                  " X5      $ [        R                  " XU5      $ )aJ  
Append a marking to this object.

Args:
    obj: An SDO or SRO object.
    marking: identifier or list of marking identifiers that apply to the
        properties selected by `selectors`.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the properties appear.

Raises:
    InvalidSelectorError: If `selectors` fail validation.

Returns:
    A new version of the given SDO or SRO with specified markings added.

Note:
    If ``selectors`` is None, operations will be performed on object level
    markings. Otherwise on granular markings.

)r   add_markingsr   r   s      r   r   r      s.    , ++C99 --cIFFr   c                 b    Uc  [         R                  " U 5      $ [        R                  " XX#5      $ )a  
Remove all markings associated with the selectors.

Args:
    obj: An SDO or SRO object.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the field(s) appear(s).
    marking_ref (bool): If False, markings that use the ``marking_ref``
        property will not be removed.
    lang (bool): If False, markings that use the ``lang`` property
        will not be removed.

Raises:
    InvalidSelectorError: If `selectors` fail validation.
    MarkingNotFoundError: If markings to remove are not found on
        the provided SDO or SRO.

Returns:
    A new version of the given SDO or SRO with specified markings cleared.

Note:
    If ``selectors`` is None, operations will be performed on object level
    markings. Otherwise on granular markings.

)r   clear_markingsr   )r
   r   r   r   s       r   r   r      s.    4 --c22 //RRr   c                 R   Uc  [         R                  " X5      $ [        R                  " U UUUU5      nU(       al  [        R                  " X5      n[         R                  " U 5      nU(       a  [        R                  " U UUUU5      nU=(       d    [         R                  " X5      nU$ )a  
Check if field(s) is marked by any marking or by specific marking(s).

Args:
    obj: An SDO or SRO object.
    marking: identifier or list of marking identifiers that apply to the
        properties selected by `selectors`.
    selectors: string or list of selectors strings relative to the SDO or
        SRO in which the field(s) appear(s).
    inherited (bool): If True, include object level markings and granular
        markings inherited to determine if the properties is/are marked.
    descendants (bool): If True, include granular markings applied to any
        children of the given selector to determine if the properties
        is/are marked.

Returns:
    bool: True if ``selectors`` is found on internal SDO or SRO collection.
        False otherwise.

Note:
    When a list of marking identifiers is provided, if ANY of the provided
    marking identifiers match, True is returned.

    If ``selectors`` is None, operation will be performed only on object
    level markings.

)r   	is_markedr   r   )r
   r   r   r   r   resultgranular_marksobject_markss           r   r   r      s    8 ((66((F *77G&33C8&00F G?44SGMr   c                       \ rS rSrSrg)_MarkingsMixin    N)__name__
__module____qualname____firstlineno____static_attributes__r%   r   r   r#   r#      s    r   r#   )NFFTT)NTT)N)NNFF)__doc__stix2.markingsr   r   r   r   r   r   r   r   objectr#   r%   r   r   <module>r.      sr   * >'TZ>J<G8S@6r	V 	
 + * !0 *  . $ r   