@@ -34,95 +34,41 @@ def get_connection_file(app=None):
3434 return filefind (app .connection_file , ['.' , app .connection_dir ])
3535
3636
37- def find_connection_file (filename = 'kernel-*.json' , profile = None ):
38- """DEPRECATED: find a connection file, and return its absolute path.
39-
40- THIS FUNCTION IS DEPRECATED. Use jupyter_client.find_connection_file instead.
41-
42- Parameters
43- ----------
44- filename : str
45- The connection file or fileglob to search for.
46- profile : str [optional]
47- The name of the profile to use when searching for the connection file,
48- if different from the current IPython session or 'default'.
49-
50- Returns
51- -------
52- str : The absolute path of the connection file.
53- """
54-
55- import warnings
56- warnings .warn ("""ipykernel.find_connection_file is deprecated, use jupyter_client.find_connection_file""" ,
57- DeprecationWarning , stacklevel = 2 )
58- from IPython .core .application import BaseIPythonApplication as IPApp
59- try :
60- # quick check for absolute path, before going through logic
61- return filefind (filename )
62- except IOError :
63- pass
64-
65- if profile is None :
66- # profile unspecified, check if running from an IPython app
67- if IPApp .initialized ():
68- app = IPApp .instance ()
69- profile_dir = app .profile_dir
70- else :
71- # not running in IPython, use default profile
72- profile_dir = ProfileDir .find_profile_dir_by_name (get_ipython_dir (), 'default' )
73- else :
74- # find profiledir by profile name:
75- profile_dir = ProfileDir .find_profile_dir_by_name (get_ipython_dir (), profile )
76- security_dir = profile_dir .security_dir
77-
78- return jupyter_client .find_connection_file (filename , path = ['.' , security_dir ])
79-
80-
81- def _find_connection_file (connection_file , profile = None ):
37+ def _find_connection_file (connection_file ):
8238 """Return the absolute path for a connection file
8339
8440 - If nothing specified, return current Kernel's connection file
85- - If profile specified, show deprecation warning about finding connection files in profiles
8641 - Otherwise, call jupyter_client.find_connection_file
8742 """
8843 if connection_file is None :
8944 # get connection file from current kernel
9045 return get_connection_file ()
9146 else :
92- # connection file specified, allow shortnames:
93- if profile is not None :
94- warnings .warn (
95- "Finding connection file by profile is deprecated." ,
96- DeprecationWarning , stacklevel = 3 ,
97- )
98- return find_connection_file (connection_file , profile = profile )
99- else :
100- return jupyter_client .find_connection_file (connection_file )
101-
102-
103- def get_connection_info (connection_file = None , unpack = False , profile = None ):
47+ return jupyter_client .find_connection_file (connection_file )
48+
49+
50+ def get_connection_info (connection_file = None , unpack = False ):
10451 """Return the connection information for the current Kernel.
10552
10653 Parameters
10754 ----------
10855 connection_file : str [optional]
10956 The connection file to be used. Can be given by absolute path, or
110- IPython will search in the security directory of a given profile .
57+ IPython will search in the security directory.
11158 If run from IPython,
11259
11360 If unspecified, the connection file for the currently running
11461 IPython Kernel will be used, which is only allowed from inside a kernel.
11562 unpack : bool [default: False]
11663 if True, return the unpacked dict, otherwise just the string contents
11764 of the file.
118- profile : DEPRECATED
11965
12066 Returns
12167 -------
12268 The connection dictionary of the current kernel, as string or dict,
12369 depending on `unpack`.
12470 """
125- cf = _find_connection_file (connection_file , profile )
71+ cf = _find_connection_file (connection_file )
12672
12773 with open (cf ) as f :
12874 info = f .read ()
@@ -134,7 +80,7 @@ def get_connection_info(connection_file=None, unpack=False, profile=None):
13480 return info
13581
13682
137- def connect_qtconsole (connection_file = None , argv = None , profile = None ):
83+ def connect_qtconsole (connection_file = None , argv = None ):
13884 """Connect a qtconsole to the current kernel.
13985
14086 This is useful for connecting a second qtconsole to a kernel, or to a
@@ -144,22 +90,21 @@ def connect_qtconsole(connection_file=None, argv=None, profile=None):
14490 ----------
14591 connection_file : str [optional]
14692 The connection file to be used. Can be given by absolute path, or
147- IPython will search in the security directory of a given profile .
93+ IPython will search in the security directory.
14894 If run from IPython,
14995
15096 If unspecified, the connection file for the currently running
15197 IPython Kernel will be used, which is only allowed from inside a kernel.
15298 argv : list [optional]
15399 Any extra args to be passed to the console.
154- profile : DEPRECATED
155100
156101 Returns
157102 -------
158103 :class:`subprocess.Popen` instance running the qtconsole frontend
159104 """
160105 argv = [] if argv is None else argv
161106
162- cf = _find_connection_file (connection_file , profile )
107+ cf = _find_connection_file (connection_file )
163108
164109 cmd = ';' .join ([
165110 "from IPython.qt.console import qtconsoleapp" ,
@@ -180,7 +125,6 @@ def connect_qtconsole(connection_file=None, argv=None, profile=None):
180125__all__ = [
181126 'write_connection_file' ,
182127 'get_connection_file' ,
183- 'find_connection_file' ,
184128 'get_connection_info' ,
185129 'connect_qtconsole' ,
186130]
0 commit comments