
    <i#                        S r  " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r " S+ S,\5      r " S- S.\5      r " S/ S0\5      rg1)2zSTIX2 Error Classes.c                       \ rS rSrSrSrg)	STIXError   z5Base class for errors generated in the stix2 library. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       J/home/james-whalen/.local/lib/python3.13/site-packages/stix2/exceptions.pyr   r      s    ?r   r   c                       \ rS rSrSrSrg)ObjectConfigurationError   zP
Represents specification violations regarding the composition of STIX
objects.
r   Nr   r   r   r   r   r      s     	r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )InvalidValueError   z>An invalid value was provided to a STIX object's ``__init__``.c                 N   > [         [        U ]  5         Xl        X l        X0l        g N)superr   __init__cls	prop_namereasonselfr   r   r   	__class__s       r   r   InvalidValueError.__init__   s     /1"r   c                 (    SnUR                  U 5      $ )Nz>Invalid value for {0.cls.__name__} '{0.prop_name}': {0.reason}formatr   msgs     r   __str__InvalidValueError.__str__   s    Nzz$r   r   r   r   	r   r   r	   r
   r   r   r%   r   __classcell__r   s   @r   r   r      s    H   r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )PropertyPresenceError   z
Represents an invalid combination of properties on a STIX object.  This
class can be used directly when the object requirements are more
complicated and none of the more specific exception subclasses apply.
c                 8   > [         [        U ]  U5        X l        g r   )r   r,   r   r   )r   messager   r   s      r   r   PropertyPresenceError.__init__$   s    #T3G<r   )r   r   r   r	   r
   r   r   r   r)   r*   s   @r   r,   r,      s    
 r   r,   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )MissingPropertiesError)   zFMissing one or more required properties when constructing STIX object.c                    > [        U5      U l        SR                  UR                  SR	                  S U R                   5       5      5      n[
        [        U ]  X15        g )Nz1No values for required properties for {0}: ({1})., c              3   $   #    U  H  ov   M     g 7fr   r   .0xs     r   	<genexpr>2MissingPropertiesError.__init__.<locals>.<genexpr>1        1Aa   )sorted
propertiesr"   r   joinr   r3   r   r   r   r@   r$   r   s       r   r   MissingPropertiesError.__init__,   sN     ,AHHLLII111

 	$d4S>r   r@   r1   r*   s   @r   r3   r3   )   s    P? ?r   r3   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )ExtraPropertiesError7   zIOne or more extra properties were provided when constructing STIX object.c                    > [        U5      U l        SR                  UR                  SR	                  S U R                   5       5      5      n[
        [        U ]  X15        g )Nz%Unexpected properties for {0}: ({1}).r6   c              3   $   #    U  H  ov   M     g 7fr   r   r8   s     r   r;   0ExtraPropertiesError.__init__.<locals>.<genexpr>?   r=   r>   )r?   r@   r"   r   rA   r   rF   r   rB   s       r   r   ExtraPropertiesError.__init__:   sN     ,5<<LLII111

 	"D23<r   rD   r1   r*   s   @r   rF   rF   7   s    S= =r   rF   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ ) MutuallyExclusivePropertiesErrorE   zLViolating interproperty mutually exclusive constraint of a STIX object type.c                    > [        U5      U l        SR                  UR                  SR	                  S U R                   5       5      5      n[
        [        U ]  X15        g )Nz4The ({1}) properties for {0} are mutually exclusive.r6   c              3   $   #    U  H  ov   M     g 7fr   r   r8   s     r   r;   <MutuallyExclusivePropertiesError.__init__.<locals>.<genexpr>M   r=   r>   )r?   r@   r"   r   rA   r   rM   r   rB   s       r   r   )MutuallyExclusivePropertiesError.__init__H   sN     ,DKKLLII111

 	.>sHr   rD   r1   r*   s   @r   rM   rM   E   s    VI Ir   rM   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )DependentPropertiesErrorS   zDViolating interproperty dependency constraint of a STIX object type.c                    > X l         SR                  UR                  SR                  S U R                    5       5      5      n[        [
        U ]  X15        g )Nz5The property dependencies for {0}: ({1}) are not met.r6   c              3   6   #    U  H  o  H  o"v   M     M     g 7fr   r   )r9   r:   names      r   r;   4DependentPropertiesError.__init__.<locals>.<genexpr>[   s     D$5q!$d!d$5s   )dependenciesr"   r   rA   r   rT   r   )r   r   rZ   r$   r   s       r   r   !DependentPropertiesError.__init__V   sJ    (ELLLLIIDD$5$5DD

 	&6s@r   )rZ   r1   r*   s   @r   rT   rT   S   s    NA Ar   rT   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )AtLeastOnePropertyErrora   ziViolating a constraint of a STIX object type that at least one of the given properties must be populated.c                    > [        U5      U l        SR                  UR                  SR	                  S U R                   5       5      5      n[
        [        U ]  X15        g )Nz?At least one of the ({1}) properties for {0} must be populated.r6   c              3   $   #    U  H  ov   M     g 7fr   r   r8   s     r   r;   3AtLeastOnePropertyError.__init__.<locals>.<genexpr>j   s     81Qr>   )r?   r@   r"   r   rA   r   r]   r   rB   s       r   r    AtLeastOnePropertyError.__init__d   sR     ,!6<<99888 	 	%t5c?r   rD   r1   r*   s   @r   r]   r]   a   s    s	@ 	@r   r]   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )DictionaryKeyErrorp   z6Dictionary key does not conform to the correct format.c                 B   > [         [        U ]  5         Xl        X l        g r   )r   rd   r   keyr   )r   rg   r   r   s      r   r   DictionaryKeyError.__init__s   s     $02r   c                 (    SnUR                  U 5      $ )Nz-Invalid dictionary key {0.key}: ({0.reason}).r!   r#   s     r   r%   DictionaryKeyError.__str__x   s    =zz$r   )rg   r   r(   r*   s   @r   rd   rd   p   s    @
   r   rd   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )InvalidObjRefError}   zDA STIX Cyber Observable Object contains an invalid object reference.c                 N   > [         [        U ]  5         Xl        X l        X0l        g r   )r   rl   r   r   r   r   r   s       r   r   InvalidObjRefError.__init__   s      $02"r   c                 (    SnUR                  U 5      $ )NzIInvalid object reference for '{0.cls.__name__}:{0.prop_name}': {0.reason}r!   r#   s     r   r%   InvalidObjRefError.__str__   s    Yzz$r   r'   r(   r*   s   @r   rl   rl   }   s    N   r   rl   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )InvalidSelectorError   zeGranular Marking selector violation. The selector must resolve into an existing STIX object property.c                 B   > [         [        U ]  5         Xl        X l        g r   )r   rs   r   r   rg   r   r   rg   r   s      r   r   InvalidSelectorError.__init__       "D24r   c                 z    SnUR                  U R                  U R                  R                  R                  5      $ )Nz!Selector {0} in {1} is not valid!r"   rg   r   r   r   r#   s     r   r%   InvalidSelectorError.__str__   ,    1zz$((DHH$6$6$?$?@@r   r   rg   r(   r*   s   @r   rs   rs      s    o
A Ar   rs   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )TLPMarkingDefinitionError   zcMarking violation. The marking-definition for TLP MUST follow the mandated instances from the spec.c                 B   > [         [        U ]  5         Xl        X l        g r   )r   r   r   user_objspec_obj)r   r   r   r   s      r   r   "TLPMarkingDefinitionError.__init__   s    '79  r   c                 R    SnUR                  U R                  U R                  5      $ )Nz,Marking {0} does not match spec marking {1}!)r"   r   r   r#   s     r   r%   !TLPMarkingDefinitionError.__str__   s     <zz$--77r   )r   r   r(   r*   s   @r   r   r      s    m!
8 8r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )ImmutableError   z-Attempted to modify an object after creation.c                 B   > [         [        U ]  5         Xl        X l        g r   )r   r   r   r   rg   rv   s      r   r   ImmutableError.__init__   s    nd,.r   c                 (    SnUR                  U 5      $ )NzFCannot modify '{0.key}' property in '{0.cls.__name__}' after creation.r!   r#   s     r   r%   ImmutableError.__str__   s    Vzz$r   r}   r(   r*   s   @r   r   r      s    7
   r   r   c                       \ rS rSrSrSrg)VersioningError   z*
Base class for object versioning errors.
r   Nr   r   r   r   r   r           	r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )UnmodifiablePropertyError   zSAttempted to modify an unmodifiable property of object when creating a new version.c                 6   > [         [        U ]  5         Xl        g r   )r   r   r   unchangable_properties)r   r   r   s     r   r   "UnmodifiablePropertyError.__init__   s    '79&<#r   c                 Z    SnUR                  SR                  U R                  5      5      $ )NzBThese properties cannot be changed when making a new version: {0}.r6   )r"   rA   r   r#   s     r   r%   !UnmodifiablePropertyError.__str__   s%    Rzz$))D$?$?@AAr   )r   r(   r*   s   @r   r   r      s    ]=B Br   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )TypeNotVersionableError   zq
An object couldn't be versioned because it lacked the versioning properties
and its type does not support them.
c                    > [        U[        5      (       a  UR                  S5      nO[        USS 5      nXl        SR                  U(       a  SR                  U5      OS5      n[        TU ]  U5        g )Ntype_typezVObject type{}is not versionable.  Try a dictionary or instance of an SDO or SRO class.z '{}'  )
isinstancedictgetgetattrobjectr"   r   r   )r   obj	type_namer$   r   s       r   r    TypeNotVersionableError.__init__   se    c4  I  Wd3I11709(//),s2 	 	r   r   r1   r*   s   @r   r   r      s     r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )ObjectNotVersionableError   z
An object's type supports versioning, but the object couldn't be versioned
because it lacked sufficient versioning properties.
c                 L   > Xl         S[        U5      -   n[        TU ]  U5        g )NzHCreating a new object version requires at least the 'created' property: )r   strr   r   )r   r   r$   r   s      r   r   "ObjectNotVersionableError.__init__   s(    !#h'r   r   r1   r*   s   @r   r   r      s     r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )RevokeError   z+Attempted an operation on a revoked object.c                 6   > [         [        U ]  5         Xl        g r   )r   r   r   	called_by)r   r   r   s     r   r   RevokeError.__init__   s    k4)+"r   c                 &    U R                   S:X  a  gg)Nrevokez(Cannot revoke an already revoked object.z0Cannot create a new version of a revoked object.r   )r   s    r   r%   RevokeError.__str__   s    >>X%=Er   r   r(   r*   s   @r   r   r      s    5#F Fr   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )
ParseError   zCould not parse object.c                 ,   > [         [        U ]  U5        g r   )r   r   r   r   r$   r   s     r   r   ParseError.__init__   s    j$(-r   r   r1   r*   s   @r   r   r      s    !. .r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )CustomContentError   z@Custom STIX Content (SDO, Observable, Extension, etc.) detected.c                 ,   > [         [        U ]  U5        g r   )r   r   r   r   s     r   r   CustomContentError.__init__   s     $05r   r   r1   r*   s   @r   r   r      s    J6 6r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )MarkingNotFoundErrori  zGMarking violation. The marking reference must be present in SDO or SRO.c                 B   > [         [        U ]  5         Xl        X l        g r   )r   r   r   r   rg   rv   s      r   r   MarkingNotFoundError.__init__  rx   r   c                 z    SnUR                  U R                  U R                  R                  R                  5      $ )Nz!Marking {0} was not found in {1}!rz   r#   s     r   r%   MarkingNotFoundError.__str__  r|   r   r}   r(   r*   s   @r   r   r     s    Q
A Ar   r   c                       \ rS rSrSrSrg)STIXDeprecationWarningi  zE
Represents usage of a deprecated component of a STIX specification.
r   Nr   r   r   r   r   r     r   r   r   c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )DuplicateRegistrationErrori  zJA STIX object with the same type as an existing object is being registeredc                 B   > [         [        U ]  5         Xl        X l        g r   )r   r   r   obj_typereg_obj_type)r   r   r   r   s      r   r   #DuplicateRegistrationError.__init__  s    ($8: (r   c                 R    SnUR                  U R                  U R                  5      $ )NzFA(n) {0} with type '{1}' already exists and cannot be registered again)r"   r   r   r#   s     r   r%   "DuplicateRegistrationError.__str__  s"    Vzz$--):):;;r   )r   r   r(   r*   s   @r   r   r     s    T)
< <r   r   N)r   	Exceptionr   r   r   r,   r3   rF   rM   rT   r]   rd   rl   rs   r   r   r   r   r   r   r   r   r   r   DeprecationWarningr   r   r   r   r   <module>r      sD   @	 @	y 	 0  4 ?2 ?=0 =I'< IA4 A@3 @
 1 
  1  
A3 
A
8 8 
8
 Y 
 	i 		B 	Bo *
 
F) F. .6 6
A9 
A	/ 	
< 
<r   