
    <i              	          S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
JrJrJrJrJrJrJrJrJr  SS	KJrJr  S
SKJr  S
SKJr  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.r#S*S jr$\"" SSS \" S!S"9S#9r%\"" S$SS \" S%S"9S#9r&\"" S&SS \" S'S"9S#9r'\"" S(SS \" S)S"9S#9r(g)+z*STIX 2.0 Common Data Types and Properties.    )OrderedDictN   )_custom_marking_builder)_MarkingsMixin)check_tlp_marking)	HashesProperty
IDPropertyListPropertyPropertyReferencePropertySelectorPropertyStringPropertyTimestampPropertyTypeProperty)NOW	_get_dict   )_STIXBase20)HASHING_ALGORITHMc                 v    U[         :X  a  g[        U [        5      (       a  SU ;   a  ggU R                  S:X  a  gg)NT.Fmillisecond)
TLPMarking
isinstancestr	precision)crmarking_types     J/home/james-whalen/.local/lib/python3.13/site-packages/stix2/v20/common.py_should_set_millisecondr       s9    z!"c"9	||}$    c                      ^  \ rS rSrSr\" S\" SS94S\" 5       4S\" 5       4S\" \S	S
94S\" 5       4/5      r	U 4S jr
SrU =r$ )ExternalReference!   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709261>`__.
source_nameTrequireddescriptionurlhashes2.0spec_versionexternal_idc                 P   > [         [        U ]  5         U R                  / SQ5        g )N)r(   r.   r)   )superr#   _check_object_constraints_check_at_least_one_propertyself	__class__s    r   r1   +ExternalReference._check_object_constraints.   s     @B))*OPr!    )__name__
__module____qualname____firstlineno____doc__r   r   r   r   _propertiesr1   __static_attributes____classcell__r5   s   @r   r#   r#   !   sc     	56	()	 !	>"3%HI	() KQ Qr!   r#   c                   D    \ rS rSrSr\" S\" SS94S\" SS94/5      rSrg)	KillChainPhase3   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709267>`__.
kill_chain_nameTr&   
phase_namer7   N)	r8   r9   r:   r;   r<   r   r   r=   r>   r7   r!   r   rB   rB   3   s2     	ND9:	~t45 Kr!   rB   c            	       J    \ rS rSrSr\" S\" SSSS94S\" \SS	94/5      r	S
r
g)GranularMarking>   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709290>`__.
marking_refmarking-definitionr+   T)valid_typesr-   r'   	selectorsr&   r7   N)r8   r9   r:   r;   r<   r   r   r
   r   r=   r>   r7   r!   r   rG   rG   >   s=     	)6JY^imno	l#3dCD Kr!   rG   c                   :    \ rS rSrSrSr\" S\" SS94/5      rSr	g)r   I   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709287>`__.
tlpTr&   r7   N)
r8   r9   r:   r;   r<   _typer   r   r=   r>   r7   r!   r   r   r   I   s*     E	-. Kr!   r   c                   R   ^  \ rS rSrSrSr\" S\" SS94/5      rSU 4S jjr	Sr
U =r$ )	StatementMarkingT   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709286>`__.
	statementTr&   c                 p   > U(       a  UR                  S5      (       d  XS'   [        [        U ]  " S0 UD6  g )NrT   r7   )getr0   rR   __init__)r4   rT   kwargsr5   s      r   rW   StatementMarking.__init__^   s/    VZZ44"+;.88r!   r7   N)r8   r9   r:   r;   r<   rP   r   r   r=   rW   r>   r?   r@   s   @r   rR   rR   T   s5     E	nd34 K9 9r!   rR   c                   "    \ rS rSrSrSS jrSrg)MarkingPropertyf   z\Represent the marking objects in the ``definition`` property of
marking-definition objects.
c                 b    [        U5      [        R                  5       ;   a  US4$ [        S5      e)NFz9must be a Statement, TLP Marking or a registered marking.)typeOBJ_MAP_MARKINGvalues
ValueError)r4   valueallow_customs      r   cleanMarkingProperty.cleank   s-    ;/0022%<XYYr!   r7   N)F)r8   r9   r:   r;   r<   re   r>   r7   r!   r   r\   r\   f   s    Zr!   r\   c                      ^  \ rS rSrSrSr\" S\" \SS94S\" \SS94S\	" S	SS
94S\
" S S94S\" SS94S\" SS94S\" \5      4S\" \	" SSS
95      4S\" \5      4/	5      rU 4S jrU 4S jrSU 4S jjrSrU =r$ )MarkingDefinitionr   zFor more detailed information on this object's properties, see
`the STIX 2.0 specification <http://docs.oasis-open.org/cti/stix/v2.0/cs01/part1-stix-core/stix-v2.0-cs01-part1-stix-core.html#_Toc496709284>`__.
rJ   r_   r+   r,   idcreated_by_refidentity)rK   r-   createdc                      [         $ rZ   r   r7   r!   r   <lambda>MarkingDefinition.<lambda>|   s    cr!   )defaultdefinition_typeTr&   
definitionexternal_referencesobject_marking_refsgranular_markingsc                   > SS1R                  UR                  5       5      (       a   [        US      nSU;   a`  [        US   U5      (       aL  [        R                  " U R                  5      U l        U R                  R                  S[        S SS94/5        [        US   U5      (       d  [        US   5      nU" S0 UD6US'   [        [        U ]>  " S0 UD6  g ! [         a    [	        S5      ef = f)	Nrs   rt   z,definition_type must be a valid marking typerm   c                      [         $ rZ   ro   r7   r!   r   rp   ,MarkingDefinition.__init__.<locals>.<lambda>   s    cr!   r   )rr   r   r7   )issubsetkeysr`   KeyErrorrb   r    copydeepcopyr=   updater   r   r   r0   rh   rW   )r4   rX   r   defnr5   s       r   rW   MarkingDefinition.__init__   s    |,55fkkmDDQ.v6G/HI F"*6)+<lKK'+}}T5E5E'FD$$$++"$5kUb$cd-  f\2LAA !56'3';d';|$/9&9  Q !OPPQs   C C3c                 B   > [         [        U ]  5         [        U S5        g Nr+   )r0   rh   r1   r   r3   s    r   r1   +MarkingDefinition._check_object_constraints   s    @B$&r!   c                 F   > [        U S5        [        [        U ]  " X40 UD6$ r   )r   r0   rh   	serialize)r4   prettyinclude_optional_defaultsrX   r5   s       r   r   MarkingDefinition.serialize   s&    $&&7d]cddr!   )r=   )FF)r8   r9   r:   r;   r<   rP   r   r   r	   r   r   r   r\   r
   r#   rG   r=   rW   r1   r   r>   r?   r@   s   @r   rh   rh   r   s     !E	e%89	z%e45	,RWXY	%k:;	ND9:	56	-> ?@	->K_ns-t uv	l?;<
 
K:*'e er!   rh   )rO   rT   c                    ^ ^ UU 4S jnU$ )ap  Custom STIX Marking decorator.

Example:
    >>> from stix2 import CustomMarking
    >>> from stix2.properties import IntegerProperty, StringProperty
    >>> @CustomMarking('x-custom-marking', [
    ...     ('property1', StringProperty(required=True)),
    ...     ('property2', IntegerProperty()),
    ... ])
    ... class MyNewMarkingObjectType():
    ...     pass

c                 *   > [        U TTS[        5      $ r   )r   r   )cls
propertiesr_   s    r   wrapperCustomMarking.<locals>.wrapper   s    &sD*e[QQr!   r7   )r_   r   r   s   `` r   CustomMarkingr      s    RNr!   z8marking-definition--613f2e26-407d-48c7-9eca-b8e91df99dc9z2017-01-20T00:00:00.000ZrO   white)rO   )rj   rm   rs   rt   z8marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41dagreenz8marking-definition--f88d31f6-486f-44da-b317-01333bde0b82amberz8marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5edred)zx-custom-markingN))r<   collectionsr   r~   customr   markingsr   markings.utilsr   r   r   r	   r
   r   r   r   r   r   r   utilsr   r   baser   vocabr   r    r#   rB   rG   r   rR   r\   rh   r`   r   	TLP_WHITE	TLP_GREEN	TLP_AMBERTLP_REDr7   r!   r   <module>r      s   0 #  , % .   #  $Q Q$[ k  9{ 9$	Zh 	Z-e^ -eb !* A&g&		 A&g&		 A&g&		 A&e$	r!   