Skip to content

Commit f6b6cd2

Browse files
authored
Merge branch 'main' into workspace-config
2 parents 200ae13 + 2101191 commit f6b6cd2

File tree

14 files changed

+43
-67
lines changed

14 files changed

+43
-67
lines changed

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/set_remove.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def handle_click(event):
2424
"style": {
2525
"height": "30px",
2626
"width": "30px",
27-
"background_color": "black"
28-
if index in selected_indices
29-
else "white",
27+
"background_color": (
28+
"black" if index in selected_indices else "white"
29+
),
3030
"outline": "1px solid grey",
3131
"cursor": "pointer",
3232
},

docs/source/guides/adding-interactivity/dangers-of-mutability/_examples/set_update.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def handle_click(event):
2121
"style": {
2222
"height": "30px",
2323
"width": "30px",
24-
"background_color": "black"
25-
if index in selected_indices
26-
else "white",
24+
"background_color": (
25+
"black" if index in selected_indices else "white"
26+
),
2727
"outline": "1px solid grey",
2828
"cursor": "pointer",
2929
},

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ detached = true
1212
dependencies = [
1313
"invoke",
1414
# lint
15-
"black",
16-
"ruff==0.0.278", # Ruff is moving really fast, so pinning for now.
15+
"black==24.1.1", # Pin lint tools we don't control to avoid breaking changes
16+
"ruff==0.0.278", # Pin lint tools we don't control to avoid breaking changes
1717
"toml",
18-
"flake8",
18+
"flake8==7.0.0", # Pin lint tools we don't control to avoid breaking changes
1919
"flake8-pyproject",
2020
"reactpy-flake8 >=0.7",
2121
# types

src/py/reactpy/reactpy/core/_life_cycle_hook.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414

1515
class EffectFunc(Protocol):
16-
async def __call__(self, stop: Event) -> None:
17-
...
16+
async def __call__(self, stop: Event) -> None: ...
1817

1918

2019
logger = logging.getLogger(__name__)

src/py/reactpy/reactpy/core/events.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ def event(
1515
*,
1616
stop_propagation: bool = ...,
1717
prevent_default: bool = ...,
18-
) -> EventHandler:
19-
...
18+
) -> EventHandler: ...
2019

2120

2221
@overload
@@ -25,8 +24,7 @@ def event(
2524
*,
2625
stop_propagation: bool = ...,
2726
prevent_default: bool = ...,
28-
) -> Callable[[Callable[..., Any]], EventHandler]:
29-
...
27+
) -> Callable[[Callable[..., Any]], EventHandler]: ...
3028

3129

3230
def event(

src/py/reactpy/reactpy/core/hooks.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@
4242

4343

4444
@overload
45-
def use_state(initial_value: Callable[[], _Type]) -> State[_Type]:
46-
...
45+
def use_state(initial_value: Callable[[], _Type]) -> State[_Type]: ...
4746

4847

4948
@overload
50-
def use_state(initial_value: _Type) -> State[_Type]:
51-
...
49+
def use_state(initial_value: _Type) -> State[_Type]: ...
5250

5351

5452
def use_state(initial_value: _Type | Callable[[], _Type]) -> State[_Type]:
@@ -105,16 +103,14 @@ def dispatch(new: _Type | Callable[[_Type], _Type]) -> None:
105103
def use_effect(
106104
function: None = None,
107105
dependencies: Sequence[Any] | ellipsis | None = ...,
108-
) -> Callable[[_EffectApplyFunc], None]:
109-
...
106+
) -> Callable[[_EffectApplyFunc], None]: ...
110107

111108

112109
@overload
113110
def use_effect(
114111
function: _EffectApplyFunc,
115112
dependencies: Sequence[Any] | ellipsis | None = ...,
116-
) -> None:
117-
...
113+
) -> None: ...
118114

119115

120116
def use_effect(
@@ -313,16 +309,14 @@ def dispatch(action: _ActionType) -> None:
313309
def use_callback(
314310
function: None = None,
315311
dependencies: Sequence[Any] | ellipsis | None = ...,
316-
) -> Callable[[_CallbackFunc], _CallbackFunc]:
317-
...
312+
) -> Callable[[_CallbackFunc], _CallbackFunc]: ...
318313

319314

320315
@overload
321316
def use_callback(
322317
function: _CallbackFunc,
323318
dependencies: Sequence[Any] | ellipsis | None = ...,
324-
) -> _CallbackFunc:
325-
...
319+
) -> _CallbackFunc: ...
326320

327321

328322
def use_callback(
@@ -358,24 +352,21 @@ def setup(function: _CallbackFunc) -> _CallbackFunc:
358352
class _LambdaCaller(Protocol):
359353
"""MyPy doesn't know how to deal with TypeVars only used in function return"""
360354

361-
def __call__(self, func: Callable[[], _Type]) -> _Type:
362-
...
355+
def __call__(self, func: Callable[[], _Type]) -> _Type: ...
363356

364357

365358
@overload
366359
def use_memo(
367360
function: None = None,
368361
dependencies: Sequence[Any] | ellipsis | None = ...,
369-
) -> _LambdaCaller:
370-
...
362+
) -> _LambdaCaller: ...
371363

372364

373365
@overload
374366
def use_memo(
375367
function: Callable[[], _Type],
376368
dependencies: Sequence[Any] | ellipsis | None = ...,
377-
) -> _Type:
378-
...
369+
) -> _Type: ...
379370

380371

381372
def use_memo(

src/py/reactpy/reactpy/core/types.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ class _JsonImportSource(TypedDict):
159159
class EventHandlerFunc(Protocol):
160160
"""A coroutine which can handle event data"""
161161

162-
async def __call__(self, data: Sequence[Any]) -> None:
163-
...
162+
async def __call__(self, data: Sequence[Any]) -> None: ...
164163

165164

166165
@runtime_checkable
@@ -192,18 +191,17 @@ class VdomDictConstructor(Protocol):
192191
"""Standard function for constructing a :class:`VdomDict`"""
193192

194193
@overload
195-
def __call__(self, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict:
196-
...
194+
def __call__(
195+
self, attributes: VdomAttributes, *children: VdomChildren
196+
) -> VdomDict: ...
197197

198198
@overload
199-
def __call__(self, *children: VdomChildren) -> VdomDict:
200-
...
199+
def __call__(self, *children: VdomChildren) -> VdomDict: ...
201200

202201
@overload
203202
def __call__(
204203
self, *attributes_and_children: VdomAttributes | VdomChildren
205-
) -> VdomDict:
206-
...
204+
) -> VdomDict: ...
207205

208206

209207
class LayoutUpdateMessage(TypedDict):
@@ -236,8 +234,7 @@ def __call__(
236234
*children: Any,
237235
value: _Type = ...,
238236
key: Key | None = ...,
239-
) -> ContextProviderType[_Type]:
240-
...
237+
) -> ContextProviderType[_Type]: ...
241238

242239

243240
class ContextProviderType(ComponentType, Protocol[_Type]):

src/py/reactpy/reactpy/core/vdom.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,11 @@ def is_vdom(value: Any) -> bool:
125125

126126

127127
@overload
128-
def vdom(tag: str, *children: VdomChildren) -> VdomDict:
129-
...
128+
def vdom(tag: str, *children: VdomChildren) -> VdomDict: ...
130129

131130

132131
@overload
133-
def vdom(tag: str, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict:
134-
...
132+
def vdom(tag: str, attributes: VdomAttributes, *children: VdomChildren) -> VdomDict: ...
135133

136134

137135
def vdom(
@@ -345,8 +343,7 @@ def __call__(
345343
children: Sequence[VdomChild],
346344
key: Key | None,
347345
event_handlers: EventHandlerDict,
348-
) -> VdomDict:
349-
...
346+
) -> VdomDict: ...
350347

351348

352349
class _EllipsisRepr:

src/py/reactpy/reactpy/web/module.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ def export(
314314
export_names: str,
315315
fallback: Any | None = ...,
316316
allow_children: bool = ...,
317-
) -> VdomDictConstructor:
318-
...
317+
) -> VdomDictConstructor: ...
319318

320319

321320
@overload
@@ -324,8 +323,7 @@ def export(
324323
export_names: list[str] | tuple[str, ...],
325324
fallback: Any | None = ...,
326325
allow_children: bool = ...,
327-
) -> list[VdomDictConstructor]:
328-
...
326+
) -> list[VdomDictConstructor]: ...
329327

330328

331329
def export(

src/py/reactpy/reactpy/widgets.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ def sync_inputs(event: dict[str, Any]) -> None:
8282

8383

8484
class _CastFunc(Protocol[_CastTo_co]):
85-
def __call__(self, value: str) -> _CastTo_co:
86-
...
85+
def __call__(self, value: str) -> _CastTo_co: ...
8786

8887

8988
if TYPE_CHECKING:

src/py/reactpy/tests/test__console/test_rewrite_camel_case_props.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def test_rewrite_camel_case_props_declarations_no_files():
106106
None,
107107
),
108108
],
109-
ids=lambda item: " ".join(map(str.strip, item.split()))
110-
if isinstance(item, str)
111-
else item,
109+
ids=lambda item: (
110+
" ".join(map(str.strip, item.split())) if isinstance(item, str) else item
111+
),
112112
)
113113
def test_generate_rewrite(source, expected):
114114
actual = generate_rewrite(Path("test.py"), dedent(source).strip())

src/py/reactpy/tests/test__console/test_rewrite_keys.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ def func():
225225
None,
226226
),
227227
],
228-
ids=lambda item: " ".join(map(str.strip, item.split()))
229-
if isinstance(item, str)
230-
else item,
228+
ids=lambda item: (
229+
" ".join(map(str.strip, item.split())) if isinstance(item, str) else item
230+
),
231231
)
232232
def test_generate_rewrite(source, expected):
233233
actual = generate_rewrite(Path("test.py"), dedent(source).strip())

src/py/reactpy/tests/test_core/test_layout.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def no_logged_errors():
4848

4949
def test_layout_repr():
5050
@reactpy.component
51-
def MyComponent():
52-
...
51+
def MyComponent(): ...
5352

5453
my_component = MyComponent()
5554
layout = reactpy.Layout(my_component)
@@ -65,8 +64,7 @@ def test_layout_expects_abstract_component():
6564

6665
async def test_layout_cannot_be_used_outside_context_manager(caplog):
6766
@reactpy.component
68-
def Component():
69-
...
67+
def Component(): ...
7068

7169
component = Component()
7270
layout = reactpy.Layout(component)

tasks.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
class ReleasePrepFunc(Protocol):
2929
def __call__(
3030
self, context: Context, package: PackageInfo
31-
) -> Callable[[bool], None]:
32-
...
31+
) -> Callable[[bool], None]: ...
3332

3433
LanguageName: TypeAlias = "Literal['py', 'js']"
3534

0 commit comments

Comments
 (0)