ó
    Ë<i®  ã                   óV   • S r SSKrSSKJr  SSKJr  SSKJrJr  S
S jr	S
S jr
SS	 jrg)zSTIX2 Core parsing methods.é    Né   )Úregistry)Ú
ParseError)Ú	_get_dictÚdetect_spec_versionc                 ó4   • [        U 5      n[        X1U5      nU$ )a¡  Convert a string, dict or file-like object into a STIX object.

Args:
    data (str, dict, file-like object): The STIX 2 content to be parsed.
    allow_custom (bool): Whether to allow custom properties as well unknown
        custom objects. Note that unknown custom objects cannot be parsed
        into STIX objects, and will be returned as is. Default: False.
    version (str): If present, it forces the parser to use the version
        provided. Otherwise, the library will make the best effort based
        on checking the "spec_version" property. If none of the above are
        possible, it will use the default version specified by the library.

Returns:
    An instantiated Python STIX object.

Warnings:
    'allow_custom=True' will allow for the return of any supplied STIX
    dict(s) that cannot be found to map to any known STIX object types
    (both STIX2 domain objects or defined custom STIX2 objects); NO
    validation is done. This is done to allow the processing of possibly
    unknown custom STIX objects (example scenario: I need to query a
    third-party TAXII endpoint that could provide custom STIX objects that
    I don't know about ahead of time)

)r   Údict_to_stix2)ÚdataÚallow_customÚversionÚobjs       ÚG/home/james-whalen/.local/lib/python3.13/site-packages/stix2/parsing.pyÚparser   
   s    € ô6 D‹/€Cô ˜¨7Ó
3€Cà€Jó    c                 óÚ  • SU ;  a  [        S[        U 5      -  5      eU(       d  [        U 5      nU S   n[        R                  " X2S5      =(       d    [        R                  " X2S5      nU(       dr  U(       a  U $ U R                  S0 5      R                  5        H7  u  pVUR                  S5      (       d  M  SUR                  SS	5      ;  d  M5  U s  $    [        S
U-  5      eU" SSU0U D6$ )aî  convert dictionary to full python-stix2 object

Args:
    stix_dict (dict): a python dictionary of a STIX object
        that (presumably) is semantically correct to be parsed
        into a full python-stix2 obj
    allow_custom (bool): Whether to allow custom properties as well
        unknown custom objects. Note that unknown custom objects cannot
        be parsed into STIX objects, and will be returned as is.
        Default: False.
    version (str): If present, it forces the parser to use the version
        provided. Otherwise, the library will make the best effort based
        on checking the "spec_version" property. If none of the above are
        possible, it will use the default version specified by the library.

Returns:
    An instantiated Python STIX object

Warnings:
    'allow_custom=True' will allow for the return of any supplied STIX
    dict(s) that cannot be found to map to any known STIX object types
    (both STIX2 domain objects or defined custom STIX2 objects); NO
    validation is done. This is done to allow the processing of
    possibly unknown custom STIX objects (example scenario: I need to
    query a third-party TAXII endpoint that could provide custom STIX
    objects that I don't know about ahead of time)

Útypez.Can't parse object with no 'type' property: %sÚobjectsÚobservablesÚ
extensionszextension-definition--zproperty-extensionÚextension_typeÚ zWCan't parse unknown object type '%s'! For custom types, use the CustomObject decorator.r   © )r   Ústrr   r   Úclass_for_typeÚgetÚitemsÚ
startswith)Ú	stix_dictr   r   Úobj_typeÚ	obj_classÚkey_idÚext_defs          r   r	   r	   -   sê   € ð: YÓÜÐIÌCÐPYËNÑZÓ[Ð[æÜ% iÓ0ˆà˜Ñ €HÜ×'Ò'¨¸9ÓE÷ EÜ×"Ò" 8°mÓDð ö Þð ÐØ(Ÿ}™}¨\¸2Ó>×DÑDÖF‰OˆFà×!Ñ!Ð":×;Ó;Ø$¨G¯K©KÐ8HÈ"Ó,MÕMð !Ò ñ  Gô ÐrÐu}Ñ}Ó~Ð~áÑ< ,Ð<°)Ñ<Ð<r   c                 óL  • [        U 5      nSU;  a  [        S[        U5      -  5      e[        R                  " U5      nU=(       d    / US'   U(       d  [        U5      nUS   n[        R                  " XSS5      nU(       d  U(       a  U$ [        SUS   -  5      eU" SSU0UD6$ )av  Deserialize a string or file-like object into a STIX Cyber Observable
object.

Args:
    data (str, dict, file-like object): The STIX2 content to be parsed.
    _valid_refs: A list of object references valid for the scope of the
        object being parsed. Use empty list if no valid refs are present.
    allow_custom (bool): Whether to allow custom properties or not.
        Default: False.
    version (str): If present, it forces the parser to use the version
        provided. Otherwise, the default version specified by the library
        will be used.

Returns:
    An instantiated Python STIX Cyber Observable object.

r   z2Can't parse observable with no 'type' property: %sÚ_valid_refsr   zeCan't parse unknown observable type '%s'! For custom observables, use the CustomObservable decorator.r   r   )r   r   r   ÚcopyÚdeepcopyr   r   r   )r
   r$   r   r   r   r   r    s          r   Úparse_observabler'   f   sµ   € ô$ D‹/€CàSÓÜÐMÔPSÐTWÓPXÑXÓYÐYô
 -Š-˜Ó
€Cà$×*¨€CˆÑæÜ% cÓ*ˆà6‰{€HÜ×'Ò'¨¸=ÓI€IÞÞð ˆJÜð2Ø47¸±Kñ@ó
ð 	
ñ
 Ñ6 ,Ð6°#Ñ6Ð6r   )FN)NFN)Ú__doc__r%   r   r   Ú
exceptionsr   Úutilsr   r   r   r	   r'   r   r   r   Ú<module>r+      s%   ðÙ !ã å Ý "ß 1ô ôF6=õr-7r   