
    g                         d dl Z d dlZd dlZd dlZd dlZej
                  dk(  xr ej                  dk\  Zd Zd Z	d Z
 ej                  dej                        Zd Zd	 Zd
 Zy)    Nwin32)      c                 ,    t        fd| D              S )Nc              3   &   K   | ]  }|u  
 y wN ).0itemelements     B/var/www/openai/venv/lib/python3.12/site-packages/mockito/utils.py	<genexpr>z"contains_strict.<locals>.<genexpr>   s     /34tw3s   )any)seqr   s    `r   contains_strictr      s    /3///    c                 .    t        j                  | |      S r   )types
MethodType)fnobjs     r   	newmethodr      s    B$$r   c                     d}	 | j                   }| j                  }t        r"|j                   dk(  r|j                  d      rd}|t               \  }}t        ||      | k(  sJ |fS # t        $ r Y /w xY w)a  Destructure a given function into its host and its name.

    The 'host' of a function is a module, for methods it is usually its
    instance or its class. This is safe only for methods, for module wide,
    globally declared names it must be considered experimental.

    For all reasonable fn: ``getattr(*get_function_host(fn)) == fn``

    Returns tuple (host, fn-name)
    Otherwise should raise TypeError
    Nnt_path_)__name____self__NEEDS_OS_PATH_HACK
startswithAttributeError!find_invoking_frame_and_try_parsegetattr)r   r   names      r   get_function_hostr$      s     C
{{kk$)C {$ 67	TsD!R''' 95  s   A A( (	A43A4z*.*\s*.*(?:when2|patch|spy2)\(\s*(.+?)[,\)]c                     t        j                  d      dd } | D ]  }|d   dv rdj                  |d   xs g       }t        j	                  |      }|s;|j                  d      }|j                  d      }t        |      dk  rt        d	|z        |d
   }|j                  j                         }|j                  |j                         |j                  |d
         }|dd D ]  }	t        ||	      } ||d   fc S  t        d      )Nr      
   )patchspy2       .zcan't guess origin of '%s'r   z$could not destructure first argument)inspectstackjoinFIND_IDmatchgroupsplitlen	TypeError	f_globalscopyupdatef_localsgetr"   )
r0   
frame_infosourcemidpartsframevarsr   parts
             r   r!   r!   M   s
    MM!Qr"E
 a=--A,"-MM&!BHHSME5zA~ <r ABBqME??'')DKK' ((58$Cac4( $b	>!5 8 :
;;r   c           
         t        | t              s| S | j                  d      rt        d      | j	                  d      }|d   |dd }}t        j                  |      }t        |      D ]  \  }}	 t        ||      } |S # t        $ r` dj                  |g|d| z         }	 t        j                  |       t        d|d|d      # t        $ r t        d	|d|d      w xY ww xY w)
aj  Return obj for given dotted path.

    Typical inputs for `path` are 'os' or 'os.path' in which case you get a
    module; or 'os.path.exists' in which case you get a function from that
    module.

    Just returns the given input in case it is not a str.

    Note: Relative imports not supported.
    Raises ImportError or AttributeError as appropriate.

    r-   "relative imports are not supportedr   r,   Nzmodule 'z' has no attribute ''zobject ')
isinstancestrr   r7   r5   	importlibimport_module	enumerater"   r    r1   ImportError)pathrA   headtailr   ir#   modules           r   get_objrS   p   s    dC s<==JJsOEq59$D

!
!$
'C T?4	J#t$C # J  	J XXtftBQx/0FJ''/
 %;A4HJ J	  J$;A4HJ JJ	Js$   1B!C*#C
8C*
C&&C*c                     t        | t              st        |       S | j                  d      rt	        d      	 | j                  dd      \  }}t        |      |fS # t        $ r t	        d      w xY w)zSplit path into (obj, attribute) tuple.

    Given `path` is 'os.path.exists' will thus return `(os.path, 'exists')`

    If path is not a str, delegates to `get_function_host(path)`

    r-   rF   r,   zpath must have dots)rH   rI   r$   r   r7   rsplit
ValueErrorrS   )rN   leadingends      r   get_obj_attr_tuplerY      sy     dC  &&s<==/{{3* 7S    /-../s   A A0)rJ   r/   sysr   replatformversion_infor   r   r   r$   compileMr2   r!   rS   rY   r	   r   r   <module>r`      sq      
  	 LLG; 0 0G ; 
0%1h "**BBDD
I!<F+Z!r   