Skip to content

Commit 56c8334

Browse files
committed
Reformat files
1 parent e1cd793 commit 56c8334

File tree

5 files changed

+24
-23
lines changed

5 files changed

+24
-23
lines changed

shinywidgets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
__version__ = "0.1.4.9000"
66

77

8-
from ._shinywidgets import output_widget, register_widget, render_widget, reactive_read
8+
from ._shinywidgets import output_widget, reactive_read, register_widget, render_widget
99

1010
__all__ = ("output_widget", "register_widget", "render_widget", "reactive_read")

shinywidgets/_comm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from base64 import b64encode
2-
from typing import Callable, Dict, Optional, List
2+
from typing import Callable, Dict, List, Optional
33

4-
from shiny.session import get_current_session
54
from shiny._utils import run_coro_hybrid
5+
from shiny.session import get_current_session
66

77
from ._serialization import json_packer
88

@@ -24,6 +24,7 @@ def unregister_comm(self, comm: "ShinyComm") -> "ShinyComm":
2424
MetadataType = Optional[Dict[str, object]]
2525
BufferType = Optional[List[bytes]]
2626

27+
2728
# Compare to `ipykernel.comm.Comm` (uses the Shiny session instead of a Kernel to send/receive messages).
2829
# Also note that `ipywidgets.widgets.Widget` is responsible to calling these methods when need be.
2930
class ShinyComm:

shinywidgets/_dependencies.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
import importlib
22
import json
33
import os
4-
import packaging.version
54
import re
6-
from types import ModuleType
7-
import warnings
85
import tempfile
6+
import warnings
7+
from types import ModuleType
98
from typing import List, Optional
109

11-
from ipywidgets.widgets.widget import Widget
12-
from ipywidgets.widgets.domwidget import DOMWidget
10+
import packaging.version
11+
from htmltools import HTMLDependency, tags
12+
from htmltools._core import HTMLDependencySource
1313
from ipywidgets._version import (
1414
__html_manager_version__, # pyright: ignore[reportUnknownVariableType]
1515
)
16+
from ipywidgets.widgets.domwidget import DOMWidget
17+
from ipywidgets.widgets.widget import Widget
1618
from jupyter_core.paths import jupyter_path # type: ignore
17-
18-
19-
from htmltools import HTMLDependency, tags
20-
from htmltools._core import HTMLDependencySource
2119
from shiny import Session
2220

2321
from . import __version__
2422

23+
2524
# TODO: scripts/static_download.R should produce/update these
2625
def libembed_dependency() -> List[HTMLDependency]:
2726
return [

shinywidgets/_serialization.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from binascii import b2a_base64
2-
from datetime import datetime
3-
from dateutil.tz import tzlocal
41
import json
52
import numbers
6-
from typing import Iterable
73
import warnings
4+
from binascii import b2a_base64
5+
from datetime import datetime
6+
from typing import Iterable
7+
8+
from dateutil.tz import tzlocal
9+
810

911
# Same as `from jupyter_client.session import json_packer` (i.e., Jupyter's
1012
# default JSON serializer), except this returns a string not bytes, and doesn't

shinywidgets/_shinywidgets.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
from ipywidgets._version import (
1818
__protocol_version__, # pyright: ignore[reportUnknownVariableType]
1919
)
20-
2120
from ipywidgets.widgets.widget import (
22-
Widget,
2321
_remove_buffers, # pyright: ignore[reportUnknownVariableType, reportGeneralTypeIssues]
2422
)
23+
from ipywidgets.widgets.widget import Widget
2524
from shiny import Session, event, reactive
2625
from shiny._utils import run_coro_sync, wrap_async
2726
from shiny.http_staticfiles import StaticFiles
27+
from shiny.module import resolve_id
2828
from shiny.render import RenderFunction, RenderFunctionAsync
2929
from shiny.session import get_current_session, require_active_session
30-
from shiny.module import resolve_id
3130

3231
from ._comm import BufferType, ShinyComm, ShinyCommManager
3332
from ._dependencies import (
@@ -194,9 +193,9 @@ def render_widget(
194193

195194

196195
@overload
197-
def render_widget() -> Callable[
198-
[Union[IPyWidgetRenderFunc, IPyWidgetRenderFuncAsync]], IPyWidget
199-
]:
196+
def render_widget() -> (
197+
Callable[[Union[IPyWidgetRenderFunc, IPyWidgetRenderFuncAsync]], IPyWidget]
198+
):
200199
...
201200

202201

@@ -311,7 +310,7 @@ def _():
311310

312311

313312
# similar to base::system.file()
314-
def _package_dir(package: str) -> str:
313+
def package_dir(package: str) -> str:
315314
with tempfile.TemporaryDirectory():
316315
pkg_file = importlib.import_module(".", package=package).__file__
317316
if pkg_file is None:

0 commit comments

Comments
 (0)