Skip to content

Commit ca5622a

Browse files
authored
Merge pull request #493 from Carreau/doc-1
DOC: Autoreformat docstrings.
2 parents 3cb4230 + 0fa4721 commit ca5622a

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
@@ -1823,19 +1823,16 @@ def initialize(self, argv=None, find_extensions=True, new_httpserver=True, start
18231823
18241824
Parameters
18251825
----------
1826-
argv: list or None
1826+
argv : list or None
18271827
CLI arguments to parse.
1828-
1829-
find_extensions: bool
1828+
find_extensions : bool
18301829
If True, find and load extensions listed in Jupyter config paths. If False,
18311830
only load extensions that are passed to ServerApp directy through
18321831
the `argv`, `config`, or `jpserver_extensions` arguments.
1833-
1834-
new_httpserver: bool
1832+
new_httpserver : bool
18351833
If True, a tornado HTTPServer instance will be created and configured for the Server Web
18361834
Application. This will set the http_server attribute of this class.
1837-
1838-
starter_extension: str
1835+
starter_extension : str
18391836
If given, it references the name of an extension point that started the Server.
18401837
We will try to load configuration from extension point
18411838
"""

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
@@ -86,17 +86,14 @@ def atomic_writing(path, text=True, encoding='utf-8', log=None, **kwargs):
8686
Parameters
8787
----------
8888
path : str
89-
The target file to write to.
90-
89+
The target file to write to.
9190
text : bool, optional
92-
Whether to open the file in text mode (i.e. to write unicode). Default is
93-
True.
94-
91+
Whether to open the file in text mode (i.e. to write unicode). Default is
92+
True.
9593
encoding : str, optional
96-
The encoding to use for files opened in text mode. Default is UTF-8.
97-
94+
The encoding to use for files opened in text mode. Default is UTF-8.
9895
**kwargs
99-
Passed to :func:`io.open`.
96+
Passed to :func:`io.open`.
10097
"""
10198
# realpath doesn't work on Windows: https://bugs.python.org/issue9949
10299
# Luckily, we only need to resolve the file itself being a symlink, not
@@ -142,17 +139,14 @@ def _simple_writing(path, text=True, encoding='utf-8', log=None, **kwargs):
142139
Parameters
143140
----------
144141
path : str
145-
The target file to write to.
146-
142+
The target file to write to.
147143
text : bool, optional
148-
Whether to open the file in text mode (i.e. to write unicode). Default is
149-
True.
150-
144+
Whether to open the file in text mode (i.e. to write unicode). Default is
145+
True.
151146
encoding : str, optional
152-
The encoding to use for files opened in text mode. Default is UTF-8.
153-
147+
The encoding to use for files opened in text mode. Default is UTF-8.
154148
**kwargs
155-
Passed to :func:`io.open`.
149+
Passed to :func:`io.open`.
156150
"""
157151
# realpath doesn't work on Windows: https://bugs.python.org/issue9949
158152
# 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
@@ -326,7 +326,7 @@ def increment_filename(self, filename, path='', insert=''):
326326
The name of a file, including extension
327327
path : unicode
328328
The API path of the target's directory
329-
insert: unicode
329+
insert : unicode
330330
The characters to insert after the base filename
331331
332332
Returns
@@ -691,7 +691,7 @@ async def increment_filename(self, filename, path='', insert=''):
691691
The name of a file, including extension
692692
path : unicode
693693
The API path of the target's directory
694-
insert: unicode
694+
insert : unicode
695695
The characters to insert after the base filename
696696
697697
Returns

jupyter_server/services/kernels/kernelmanager.py

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

@@ -290,7 +290,7 @@ def get_buffer(self, kernel_id, session_key):
290290
----------
291291
kernel_id : str
292292
The id of the kernel to stop buffering.
293-
session_key: str, optional
293+
session_key : str, optional
294294
The session_key, if any, that should get the buffer.
295295
If the session_key matches the current buffered session_key,
296296
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
@@ -82,12 +82,12 @@ def samefile_simple(path, other_path):
8282
Only to be used if os.path.samefile is not available.
8383
8484
Parameters
85-
-----------
86-
path: String representing a path to a file
87-
other_path: String representing a path to another file
85+
----------
86+
path : String representing a path to a file
87+
other_path : String representing a path to another file
8888
8989
Returns
90-
-----------
90+
-------
9191
same: Boolean that is True if both path and other path are the same
9292
"""
9393
path_stat = os.stat(path)
@@ -193,7 +193,7 @@ def run_sync(maybe_async):
193193
194194
Returns
195195
-------
196-
result :
196+
result
197197
Whatever the async object returns, or the object itself.
198198
"""
199199
if not inspect.isawaitable(maybe_async):

0 commit comments

Comments
 (0)