Skip to content

Commit c8443cd

Browse files
committed
sort imports
1 parent 286540b commit c8443cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+162
-199
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ repos:
1212
hooks:
1313
- id: nbstripout
1414
files: ".ipynb"
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.6.3
17+
hooks:
18+
- id: isort
19+
name: isort

docs/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import os
22
import sys
33
from pathlib import Path
4-
from pathlib import Path
54

6-
from sanic import Sanic
7-
from sanic import response
5+
from sanic import Sanic, response
86

97
import idom
10-
from idom.widgets.utils import multiview
118
from idom.client.manage import APP_DIR
129
from idom.server.sanic import PerClientStateServer
10+
from idom.widgets.utils import multiview
1311

1412
here = Path(__file__).parent
1513

docs/source/_exts/async_doctest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
from doctest import DocTest, DocTestRunner
12
from textwrap import indent
23
from typing import Any
34

45
from sphinx.application import Sphinx
5-
from sphinx.ext.doctest import DocTestBuilder, setup as doctest_setup
6-
from doctest import DocTest, DocTestRunner
7-
6+
from sphinx.ext.doctest import DocTestBuilder
7+
from sphinx.ext.doctest import setup as doctest_setup
88

99
test_template = """
1010
import asyncio as __asyncio

docs/source/_exts/interactive_widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from sphinx.application import Sphinx
2-
from docutils.parsers.rst import Directive
31
from docutils.nodes import raw
2+
from docutils.parsers.rst import Directive
3+
from sphinx.application import Sphinx
44

55

66
class IteractiveWidget(Directive):

docs/source/_exts/widget_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from pathlib import Path
22

3-
from sphinx.application import Sphinx
4-
from sphinx.util.docutils import SphinxDirective
53
from docutils.parsers.rst import directives
64
from docutils.statemachine import StringList
7-
5+
from sphinx.application import Sphinx
6+
from sphinx.util.docutils import SphinxDirective
87
from sphinx_panels.tabs import TabbedDirective
98

109
here = Path(__file__).parent

docs/source/examples/material_ui_button_on_click.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import idom
44

5-
65
material_ui = idom.install("@material-ui/core", fallback="loading...")
76

87

docs/source/examples/material_ui_slider.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import idom
44

5-
65
material_ui = idom.install("@material-ui/core", fallback="loading...")
76

87

docs/source/examples/simple_dashboard.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import idom
66
from idom.widgets.html import Input
77

8-
98
victory = idom.install("victory", fallback="loading...")
109

1110

docs/source/examples/super_simple_chart.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import idom
44

5-
65
path_to_source_file = Path(__file__).parent / "super_simple_chart.js"
76
ssc = idom.Module("super-simple-chart", source_file=path_to_source_file)
87

idom/__init__.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
1-
from pkg_resources import (
2-
get_distribution as _get_distribution,
3-
DistributionNotFound as _DistributionNotFound,
4-
)
1+
from pkg_resources import DistributionNotFound as _DistributionNotFound
2+
from pkg_resources import get_distribution as _get_distribution
53

64
try:
75
__version__: str = _get_distribution(__name__).version
86
except _DistributionNotFound: # pragma: no cover
97
# package is not installed
108
__version__ = "0.0.0"
119

12-
from .utils import Ref, html_to_vdom
13-
14-
from .core.component import component, Component
15-
from .core.events import event, Events
16-
from .core.layout import Layout
17-
from .core.vdom import vdom, VdomDict
10+
from .client.module import Import, Module, install
1811
from .core import hooks
19-
12+
from .core.component import Component, component
13+
from .core.events import Events, event
14+
from .core.layout import Layout
15+
from .core.vdom import VdomDict, vdom
16+
from .server.prefab import run
17+
from .utils import Ref, html_to_vdom
2018
from .widgets.html import html
2119
from .widgets.utils import hotswap, multiview
2220

23-
from .client.module import Module, Import, install
24-
25-
from .server.prefab import run
26-
27-
from . import widgets
28-
2921
# try to automatically setup the dialect's import hook
3022
try:
23+
import htm
3124
import pyalect
3225
import tagged
33-
import htm
3426
except ImportError: # pragma: no cover
3527
pass
3628
else:

idom/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from .cli import main
66

7-
87
logger.remove(0)
98
logger.add(sys.stdout, format="{message}", level="INFO")
109

idom/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import idom
66
from idom.client import manage as manage_client
77

8-
98
main = typer.Typer()
109
show = typer.Typer()
1110
main.add_typer(show, name="show", short_help="Display information about IDOM")

idom/client/manage.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
import subprocess
44
from pathlib import Path
55
from tempfile import TemporaryDirectory
6-
from typing import List, Set, Union, Sequence
6+
from typing import List, Sequence, Set, Union
77

88
from loguru import logger
99

1010
from .utils import (
11-
open_modifiable_json,
1211
find_js_module_exports_in_source,
1312
get_package_name,
13+
open_modifiable_json,
1414
)
1515

16-
1716
APP_DIR = Path(__file__).parent / "app"
1817
BUILD_DIR = APP_DIR / "build"
1918
WEB_MODULES_DIR = BUILD_DIR / "web_modules"

idom/client/module.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from pathlib import Path
2-
from typing import Any, Optional, Union, List, Tuple, Dict, overload
2+
from typing import Any, Dict, List, Optional, Tuple, Union, overload
33
from urllib.parse import urlparse
4-
from idom.core.vdom import VdomDict, ImportSourceDict, make_vdom_constructor
4+
5+
from idom.core.vdom import ImportSourceDict, VdomDict, make_vdom_constructor
56

67
from . import manage
78
from .utils import get_package_name

idom/client/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import re
21
import json
3-
from pathlib import Path
2+
import re
43
from contextlib import contextmanager
5-
from typing import Iterator, Any, List, Tuple
4+
from pathlib import Path
5+
from typing import Any, Iterator, List, Tuple
66

77

88
def get_package_name(pkg: str) -> str:

idom/core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from .component import component, Component, AbstractComponent, ComponentConstructor
2-
from .events import event, Events, EventHandler
3-
from .layout import Layout, Layout
1+
from .component import AbstractComponent, Component, ComponentConstructor, component
42
from .dispatcher import AbstractDispatcher, SharedViewDispatcher, SingleViewDispatcher
3+
from .events import EventHandler, Events, event
4+
from .layout import Layout
55
from .vdom import vdom
66

77
__all__ = [

idom/core/component.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import abc
22
import inspect
33
from functools import wraps
4-
from typing import TYPE_CHECKING, Dict, Callable, Any, Tuple, Union
5-
4+
from typing import TYPE_CHECKING, Any, Callable, Dict, Tuple, Union
65

76
if TYPE_CHECKING: # pragma: no cover
87
from .vdom import VdomDict # noqa

idom/core/dispatcher.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import abc
22
import asyncio
3-
from typing import Callable, Awaitable, Dict, Any, AsyncIterator
3+
from typing import Any, AsyncIterator, Awaitable, Callable, Dict
44

55
from anyio import create_task_group
66
from anyio.abc import TaskGroup
77

8-
from .layout import (
9-
LayoutEvent,
10-
LayoutUpdate,
11-
Layout,
12-
)
8+
from .layout import Layout, LayoutEvent, LayoutUpdate
139
from .utils import HasAsyncResources, async_resource
1410

1511
SendCoroutine = Callable[[Any], Awaitable[None]]

idom/core/events.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import asyncio
22
from typing import (
3-
Mapping,
4-
Dict,
5-
Callable,
63
Any,
4+
Callable,
75
Coroutine,
8-
Optional,
6+
Dict,
97
Iterator,
108
List,
9+
Mapping,
10+
Optional,
1111
Union,
1212
)
1313

1414
from anyio import create_task_group
15-
1615
from mypy_extensions import TypedDict
1716

18-
1917
EventsMapping = Union[Dict[str, Union["Callable[..., Any]", "EventHandler"]], "Events"]
2018

2119

idom/core/hooks.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
import asyncio
22
from threading import get_ident as get_thread_id
33
from typing import (
4-
Awaitable,
5-
Sequence,
6-
Dict,
74
Any,
8-
TypeVar,
5+
Awaitable,
96
Callable,
10-
Tuple,
11-
Optional,
7+
Dict,
128
Generic,
13-
Union,
14-
NamedTuple,
159
List,
16-
overload,
10+
NamedTuple,
11+
Optional,
12+
Sequence,
13+
Tuple,
14+
TypeVar,
15+
Union,
1716
cast,
17+
overload,
1818
)
19-
from typing_extensions import Protocol
2019

2120
from loguru import logger
21+
from typing_extensions import Protocol
2222

2323
from idom.utils import Ref
2424

2525
from .component import AbstractComponent
2626

27-
2827
__all__ = [
2928
"use_state",
3029
"use_effect",

idom/core/layout.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import abc
22
import asyncio
33
from typing import (
4-
List,
4+
Any,
5+
AsyncIterator,
56
Dict,
6-
Tuple,
7+
Iterator,
8+
List,
79
Mapping,
810
NamedTuple,
911
Optional,
10-
Any,
1112
Set,
12-
Iterator,
13-
AsyncIterator,
13+
Tuple,
1414
Union,
1515
)
1616

17+
from jsonpatch import apply_patch, make_patch
1718
from loguru import logger
18-
from jsonpatch import make_patch, apply_patch
1919

2020
from .component import AbstractComponent
2121
from .events import EventHandler, EventTarget
22-
from .utils import HasAsyncResources, async_resource, CannotAccessResource
2322
from .hooks import LifeCycleHook
23+
from .utils import CannotAccessResource, HasAsyncResources, async_resource
2424

2525

2626
class LayoutUpdate(NamedTuple):

idom/core/utils.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
import sys
2-
32
from typing import (
4-
TypeVar,
53
Any,
6-
Type,
7-
Callable,
8-
Optional,
94
AsyncIterator,
10-
Generic,
11-
Union,
5+
Callable,
126
Dict,
7+
Generic,
8+
Optional,
139
Tuple,
10+
Type,
11+
TypeVar,
12+
Union,
1413
cast,
1514
overload,
1615
)
1716

1817
if sys.version_info >= (3, 7): # pragma: no cover
19-
from contextlib import asynccontextmanager, AsyncExitStack # noqa
18+
from contextlib import AsyncExitStack, asynccontextmanager # noqa
2019
else: # pragma: no cover
21-
from async_generator import asynccontextmanager
2220
from async_exit_stack import AsyncExitStack
21+
from async_generator import asynccontextmanager
2322

2423

2524
_Rsrc = TypeVar("_Rsrc")

idom/core/vdom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from typing import Optional, Iterable, Any, Dict, List, Tuple, Union, Mapping, Callable
1+
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Tuple, Union
22

33
from mypy_extensions import TypedDict
44
from typing_extensions import Protocol
55

6-
from .events import EventsMapping
76
from .component import AbstractComponent
7+
from .events import EventsMapping
88

99

1010
class ImportSourceDict(TypedDict):

idom/dialect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import ast
2-
from typing import Optional, List, Union, Any, Tuple
2+
from typing import Any, List, Optional, Tuple, Union
33

44
import htm
5-
from pyalect import DialectError, Dialect
5+
from pyalect import Dialect, DialectError
66

77

88
class HtmlDialectTranspiler(Dialect, name="html"):

0 commit comments

Comments
 (0)