Skip to content

Commit af9a90d

Browse files
committed
Apply formatting fixes
1 parent c618058 commit af9a90d

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/reactpy_router/components.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@
55
from uuid import uuid4
66

77
from reactpy import component, html, use_connection, use_ref
8-
from reactpy.types import Location
98
from reactpy.reactjs import component_from_file
9+
from reactpy.types import Location
1010

1111
from reactpy_router.hooks import _use_route_state
1212
from reactpy_router.types import Route
1313

1414
if TYPE_CHECKING:
15-
from reactpy.types import Key, VdomDict, Component
15+
from reactpy.types import Component, Key, VdomDict
1616

17-
History = component_from_file(Path(__file__).parent / "static" / "bundle.js", import_names="History", name="reactpy-router")
17+
History = component_from_file(
18+
Path(__file__).parent / "static" / "bundle.js", import_names="History", name="reactpy-router"
19+
)
1820
"""Client-side portion of history handling"""
1921

2022
Link = component_from_file(Path(__file__).parent / "static" / "bundle.js", import_names="Link", name="reactpy-router")
2123
"""Client-side portion of link handling"""
2224

23-
Navigate = component_from_file(Path(__file__).parent / "static" / "bundle.js", import_names="Navigate", name="reactpy-router")
25+
Navigate = component_from_file(
26+
Path(__file__).parent / "static" / "bundle.js", import_names="Navigate", name="reactpy-router"
27+
)
2428
"""Client-side portion of the navigate component"""
2529

2630

src/reactpy_router/routers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88

99
from reactpy import component, use_memo, use_state
1010
from reactpy.core.hooks import ConnectionContext, use_connection
11-
from reactpy.types import Component, VdomDict, Connection, Location
11+
from reactpy.types import Component, Connection, Location, VdomDict
1212

1313
from reactpy_router.components import History
1414
from reactpy_router.hooks import RouteState, _route_state_context
1515
from reactpy_router.resolvers import ReactPyResolver
1616

1717
if TYPE_CHECKING:
1818
from collections.abc import Iterator, Sequence
19+
1920
from reactpy_router.types import CompiledRoute, MatchedRoute, Resolver, Route, Router
2021

2122
__all__ = ["browser_router", "create_router"]

src/reactpy_router/types.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
if TYPE_CHECKING:
1212
from collections.abc import Sequence
1313

14-
from reactpy.types import Location
1514
from reactpy.core.component import Component
16-
from reactpy.types import Key
15+
from reactpy.types import Key, Location
1716

1817
ConversionFunc: TypeAlias = Callable[[str], Any]
1918
"""A function that converts a string to a specific type."""
@@ -42,7 +41,11 @@ class Route:
4241

4342
def __hash__(self) -> int:
4443
el = self.element
45-
key = el["attributes"]["key"] if is_vdom(el) and "attributes" in el and "key" in el["attributes"] else getattr(el, "key", id(el))
44+
key = (
45+
el["attributes"]["key"]
46+
if is_vdom(el) and "attributes" in el and "key" in el["attributes"]
47+
else getattr(el, "key", id(el))
48+
)
4649
return hash((self.path, key, self.routes))
4750

4851

0 commit comments

Comments
 (0)