Skip to content

Commit 0fa4721

Browse files
committed
DOC: Autoreformat docstrings.
This uses an autoreformatter to reformat and fix some of the common mistakes in numpydoc. Some of this is purely visual, but other like space before colon in parameters actually have semantic values. In the case of space before colon this is to make sure that nupmydoc properly distinguish the parameter name from its type.
1 parent 15d3782 commit 0fa4721

File tree

13 files changed

+52
-64
lines changed

13 files changed

+52
-64
lines changed

jupyter_server/_sysinfo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ def pkg_commit_hash(pkg_path):
2626
Parameters
2727
----------
2828
pkg_path : str
29-
directory containing package
30-
only used for getting commit from active repo
29+
directory containing package
30+
only used for getting commit from active repo
3131
3232
Returns
3333
-------
3434
hash_from : str
35-
Where we got the hash from - description
35+
Where we got the hash from - description
3636
hash_str : str
37-
short form of hash
37+
short form of hash
3838
"""
3939

4040
# maybe we are in a repository, check for a .git folder
@@ -68,12 +68,12 @@ def pkg_info(pkg_path):
6868
Parameters
6969
----------
7070
pkg_path : str
71-
path containing __init__.py for package
71+
path containing __init__.py for package
7272
7373
Returns
7474
-------
7575
context : dict
76-
with named parameters of interest
76+
with named parameters of interest
7777
"""
7878
src, hsh = pkg_commit_hash(pkg_path)
7979
return dict(

jupyter_server/_tz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def utc_method(*args, **kwargs):
3636

3737
def isoformat(dt):
3838
"""Return iso-formatted timestamp
39-
39+
4040
Like .isoformat(), but uses Z for UTC instead of +00:00
4141
"""
4242
return dt.isoformat().replace('+00:00', 'Z')

jupyter_server/auth/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def get_user(cls, handler):
196196
@classmethod
197197
def get_user_token(cls, handler):
198198
"""Identify the user based on a token in the URL or Authorization header
199-
199+
200200
Returns:
201201
- uuid if authenticated
202202
- None if not

jupyter_server/base/zmqhandlers.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def serialize_binary_message(msg):
3232
3333
Returns
3434
-------
35-
3635
The message serialized to bytes.
3736
3837
"""
@@ -64,7 +63,6 @@ def deserialize_binary_message(bmsg):
6463
6564
Returns
6665
-------
67-
6866
message dictionary
6967
"""
7068
nbufs = struct.unpack('!i', bmsg[:4])[0]

jupyter_server/extension/serverextension.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def _get_config_dir(user=False, sys_prefix=False):
2727
2828
Parameters
2929
----------
30-
3130
user : bool [default: False]
3231
Get the user's .jupyter config directory
3332
sys_prefix : bool [default: False]

jupyter_server/gateway/managers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def init_static_args(self):
293293

294294
def load_connection_args(self, **kwargs):
295295
"""Merges the static args relative to the connection, with the given keyword arguments. If statics
296-
have yet to be initialized, we'll do that here.
296+
have yet to be initialized, we'll do that here.
297297
298298
"""
299299
if len(self._static_args) == 0:
@@ -360,7 +360,7 @@ def _get_kernel_endpoint_url(self, kernel_id=None):
360360
361361
Parameters
362362
----------
363-
kernel_id: kernel UUID (optional)
363+
kernel_id : kernel UUID (optional)
364364
"""
365365
if kernel_id:
366366
return url_path_join(self.base_endpoint, url_escape(str(kernel_id)))
@@ -562,7 +562,7 @@ def _get_kernelspecs_endpoint_url(self, kernel_name=None):
562562
563563
Parameters
564564
----------
565-
kernel_name: kernel name (optional)
565+
kernel_name : kernel name (optional)
566566
"""
567567
if kernel_name:
568568
return url_path_join(self.base_endpoint, url_escape(kernel_name))

jupyter_server/serverapp.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,19 +1826,16 @@ def initialize(self, argv=None, find_extensions=True, new_httpserver=True, start
18261826
18271827
Parameters
18281828
----------
1829-
argv: list or None
1829+
argv : list or None
18301830
CLI arguments to parse.
1831-
1832-
find_extensions: bool
1831+
find_extensions : bool
18331832
If True, find and load extensions listed in Jupyter config paths. If False,
18341833
only load extensions that are passed to ServerApp directy through
18351834
the `argv`, `config`, or `jpserver_extensions` arguments.
1836-
1837-
new_httpserver: bool
1835+
new_httpserver : bool
18381836
If True, a tornado HTTPServer instance will be created and configured for the Server Web
18391837
Application. This will set the http_server attribute of this class.
1840-
1841-
starter_extension: str
1838+
starter_extension : str
18421839
If given, it references the name of an extension point that started the Server.
18431840
We will try to load configuration from extension point
18441841
"""

jupyter_server/services/contents/checkpoints.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ def create_notebook_checkpoint(self, nb, path):
121121
def get_file_checkpoint(self, checkpoint_id, path):
122122
"""Get the content of a checkpoint for a non-notebook file.
123123
124-
Returns a dict of the form:
125-
{
126-
'type': 'file',
127-
'content': <str>,
128-
'format': {'text','base64'},
129-
}
124+
Returns a dict of the form:
125+
{
126+
'type': 'file',
127+
'content': <str>,
128+
'format': {'text','base64'},
129+
}
130130
"""
131131
raise NotImplementedError("must be implemented in a subclass")
132132

@@ -229,12 +229,12 @@ async def create_notebook_checkpoint(self, nb, path):
229229
async def get_file_checkpoint(self, checkpoint_id, path):
230230
"""Get the content of a checkpoint for a non-notebook file.
231231
232-
Returns a dict of the form:
233-
{
234-
'type': 'file',
235-
'content': <str>,
236-
'format': {'text','base64'},
237-
}
232+
Returns a dict of the form:
233+
{
234+
'type': 'file',
235+
'content': <str>,
236+
'format': {'text','base64'},
237+
}
238238
"""
239239
raise NotImplementedError("must be implemented in a subclass")
240240

jupyter_server/services/contents/fileio.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,14 @@ def atomic_writing(path, text=True, encoding='utf-8', log=None, **kwargs):
8787
Parameters
8888
----------
8989
path : str
90-
The target file to write to.
91-
90+
The target file to write to.
9291
text : bool, optional
93-
Whether to open the file in text mode (i.e. to write unicode). Default is
94-
True.
95-
92+
Whether to open the file in text mode (i.e. to write unicode). Default is
93+
True.
9694
encoding : str, optional
97-
The encoding to use for files opened in text mode. Default is UTF-8.
98-
95+
The encoding to use for files opened in text mode. Default is UTF-8.
9996
**kwargs
100-
Passed to :func:`io.open`.
97+
Passed to :func:`io.open`.
10198
"""
10299
# realpath doesn't work on Windows: https://bugs.python.org/issue9949
103100
# Luckily, we only need to resolve the file itself being a symlink, not
@@ -143,17 +140,14 @@ def _simple_writing(path, text=True, encoding='utf-8', log=None, **kwargs):
143140
Parameters
144141
----------
145142
path : str
146-
The target file to write to.
147-
143+
The target file to write to.
148144
text : bool, optional
149-
Whether to open the file in text mode (i.e. to write unicode). Default is
150-
True.
151-
145+
Whether to open the file in text mode (i.e. to write unicode). Default is
146+
True.
152147
encoding : str, optional
153-
The encoding to use for files opened in text mode. Default is UTF-8.
154-
148+
The encoding to use for files opened in text mode. Default is UTF-8.
155149
**kwargs
156-
Passed to :func:`io.open`.
150+
Passed to :func:`io.open`.
157151
"""
158152
# realpath doesn't work on Windows: https://bugs.python.org/issue9949
159153
# Luckily, we only need to resolve the file itself being a symlink, not

jupyter_server/services/contents/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def increment_filename(self, filename, path='', insert=''):
327327
The name of a file, including extension
328328
path : unicode
329329
The API path of the target's directory
330-
insert: unicode
330+
insert : unicode
331331
The characters to insert after the base filename
332332
333333
Returns
@@ -692,7 +692,7 @@ async def increment_filename(self, filename, path='', insert=''):
692692
The name of a file, including extension
693693
path : unicode
694694
The API path of the target's directory
695-
insert: unicode
695+
insert : unicode
696696
The characters to insert after the base filename
697697
698698
Returns

jupyter_server/services/kernels/kernelmanager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ def start_buffering(self, kernel_id, session_key, channels):
252252
----------
253253
kernel_id : str
254254
The id of the kernel to stop buffering.
255-
session_key: str
255+
session_key : str
256256
The session_key, if any, that should get the buffer.
257257
If the session_key matches the current buffered session_key,
258258
the buffer will be returned.
259-
channels: dict({'channel': ZMQStream})
259+
channels : dict({'channel': ZMQStream})
260260
The zmq channels whose messages should be buffered.
261261
"""
262262

@@ -291,7 +291,7 @@ def get_buffer(self, kernel_id, session_key):
291291
----------
292292
kernel_id : str
293293
The id of the kernel to stop buffering.
294-
session_key: str, optional
294+
session_key : str, optional
295295
The session_key, if any, that should get the buffer.
296296
If the session_key matches the current buffered session_key,
297297
the buffer will be returned.

jupyter_server/tests/services/sessions/test_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def session_client(jp_root_dir, jp_fetch):
150150

151151
def assert_kernel_equality(actual, expected):
152152
""" Compares kernel models after taking into account that execution_states
153-
may differ from 'starting' to 'idle'. The 'actual' argument is the
154-
current state (which may have an 'idle' status) while the 'expected'
155-
argument is the previous state (which may have a 'starting' status).
153+
may differ from 'starting' to 'idle'. The 'actual' argument is the
154+
current state (which may have an 'idle' status) while the 'expected'
155+
argument is the previous state (which may have a 'starting' status).
156156
"""
157157
actual.pop('execution_state', None)
158158
actual.pop('last_activity', None)
@@ -163,8 +163,8 @@ def assert_kernel_equality(actual, expected):
163163

164164
def assert_session_equality(actual, expected):
165165
""" Compares session models. `actual` is the most current session,
166-
while `expected` is the target of the comparison. This order
167-
matters when comparing the kernel sub-models.
166+
while `expected` is the target of the comparison. This order
167+
matters when comparing the kernel sub-models.
168168
"""
169169
assert actual['id'] == expected['id']
170170
assert actual['path'] == expected['path']

jupyter_server/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ def samefile_simple(path, other_path):
8686
Only to be used if os.path.samefile is not available.
8787
8888
Parameters
89-
-----------
90-
path: String representing a path to a file
91-
other_path: String representing a path to another file
89+
----------
90+
path : String representing a path to a file
91+
other_path : String representing a path to another file
9292
9393
Returns
94-
-----------
94+
-------
9595
same: Boolean that is True if both path and other path are the same
9696
"""
9797
path_stat = os.stat(path)
@@ -197,7 +197,7 @@ def run_sync(maybe_async):
197197
198198
Returns
199199
-------
200-
result :
200+
result
201201
Whatever the async object returns, or the object itself.
202202
"""
203203
if not inspect.isawaitable(maybe_async):

0 commit comments

Comments
 (0)