Format: application/x-python-code
1 o
2
3 �h� � @ sV d Z ddlZddlZddlmZ ej�ej�d��Z ej
4 Zee j_
5 ee j_
6 ee j_
7 e jZdd� Zdd� Zd d
8 � Zej�ej�d��ZejZeje_
9 ejZee_
10 ejZee_
11 ejZde_
12 ege_ejZee_
13 eejejejejeege_ejZde_
14 eeege_e�ed�Zd
15 d� Z dd� Z!e� Z"ddd�Z#e�$dee�Z%e%e#�Z&dd� Z'ddd�Z(dS )zGEventloop hook for OS X
16
17 Calls NSApp / CoreFoundation APIs via ctypes.
18 � N)�Event�objcc C s t | t�s
19 | �d�} | S )zensure utf8 bytes�utf8)�
20 isinstance�bytes�encode)�s� r �Pc:\Users\shubh\Videos\agent\nova\Lib\site-packages\ipykernel/_eventloop_macos.py�_utf8 s
21
22 r c C � t �t| ��S )z)create a selector name (for ObjC methods))r �sel_registerNamer )�namer r r
23 �n � r c C r )zget an ObjC Class by name)r �
24 objc_getClassr )� classnamer r r
25 �C$ r r �CoreFoundation�kCFRunLoopCommonModesc C s t t gtj_ttd�td��S )z0Return the global NSApplication instance (NSApp)Z
26 NSApplicationZsharedApplication��void_pr �objc_msgSend�argtypes�msgr r r r r r
27 �_NSAppP s r c C sl t t t t t t t t t t t gtj_ttd�td�ddddddddd�}t t t t gtj_t| td�t |�d� dS )zWake the ApplicationZNSEventz]otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:� r NzpostEvent:atStart:Tr )�NSApp�eventr r r
28 �_wakeV s: �
29 ��r c C s` t �� t� }ttgtj_t|td��r)tttgtj_t|td�|� t |� dS t
30 t� � dS )z.Callback to fire when there's input to be readZ isRunningzstop:N)�
31 _triggered�setr r r r r r r r �
32 CFRunLoopStop�CFRunLoopGetCurrent)�timer�loopr r r r
33 �stop| s r&