Skip to content

Commit e9ff451

Browse files
committed
Apply formatting with black
1 parent b00f293 commit e9ff451

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

docs/conf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#
1313
import os
1414
import sys
15-
sys.path.insert(0, os.path.abspath('..'))
15+
16+
sys.path.insert(0, os.path.abspath(".."))
1617
from jupyter_ui_poll import __version__
1718

1819

@@ -84,8 +85,8 @@
8485
"logo_only": True,
8586
}
8687

87-
#html_logo = '_static/logo.svg'
88-
html_last_updated_fmt = '%b %d, %Y'
88+
# html_logo = '_static/logo.svg'
89+
html_last_updated_fmt = "%b %d, %Y"
8990
html_show_sphinx = False
9091

9192

jupyter_ui_poll/_poll.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import time
44
from collections import abc
55
from functools import singledispatch
6-
from inspect import iscoroutinefunction, isawaitable
6+
from inspect import isawaitable, iscoroutinefunction
77
from typing import (
88
Any,
99
AsyncIterable,
@@ -16,7 +16,6 @@
1616
Optional,
1717
Tuple,
1818
TypeVar,
19-
Union,
2019
)
2120

2221
import zmq
@@ -153,7 +152,9 @@ def get() -> "KernelWrapper":
153152

154153
class IteratorWrapperAsync(abc.AsyncIterable, Generic[T]):
155154
def __init__(
156-
self, its: AsyncIterable[T], n: int = 1,
155+
self,
156+
its: AsyncIterable[T],
157+
n: int = 1,
157158
):
158159
self._its = its
159160
self._n = n
@@ -172,7 +173,9 @@ async def _loop(
172173

173174
class IteratorWrapper(abc.Iterable, Generic[T]):
174175
def __init__(
175-
self, its: Iterable[T], n: int = 1,
176+
self,
177+
its: Iterable[T],
178+
n: int = 1,
176179
):
177180
self._its = its
178181
self._n = n

notebooks/ComplexUIExample.ipynb

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"from ipywidgets import HTML\n",
2424
"from ui import blocking_ui\n",
2525
"\n",
26-
"color, mode = blocking_ui(default='beige', timeout=10)"
26+
"color, mode = blocking_ui(default=\"beige\", timeout=10)"
2727
]
2828
},
2929
{
@@ -32,18 +32,20 @@
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [
35-
"if mode == 'user':\n",
35+
"if mode == \"user\":\n",
3636
" print(f\"So you picked '{color}'\")\n",
3737
"else:\n",
38-
" print('Try to click faster next time')\n",
38+
" print(\"Try to click faster next time\")\n",
3939
"\n",
40-
"HTML(f'''\n",
40+
"HTML(\n",
41+
" f\"\"\"\n",
4142
"<div style=\"width:100px;\n",
4243
" height:100px;\n",
4344
" background:{color};\n",
4445
" padding:10px;\n",
4546
" border-color:black;\n",
46-
" border-style:solid\"><b>{color}</b></div>''')"
47+
" border-style:solid\"><b>{color}</b></div>\"\"\"\n",
48+
")"
4749
]
4850
},
4951
{

notebooks/ui.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,27 @@ def mk_btn(color):
5555

5656

5757
def blocking_ui(default="beige", timeout=10):
58-
""" Displays a UI then blocks until user makes a choice or timeout happens.
58+
"""Displays a UI then blocks until user makes a choice or timeout happens.
5959
60-
Returns
61-
=======
62-
(color, 'user') if user selects a color in time
63-
(default, 'timeout') in case of a timeout
60+
Returns
61+
=======
62+
(color, 'user') if user selects a color in time
63+
(default, 'timeout') in case of a timeout
6464
"""
6565
state = make_sample_ui()
6666

6767
def poll_cbk():
68-
""" This function is called periodically.
68+
"""This function is called periodically.
6969
70-
- Check for user input
71-
- Check for timeout
72-
- Update timeout progress bar
70+
- Check for user input
71+
- Check for timeout
72+
- Update timeout progress bar
7373
74-
Returns
75-
-------
76-
(color: str, 'user') -- when user selection detected
77-
(default: str, 'timeout') -- when no user selection for too long
78-
None -- in all other cases
74+
Returns
75+
-------
76+
(color: str, 'user') -- when user selection detected
77+
(default: str, 'timeout') -- when no user selection for too long
78+
None -- in all other cases
7979
"""
8080
if state.color is not None: # User selected some color
8181
return state.color, "user"

0 commit comments

Comments
 (0)