Skip to content

Commit 91550b3

Browse files
committed
DOC: Autoreformat all docstrings.
This reformat all docstrings in ipykernel to conform to numpydoc.
1 parent 8171ce4 commit 91550b3

File tree

12 files changed

+49
-70
lines changed

12 files changed

+49
-70
lines changed

ipykernel/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_connection_file(app=None):
3636

3737
def find_connection_file(filename='kernel-*.json', profile=None):
3838
"""DEPRECATED: find a connection file, and return its absolute path.
39-
39+
4040
THIS FUNCTION IS DEPRECATED. Use jupyter_client.find_connection_file instead.
4141
4242
Parameters
@@ -80,7 +80,7 @@ def find_connection_file(filename='kernel-*.json', profile=None):
8080

8181
def _find_connection_file(connection_file, profile=None):
8282
"""Return the absolute path for a connection file
83-
83+
8484
- If nothing specified, return current Kernel's connection file
8585
- If profile specified, show deprecation warning about finding connection files in profiles
8686
- Otherwise, call jupyter_client.find_connection_file

ipykernel/datapub.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def publish_data(self, data):
3838
3939
Parameters
4040
----------
41-
4241
data : dict
4342
The data to be published. Think of it as a namespace.
4443
"""
@@ -60,7 +59,6 @@ def publish_data(data):
6059
6160
Parameters
6261
----------
63-
6462
data : dict
6563
The data to be published. Think of it as a namespace.
6664
"""

ipykernel/embed.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def embed_kernel(module=None, local_ns=None, **kwargs):
2323
The module to load into IPython globals (default: caller)
2424
local_ns : dict, optional
2525
The namespace to load into IPython user namespace (default: caller)
26-
27-
kwargs : various, optional
26+
**kwargs : various, optional
2827
Further keyword args are relayed to the IPKernelApp constructor,
2928
allowing configuration of the Kernel. Will only have an effect
3029
on the first embed_kernel call for a given process.

ipykernel/iostream.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ def __init__(self, socket, pipe=False):
5050
5151
Parameters
5252
----------
53-
54-
socket: zmq.PUB Socket
53+
socket : zmq.PUB Socket
5554
the socket on which messages will be sent.
56-
pipe: bool
55+
pipe : bool
5756
Whether this process should listen for IOPub messages
5857
piped from subprocesses.
5958
"""

ipykernel/jsonutil.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ def encode_images(format_dict):
5050
5151
Parameters
5252
----------
53-
5453
format_dict : dict
5554
A dictionary of display data keyed by mime-type
5655
5756
Returns
5857
-------
59-
6058
format_dict : dict
6159
A copy of the same dictionary,
6260
but binary image data ('image/png', 'image/jpeg' or 'application/pdf')
@@ -87,10 +85,9 @@ def json_clean(obj):
8785
Returns
8886
-------
8987
out : object
90-
91-
A version of the input which will not cause an encoding error when
92-
encoded as JSON. Note that this function does not *encode* its inputs,
93-
it simply sanitizes it so that there will be no encoding errors later.
88+
A version of the input which will not cause an encoding error when
89+
encoded as JSON. Note that this function does not *encode* its inputs,
90+
it simply sanitizes it so that there will be no encoding errors later.
9491
9592
"""
9693
# types that are 'atomic' and ok in json as-is.

ipykernel/kernelapp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,10 @@ def init_shell(self):
527527
def configure_tornado_logger(self):
528528
""" Configure the tornado logging.Logger.
529529
530-
Must set up the tornado logger or else tornado will call
531-
basicConfig for the root logger which makes the root logger
532-
go to the real sys.stderr instead of the capture streams.
533-
This function mimics the setup of logging.basicConfig.
530+
Must set up the tornado logger or else tornado will call
531+
basicConfig for the root logger which makes the root logger
532+
go to the real sys.stderr instead of the capture streams.
533+
This function mimics the setup of logging.basicConfig.
534534
"""
535535
logger = logging.getLogger('tornado')
536536
handler = logging.StreamHandler()

ipykernel/kernelspec.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,13 @@ def make_ipkernel_cmd(mod='ipykernel_launcher', executable=None, extra_arguments
2828
----------
2929
mod : str, optional (default 'ipykernel')
3030
A string of an IPython module whose __main__ starts an IPython kernel
31-
3231
executable : str, optional (default sys.executable)
3332
The Python executable to use for the kernel process.
34-
3533
extra_arguments : list, optional
3634
A list of extra arguments to pass when executing the launch code.
3735
3836
Returns
3937
-------
40-
4138
A Popen command list
4239
"""
4340
if executable is None:
@@ -61,10 +58,10 @@ def get_kernel_dict(extra_arguments=None):
6158

6259
def write_kernel_spec(path=None, overrides=None, extra_arguments=None):
6360
"""Write a kernel spec directory to `path`
64-
61+
6562
If `path` is not specified, a temporary directory is created.
6663
If `overrides` is given, the kernelspec JSON is updated before writing.
67-
64+
6865
The path to the kernelspec is always returned.
6966
"""
7067
if path is None:
@@ -92,33 +89,31 @@ def write_kernel_spec(path=None, overrides=None, extra_arguments=None):
9289
def install(kernel_spec_manager=None, user=False, kernel_name=KERNEL_NAME, display_name=None,
9390
prefix=None, profile=None, env=None):
9491
"""Install the IPython kernelspec for Jupyter
95-
92+
9693
Parameters
9794
----------
98-
99-
kernel_spec_manager: KernelSpecManager [optional]
95+
kernel_spec_manager : KernelSpecManager [optional]
10096
A KernelSpecManager to use for installation.
10197
If none provided, a default instance will be created.
102-
user: bool [default: False]
98+
user : bool [default: False]
10399
Whether to do a user-only install, or system-wide.
104-
kernel_name: str, optional
100+
kernel_name : str, optional
105101
Specify a name for the kernelspec.
106102
This is needed for having multiple IPython kernels for different environments.
107-
display_name: str, optional
103+
display_name : str, optional
108104
Specify the display name for the kernelspec
109-
profile: str, optional
105+
profile : str, optional
110106
Specify a custom profile to be loaded by the kernel.
111-
prefix: str, optional
107+
prefix : str, optional
112108
Specify an install prefix for the kernelspec.
113109
This is needed to install into a non-default location, such as a conda/virtual-env.
114-
env: dict, optional
110+
env : dict, optional
115111
A dictionary of extra environment variables for the kernel.
116112
These will be added to the current environment variables before the
117113
kernel is started
118114
119115
Returns
120116
-------
121-
122117
The path where the kernelspec was installed.
123118
"""
124119
if kernel_spec_manager is None:

ipykernel/parentpoller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def __init__(self, interrupt_handle=None, parent_handle=None):
5555
interrupt_handle : HANDLE (int), optional
5656
If provided, the program will generate a Ctrl+C event when this
5757
handle is signaled.
58-
5958
parent_handle : HANDLE (int), optional
6059
If provided, the program will terminate immediately when this
6160
handle is signaled.

ipykernel/pickleutil.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def interactive(f):
6767

6868
def use_dill():
6969
"""use dill to expand serialization support
70-
70+
7171
adds support for object methods and closures to serialization.
7272
"""
7373
# import dill causes most of the magic
@@ -91,7 +91,7 @@ def use_dill():
9191

9292
def use_cloudpickle():
9393
"""use cloudpickle to expand serialization support
94-
94+
9595
adds support for object methods and closures to serialization.
9696
"""
9797
import cloudpickle
@@ -118,18 +118,16 @@ def use_cloudpickle():
118118
class CannedObject(object):
119119
def __init__(self, obj, keys=[], hook=None):
120120
"""can an object for safe pickling
121-
121+
122122
Parameters
123-
==========
124-
125-
obj:
123+
----------
124+
obj
126125
The object to be canned
127-
keys: list (optional)
126+
keys : list (optional)
128127
list of attribute names that will be explicitly canned / uncanned
129-
hook: callable (optional)
128+
hook : callable (optional)
130129
An optional extra callable,
131130
which can do additional processing of the uncanned object.
132-
133131
large data may be offloaded into the buffers list,
134132
used for zero-copy transfers.
135133
"""
@@ -304,7 +302,7 @@ class CannedMemoryView(CannedBytes):
304302

305303
def _import_mapping(mapping, original=None):
306304
"""import any string-keys in a type mapping
307-
305+
308306
"""
309307
log = get_logger()
310308
log.debug("Importing canning map")
@@ -322,7 +320,7 @@ def _import_mapping(mapping, original=None):
322320

323321
def istype(obj, check):
324322
"""like isinstance(obj, check), but strict
325-
323+
326324
This won't catch subclasses.
327325
"""
328326
if isinstance(check, tuple):

ipykernel/pylab/backend_inline.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ def show(close=None, block=None):
2525
Parameters
2626
----------
2727
close : bool, optional
28-
If true, a ``plt.close('all')`` call is automatically issued after
29-
sending all the figures. If this is set, the figures will entirely
30-
removed from the internal list of figures.
28+
If true, a ``plt.close('all')`` call is automatically issued after
29+
sending all the figures. If this is set, the figures will entirely
30+
removed from the internal list of figures.
3131
block : Not used.
32-
The `block` parameter is a Matplotlib experimental parameter.
33-
We accept it in the function signature for compatibility with other
34-
backends.
32+
The `block` parameter is a Matplotlib experimental parameter.
33+
We accept it in the function signature for compatibility with other
34+
backends.
3535
"""
3636
if close is None:
3737
close = InlineBackend.instance().close_figures
@@ -158,7 +158,6 @@ def configure_inline_support(shell, backend):
158158
Parameters
159159
----------
160160
shell : InteractiveShell instance
161-
162161
backend : matplotlib backend
163162
"""
164163
# If using our svg payload backend, register the post-execution

0 commit comments

Comments
 (0)