Format: application/x-python-code
1 o
2
3 �h � @ s� d Z ddlmZ ddlZddlZddlmZmZ ddlm Z m
4 Z
5 ddlZddlmZ e r2ddl
6 mZ dddd
7 �Zdd� Z d d!dd�Z d"d#dd�Zg d�ZdS )$z1Connection file-related utilities for the kernel
8 � )�annotationsN)�PIPE�Popen)�
9 TYPE_CHECKING�Any)�write_connection_file��IPKernelApp�app�IPKernelApp | None�return�strc C sN ddl m} | du rddlm} |�� sd}t|��|�� } || jd| jg�S )z�Return the path to the connection file of an app
10
11 Parameters
12 ----------
13 app : IPKernelApp instance [optional]
14 If unspecified, the currently running app will be used
15 r )�filefindNr z.app not specified, and not in a running Kernel�.) Ztraitlets.utilsr �ipykernel.kernelappr Zinitialized�RuntimeError�instance�connection_fileZconnection_dir)r
16 r r �msg� r �Gc:\Users\shubh\Videos\agent\nova\Lib\site-packages\ipykernel/connect.py�get_connection_file s r c C s | du rt � S t�| �S )z�Return the absolute path for a connection file
17
18 - If nothing specified, return current Kernel's connection file
19 - Otherwise, call jupyter_client.find_connection_file
20 N)r �jupyter_clientZfind_connection_file)r r r r �_find_connection_file( s
21 r Fr �
22 str | None�unpack�bool�str | dict[str, Any]c C sb t | �}t|��}|�� }W d � n1 sw Y |r/t�|�}|�dd��� |d<