o
    'h                      @   sj   d Z ddlZddlZejd dkrdd Zed ndd Zdd	 Zed
ZG dd
 d
e	eZ[dS )z9
Define a category on NSObject with some useful methods.
    N   c                 C   s   | S N vr   r   k/Users/merlin/projects/employee-monitoring-system/venv/lib/python3.10/site-packages/Foundation/_nsobject.py_str   s   r   zUdef _raise(exc_type, exc_value, exc_trace):
    raise exc_type, exc_value, exc_trace
c                 C   s   t | tr| S | dS )Nascii)
isinstancestrdecoder   r   r   r   r      s   

c                 C   s   | | |r   )with_traceback)exc_type	exc_value	exc_tracer   r   r   _raise   s   r   NSObjectc                   @   s  e Zd Zeddd Zeddd Zeedr-edd	d
 Z	eddd Z
eddd Zeddd ZeedrMeddd Zeddd Zeddd Zeddd  Zed!d"d# Zeedred$d%d& Zed'd(d) Zd*S d*S )+r      _pyobjc_performOnThread:c                 C   sH   z|\}}t | t|}|| W d S    dd l}|jtjd Y d S )Nr   )file)getattrr   	traceback	print_excsysstderr)selfcallinfoselargmr   r   r   r   _pyobjc_performOnThread_#   s   z!NSObject._pyobjc_performOnThread_"   _pyobjc_performOnThreadWithResult:c                 C   sT   z|\}}}t | t|}||}|d|f W d S    |dt f Y d S )NTF)r   r   appendr   exc_info)r   r   r   r   resultr   rr   r   r   "_pyobjc_performOnThreadWithResult_.   s   
z+NSObject._pyobjc_performOnThreadWithResult_2performSelector_onThread_withObject_waitUntilDone_s9   pyobjc_performSelector:onThread:withObject:waitUntilDone:c                 C   s   |  d|||f| dS )z
            A version of performSelector:onThread:withObject:waitUntilDone: that
            will log exceptions in the called method (instead of aborting the
            NSRunLoop on the other thread).
            r   N)r&   )r   	aSelectorthreadr   waitr   r   r   9pyobjc_performSelector_onThread_withObject_waitUntilDone_:      zBNSObject.pyobjc_performSelector_onThread_withObject_waitUntilDone_s?   pyobjc_performSelector:onThread:withObject:waitUntilDone:modes:c                 C   s   |  d|||f|| dS )z
            A version of performSelector:onThread:withObject:waitUntilDone:modes:
            that will log exceptions in the called method (instead of aborting the
            NSRunLoop on the other thread).
            r   N)8performSelector_onThread_withObject_waitUntilDone_modes_)r   r'   r(   r   r)   modesr   r   r   ?pyobjc_performSelector_onThread_withObject_waitUntilDone_modes_I   s   zHNSObject.pyobjc_performSelector_onThread_withObject_waitUntilDone_modes_s-   pyobjc_performSelector:withObject:afterDelay:c                 C      |  d||f| dS )z
        A version of performSelector:withObject:afterDelay:
        that will log exceptions in the called method (instead of aborting the
        NSRunLoop).
        r   N)Z&performSelector_withObject_afterDelay_)r   r'   r   delayr   r   r   -pyobjc_performSelector_withObject_afterDelay_X   s   
z6NSObject.pyobjc_performSelector_withObject_afterDelay_s5   pyobjc_performSelector:withObject:afterDelay:inModes:c                 C      |  d||f|| dS )z
        A version of performSelector:withObject:afterDelay:inModes:
        that will log exceptions in the called method (instead of aborting the
        NSRunLoop).
        r   N)Z.performSelector_withObject_afterDelay_inModes_)r   r'   r   r0   r-   r   r   r   5pyobjc_performSelector_withObject_afterDelay_inModes_c   s   	z>NSObject.pyobjc_performSelector_withObject_afterDelay_inModes_'performSelectorInBackground_withObject_s.   pyobjc_performSelectorInBackground:withObject:c                 C   s   |  d||f dS )z
            A version of performSelectorInBackground:withObject:
            that will log exceptions in the called method (instead of aborting the
            NSRunLoop).
            r   N)r4   )r   r'   r   r   r   r   .pyobjc_performSelectorInBackground_withObject_r   s   z7NSObject.pyobjc_performSelectorInBackground_withObject_s<   pyobjc_performSelectorOnMainThread:withObject:waitUntilDone:c                 C   r/   )z
        A version of performSelectorOnMainThread:withObject:waitUntilDone:
        that will log exceptions in the called method (instead of aborting the
        NSRunLoop in the main thread).
        r   N)5performSelectorOnMainThread_withObject_waitUntilDone_)r   r'   r   r)   r   r   r   <pyobjc_performSelectorOnMainThread_withObject_waitUntilDone_}   s   	
zENSObject.pyobjc_performSelectorOnMainThread_withObject_waitUntilDone_sB   pyobjc_performSelectorOnMainThread:withObject:waitUntilDone:modes:c                 C   r2   )z
        A version of performSelectorOnMainThread:withObject:waitUntilDone:modes:
        that will log exceptions in the called method (instead of aborting the
        NSRunLoop in the main thread).
        r   N);performSelectorOnMainThread_withObject_waitUntilDone_modes_)r   r'   r   r)   r-   r   r   r   Bpyobjc_performSelectorOnMainThread_withObject_waitUntilDone_modes_   r+   zKNSObject.pyobjc_performSelectorOnMainThread_withObject_waitUntilDone_modes_s4   pyobjc_performSelectorOnMainThread:withObject:modes:c           	      C   sH   g }|  d|||fd| |d \}}|r|S |\}}}t||| dS )a#  
        Similar to performSelectorOnMainThread:withObject:waitUntilDone:modes:,
        but:

        - always waits until done
        - returns the return value of the called method
        - if the called method raises an exception, this will raise the same
           exception
        r    Tr   N)r8   r   )	r   r'   r   r-   r#   isOKr   r   r   r   r   r   4pyobjc_performSelectorOnMainThread_withObject_modes_   s   
z=NSObject.pyobjc_performSelectorOnMainThread_withObject_modes_s.   pyobjc_performSelectorOnMainThread:withObject:c                 C   sF   g }|  d|||fd |d \}}|r|S |\}}}t||| d S Nr    Tr   )r6   r   )r   r'   r   r#   r:   r   r   r   r   r   r   .pyobjc_performSelectorOnMainThread_withObject_   s   
z7NSObject.pyobjc_performSelectorOnMainThread_withObject_s1   pyobjc_performSelector:onThread:withObject:modes:c           
      C   sJ   g }|  d||||fd| |d \}}|r|S |\}}}	t|||	 d S r<   )r,   r   )
r   r'   r(   r   r-   r#   r:   r   r   r   r   r   r   1pyobjc_performSelector_onThread_withObject_modes_   s   
z:NSObject.pyobjc_performSelector_onThread_withObject_modes_s+   pyobjc_performSelector:onThread:withObject:c           	      C   sH   g }|  d||||fd |d \}}|r|S |\}}}t||| d S r<   )r&   r   )	r   r'   r(   r   r#   r:   r   r   r   r   r   r   +pyobjc_performSelector_onThread_withObject_   s   
z4NSObject.pyobjc_performSelector_onThread_withObject_N)__name__
__module____qualname__objcZnamedSelectorr   r%   hasattrr   r*   r.   r1   r3   r5   r7   r9   r;   r=   r>   r?   r   r   r   r   r   "   sJ    



	













)
__doc__r   rC   version_infor   execr   ZlookUpClassr   ZCategoryr   r   r   r   <module>   s    
 K